KyleMassacre Posted January 23, 2012 Share Posted January 23, 2012 Right now everytime my users rank up it ups there max energy and I dont want that to happen. My default is 12 but when they rank up it moves up 2 how can i fix that from happening? Quote Link to comment Share on other sites More sharing options...
mixmaster Posted January 23, 2012 Share Posted January 23, 2012 in global_funcs.php find 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"); } } Replace with 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['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,maxbrave=maxbrave+2, hp=hp+50,maxhp=maxhp+50 where userid=$userid"); } } Quote Link to comment Share on other sites More sharing options...
Cronus Posted January 23, 2012 Share Posted January 23, 2012 (edited) go to your global_func.php and find: function check_level() remove the following lines from that function: $ir['energy']+=2; $ir['maxenergy']+=2; and change this line: $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"); to this line: $db->query("UPDATE users SET level=level+1,exp=$expu,brave=brave+2,,maxbrave=maxbrave+2, hp=hp+50,maxhp=maxhp+50 where userid=$userid"); thats it Edited January 23, 2012 by Cronus whoooops Quote Link to comment Share on other sites More sharing options...
mixmaster Posted January 23, 2012 Share Posted January 23, 2012 go to your global_func.php and find: function check_level() remove the following lines from that function: $ir['energy']+=2; $ir['maxenergy']+=2; thats it Also needs to take it out of the query Quote Link to comment Share on other sites More sharing options...
Cronus Posted January 23, 2012 Share Posted January 23, 2012 Also needs to take it out of the query shoot, ur right lol edited. Quote Link to comment Share on other sites More sharing options...
mixmaster Posted January 23, 2012 Share Posted January 23, 2012 Lol its easy to forget :p Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted January 23, 2012 Author Share Posted January 23, 2012 thanks everyone, looks like I may have posted this in the wrong place what a nub i am Quote Link to comment Share on other sites More sharing options...
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.