PDA

View Full Version : Just installed the hack.. but error...


PING1434a
12 Jun 2005, 23:14
Hello, I just installed this RPG Hack into a fresh installation of VB 3.0.7
I tried it out to see what it was like, but after making a post i got an error:

at the very top of the page, i get:

Warning: Invalid argument(s) passed to pow() in /includes/functions_rpg.php on line 591

Warning: Invalid argument(s) passed to pow() in /includes/functions_rpg.php on line 591

than i get this message:
vBulletin Message
Unable to add cookies, header already sent.
File: N/A
Line: 0

it seems like there's a problem with:

$level = pow(log10($experience), $exprate);

in

function fetch_rpg_level($experience, $exprate = 3, $returnfloat = 0)
{
if ($returnfloat)
{
if ($experience > 0)
{
$level = pow(log10($experience), $exprate);
return $level;
}
else
{
return 1;
}
}
else
{
if ($experience > 0)
{
$level = floor(pow(log10($experience), $exprate)) + 1;
return $level;
}
else
{
return 1;
}
}
}

Can anyone point me to the right direction?

FIXED! it's my PHP version that was causing it... that's what it seems like, I added (float) in front of the variable and got a work around. My php version is 4.2.2

Revan
13 Jun 2005, 07:22
Makes no sense that the "returnfloat" shouldn't make it return float :P
Ill fix it for the next version, thanks for letting me know :)

PING1434a
16 Jun 2005, 05:43
yeah! basically, this is what i did:

$level = pow(log10((float)$experience), (float)$exprate);

instead of :

$level = pow(log10($experience), $exprate);

i'm guessing it's just problem with older version of php since no one else seems to be having problem with it -.-;

Thanks for the GREAT hack by the way!

Revan
16 Jun 2005, 09:54
What I did was put floatval() around the entire line, like so:
$level = floatval(pow(log10($experience), $exprate));
Guess it has the same effect ;)
And yeah, I would have to go with old PHP version too. But it's always nice to be backwards compatible ;)

Im glad you enjoy the hack, and I'll be looking forward to having you with us even onto vB 3.5 and the new heights the hack will reach :)


//peace