Jump to content
MakeWebGames

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


Recommended Posts

Posted

I've created a list of crimes,. and when ive tested them on a demo user,. the EXP goes up to 17 then wont go no further,. does anybody know how i would be able to solve this ??,. ive tried doing the crimes 20 times over and the EXP just wont go up no further,...

Posted (edited)

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
Posted

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

Posted (edited)

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
Posted

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.

Posted
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.

Posted

it was going on until i got to 17EXP,. then it didnt work,. and nothing was changed to the coding in that time,.. can anyone give any instructions to carry out and ill see if it solves the problem.,. I appreciate the help so far :)

Posted

We stated to you, it's the check level function. It's pretty simple and straight forward, the function checks your experience to see where you are at and then if you are above it will advance you up a level.

PS: 17exp is the default max exp you can get for level 1.

Posted

i am using a level 1,. and also i do not have an exp_needed query in my database ,.. should i insert 1,. ??,. and wat should its features include,. can someone send me the injection code if there is one ??

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...