WarMad Posted December 27, 2013 Posted December 27, 2013 i have been trying to make a total stats award and cant get it to work can anyone help this is what i tried to use $tp=($level*$level) * 3000 + ($housevalue) + (($stats['strength']+$stats['speed']+$stats['defense']+$stats['endurance']+$stats['labour']+$stats['dexterity']+$stats['IQ']) * 10); if($tp < 25600000 ) { $gh=$db->query("SELECT * FROM merits WHERE userid=$userid AND list='rookie'"); if($db->num_rows($gh)) { echo ""; } else { $db->query("INSERT INTO merits values ($userid,'rookie')"); $db->query("UPDATE users SET merits=merits+1 WHERE userid=$userid"); event_add($ir['userid'], "You have just received a merit for becoming a Rookie."); } } Quote
Seker Posted December 27, 2013 Posted December 27, 2013 i have been trying to make a total stats award and cant get it to work can anyone help this is what i tried to use $tp=($level*$level) * 3000 + ($housevalue) + (($stats['strength']+$stats['speed']+$stats['defense']+$stats['endurance']+$stats['labour']+$stats['dexterity']+$stats['IQ']) * 10); if($tp < 25600000 ) { $gh=$db->query("SELECT * FROM merits WHERE userid=$userid AND list='rookie'"); if($db->num_rows($gh)) { echo ""; } else { $db->query("INSERT INTO merits values ($userid,'rookie')"); $db->query("UPDATE users SET merits=merits+1 WHERE userid=$userid"); event_add($ir['userid'], "You have just received a merit for becoming a Rookie."); } } Perhaps think about defining "not working?" Quote
WarMad Posted December 27, 2013 Author Posted December 27, 2013 it just updates it right away does not wait for you to reach the total stats Quote
KyleMassacre Posted December 27, 2013 Posted December 27, 2013 look at line 2: It reads if 25600000 is greater than $tp then the condition is met. I think you want it to be: if 25600000 is LESS than $tp then the condition is met. Also, no need for a blank echo you can probably just use return; , exit(); , or $h->endpage();. One of those should do Quote
Lithium Posted December 27, 2013 Posted December 27, 2013 look at line 2: It reads if 25600000 is greater than $tp then the condition is met. I think you want it to be: if 25600000 is LESS than $tp then the condition is met. Also, no need for a blank echo you can probably just use return; , exit(); , or $h->endpage();. One of those should do Or even better... define an "interval" for the merit award something along the lines of ... if (($tp > minvalueformerit) && ($tp < maxvalueformerit)) Quote
KyleMassacre Posted December 27, 2013 Posted December 27, 2013 what kyle said fixed it thanks Actually what Lithium said may be better if you want to add additional merits. But to do that I would rig up a switch statement for it maybe 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.