Jump to content
MakeWebGames

EXP stays / sticks at 17 ??,. PLEASE HELP !!


snaketooth22

Recommended Posts

Yeah that would be it, is that the whole of the function.. The standard one is something like:

function check_level() {
global $db, $ir, $userid;
$ir['exp_needed']=(int) (($ir['level']+1)*($ir['level']+1)*($ir['level']+1)*2.2);
if($ir['exp'] >= $ir['exp_needed']) {
	$expu = ($ir['exp']-$ir['exp_needed']);
	$ir['level']+=1;
	$ir['exp'] = $expu;
	$ir['energy']+=2;
	$ir['brave']+=2;
	$ir['maxenergy']+=2;
	$ir['maxbrave']+=2;
	$ir['hp']+=50;
	$ir['maxhp']+=50;
	$ir['exp_needed']=(int) (($ir['level']+1)*($ir['level']+1)*($ir['level']+1)*2.2);
	$db->query('UPDATE `users` SET `level`=level+1, `exp`='.abs(intval($expu)).', `energy`=energy+2, `brave`=brave+2, `maxenergy`=maxenergy+2, `maxbrave`=maxbrave+2, `hp`=hp+50, `maxhp`=maxhp+50 WHERE (`userid`='.$userid.')');
}
}
Edited by Maniak
Link to comment
Share on other sites

QUERY ERROR: Unknown column '$expu' in 'field list'

Query was UPDATE `users` SET `level`=level+1, `exp`=$expu, `energy`=energy+2, `brave`=brave+2, `maxenergy`=maxenergy+2, `maxbrave`=maxbrave+2, `hp`=hp+50, `maxhp`=maxhp+50 WHERE (`userid`=2)

I now get this error if i enter that script

Link to comment
Share on other sites

I had to read that a couple of times, but it would appear that given $expu is computed as

$expu = ($ir['exp']-$ir['exp_needed']);

then the need for abs(intval(...)) is pointless.

The error message:

QUERY ERROR: Unknown column '$expu' in 'field list'

seems self explanatory to me - and even suggests exactly what the problem is. Wrapping $expu with abs(intval(..)) will, in all expectations, yield the same error.

A decent syntax highlighting editor should pick this up. ie: check your quotes.

Edited by Anonymous
Link to comment
Share on other sites

i am sure its simpler than all that,check your crimes on how you made it act on success, somewhere you fucked up your logic when creating the crimes and doing the formula for gaining experience.

If you saw in one of his firsts posts where he posted the lines for his function that is checking the level, there was nothing in there to update a player. So it had to do with the function, now he is having a little error after adding in what someone gave him.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...