Jump to content
MakeWebGames

total stats/rank award


WarMad

Recommended Posts

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.");
}
}
Link to comment
Share on other sites

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?"

Link to comment
Share on other sites

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

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