virtualshogun Posted October 15, 2009 Posted October 15, 2009 alright when a user hits level 700 they are shot to level 9500 this is the level check function straight out of the global functions any help would be greatly apprectiated, thanks, function check_level() { global $ir,$c,$userid; if($ir['level'] < 10000) { $ir['exp_needed']=(int) (($ir['level']+1)*($ir['level']+1)*($ir['level']+1)*6.6); while ($ir['exp'] >= $ir['exp_needed'] and $ir['level'] < 9500) { $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)*6.6); mysql_query("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=$userid",$c); } } } ive been at this for several hours and well its giveing me a headache :P Quote
danger boy Posted October 15, 2009 Posted October 15, 2009 Try this function check_level() { global $db; global $ir,$c,$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=$expu,energy=energy+2,brave=brave+2,maxenergy=maxenergy+2,maxbrave=maxbrave+2, hp=hp+50,maxhp=maxhp+50 where userid=$userid"); } } Quote
virtualshogun Posted October 15, 2009 Author Posted October 15, 2009 intresting effect now every page refresh i go up a level and the exp is all kinds of bounceing, it goes positive and then negative then positive :cursing: Quote
fbiss Posted October 15, 2009 Posted October 15, 2009 I believe your issue is with the (int) Your $ir['exp_needed'] is calculating out to more then 2147483647 which is small ints limit Quote
virtualshogun Posted October 15, 2009 Author Posted October 15, 2009 i know its been set to bigint in the cpanel but code wise how do i fix that ? (bigint) ? something like $ir['exp_needed'] = (bigint) (($ir['level']+1)*$ir['level']+1)*($ir['level']+1)*6.6); Quote
AlabamaHit Posted October 16, 2009 Posted October 16, 2009 You probarly need to go into control panel and set your exp to '0'. Quote
virtualshogun Posted October 16, 2009 Author Posted October 16, 2009 did that the only thing that seems to work is $ir['exp_needed'] = (int) (($ir['level']+1)*$ir['level']+1)*($ir['level']+1)*6.6 /10); i reset the exp to 0 and the level back to 700 and this is working odd enough im thinking that it changed the large number that the code wouldnt accept into something it would, thoughts comments, but its allowing past the 700 mark and its gaining exp like normal i just cant explain it, Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.