Ok this is for a little game i want to make for a few friends.
I want this "CRIME" script to commit a crime in the game. this should gain the player exp points. depending on their rank is how exp points are turned into % (complesion of their rank). This is how the % is worked out.
PHP Code:
if ($stat["level"] == "Tramp") { $percent=$stat[exp]/10; } if ($stat["level"] == "Chav") { $percent=$stat[exp]/20; } if ($stat["level"] == "Dealer") { $percent=$stat[exp]/50; } if ($stat["level"] == "Convict") { $percent=$stat[exp]/60; } if ($stat["level"] == "Rookie") { $percent=$stat[exp]/80; } if ($stat["level"] == "Thug") { $percent=$stat[exp]/110; } if ($stat["level"] == "Gangsta") { $percent=$stat[exp]/150; } if ($stat["level"] == "Bodyguard") { $percent=$stat[exp]/180; } if ($stat["level"] == "Agent") { $percent=$stat[exp]/200; } if ($stat["level"] == "Associate") { $percent=$stat[exp]/230; } if ($stat["level"] == "Capo") { $percent=$stat[exp]/270; } if ($stat["level"] == "Underboss") { $percent=$stat[exp]/280; } if ($stat["level"] == "Global Threat") { $percent=$stat[exp]/310; } if ($stat["level"] == "Untouchable") { $percent=$stat[exp]/350; } if ($stat["level"] == "Legendary Assassin") { $percent=$stat[exp]/390; } if ($stat["level"] == "National Legend") { $percent=$stat[exp]/420; } if ($stat["level"] == "Worldwide SL Legend") { $percent=$stat[exp]/450; }
This is the scipt i am having prolems with.
My rank is "Chav" i want to rank up to the next rank. by doigna crime i should gain exp therefore gain % but i dont. It is just ranking me to the top rank.
Any idea why?
This is the Script.
PHP Code:
<?php include "header.php"; ?> <center> <table border="0" cellpadding="0" cellspacing="0" align="center"> <tr> <td colspan="5"><div align="center" class="gradient"><strong>Commit a Crime </strong> </div> <div align="left"></div></td> </tr> <tr bordercolor="#000000" bgcolor="#000000"> <td width="101" height="153" valign="top" cellpadding="2"><div align="left"> <p align="center"> <img src="Images/sellweapons.jpg" width="100" height="100" hspace="0" vspace="0" align="top"> <a href="crime.php?view=crime4">Burgle a Mansion</a> </p> </div></td> <td width="100" valign="top" cellpadding="2"><div align="center"> <p><img src="Images/robbank.jpg" width="100" height="100" hspace="0" vspace="0" align="top"> <a href="crime.php?view=crime3">Burgle a House</a> </p> </div></td> <td width="100" valign="top" cellpadding="2"><div align="center"> <p><img src="Images/hijack.jpg" width="100" height="100" hspace="0" vspace="0" align="top"> <a href="crime.php?view=crime2">Burgle a Bungalow</a></p> </div></td> <td width="100" height="153" valign="top" cellpadding="2"><div align="center"> <p><img src="Images/streetfight.jpg" width="100" height="100" hspace="0" vspace="0" align="top"> <a href="crime.php?view=crime1">Burgle a Flat</a></p> </div></td> </tr> </table> </center> <?php if ($_GET["view"] == "crime1") { $chance1 = rand(1,2); if ($chance1 == 1) { $mgain= rand(1,1500); $mmgain=$mgain+$stat[money]; $xpgain = rand(1,20); $expgain = $xpgain+$stat[exp]; print "You sucessfully burgled a house! You got away with $<B>".$mgain."</B>!"; mysql_query("update `players` set `money`='".$mmgain."' where `id`=".$stat[id]." "); mysql_query("update `players` set `exp`='".$expgain."' where `id`=".$stat[id]." "); if ($percent > 99.9 || $stat[level] = "Tramp") { mysql_query(" update `players` set `level`='Chav' where `id`='$stat[id]' "); mysql_query(" update `players` set `exp`='0' where `id`='$stat[id]' "); } if ($percent > 99.9 || $stat[level] = "Chav") { mysql_query(" update `players` set `level`='Dealer' where `id`='$stat[id]' "); mysql_query(" update `players` set `exp`='0' where `id`='$stat[id]' "); } if ($percent > 99.9 || $stat[level] = "Dealer") { mysql_query(" update `players` set `level`='Convict' where `id`='$stat[id]' "); mysql_query(" update `players` set `exp`='0' where `id`='$stat[id]' "); } if ($percent > 99.9 || $stat[level] = "Convict") { mysql_query(" update `players` set `level`='Rookie' where `id`='$stat[id]' "); mysql_query(" update `players` set `exp`='0' where `id`='$stat[id]' "); } if ($percent > 99.9 || $stat[level] = "Rookie") { mysql_query(" update `players` set `level`='Thug' where `id`='$stat[id]' "); mysql_query(" update `players` set `exp`='0' where `id`='$stat[id]' "); } if ($percent > 99.9 || $stat[level] = "Thug") { mysql_query(" update `players` set `level`='Gangster' where `id`='$stat[id]' "); mysql_query(" update `players` set `exp`='0' where `id`='$stat[id]' "); } if ($percent > 99.9 || $stat[level] = "Gangster") { mysql_query(" update `players` set `level`='Bodyguard' where `id`='$stat[id]' "); mysql_query(" update `players` set `exp`='0' where `id`='$stat[id]' "); } if ($percent > 99.9 || $stat[level] = "Bodyguard") { mysql_query(" update `players` set `level`='Agent' where `id`='$stat[id]' "); mysql_query(" update `players` set `exp`='0' where `id`='$stat[id]' "); } if ($percent > 99.9 || $stat[level] = "Agent") { mysql_query(" update `players` set `level`='Associate' where `id`='$stat[id]' "); mysql_query(" update `players` set `exp`='0' where `id`='$stat[id]' "); } if ($percent > 99.9 || $stat[level] = "Associate") { mysql_query(" update `players` set `level`='Capo' where `id`='$stat[id]' "); mysql_query(" update `players` set `exp`='0' where `id`='$stat[id]' "); } if ($percent > 99.9 || $stat[level] = "Capo") { mysql_query(" update `players` set `level`='Underboss' where `id`='$stat[id]' "); mysql_query(" update `players` set `exp`='0' where `id`='$stat[id]' "); } if ($percent > 99.9 || $stat[level] = "Global Threat") { mysql_query(" update `players` set `level`='Untouchable' where `id`='$stat[id]' "); mysql_query(" update `players` set `exp`='0' where `id`='$stat[id]' "); } if ($percent > 99.9 || $stat[level] = "Untouchable") { mysql_query(" update `players` set `level`='Legendary Assassin' where `id`='$stat[id]' "); mysql_query(" update `players` set `exp`='0' where `id`='$stat[id]' "); } if ($percent > 99.9 || $stat[level] = "Legendary Assassin") { mysql_query(" update `players` set `level`='National Legend' where `id`='$stat[id]' "); mysql_query(" update `players` set `exp`='0' where `id`='$stat[id]' "); } if ($percent > 99.9 || $stat[level] = "National Legend") { mysql_query(" update `players` set `level`='Worldwide SL legend' where `id`='$stat[id]' "); mysql_query(" update `players` set `exp`='0' where `id`='$stat[id]' "); } } else print "You failed and walked home empty handed!"; mysql_query("update `players` set `exp`='".$expgain."' where `id`=".$stat[id]." "); if ($percent > 99.9 || $stat[level] = "Tramp") { mysql_query(" update `players` set `level`='Chav' where `id`='$stat[id]' "); mysql_query(" update `players` set `exp`='0' where `id`='$stat[id]' "); } if ($percent > 99.9 || $stat[level] = "Chav") { mysql_query(" update `players` set `level`='Dealer' where `id`='$stat[id]' "); mysql_query(" update `players` set `exp`='0' where `id`='$stat[id]' "); } if ($percent > 99.9 || $stat[level] = "Dealer") { mysql_query(" update `players` set `level`='Convict' where `id`='$stat[id]' "); mysql_query(" update `players` set `exp`='0' where `id`='$stat[id]' "); } if ($percent > 99.9 || $stat[level] = "Convict") { mysql_query(" update `players` set `level`='Rookie' where `id`='$stat[id]' "); mysql_query(" update `players` set `exp`='0' where `id`='$stat[id]' "); } if ($percent > 99.9 || $stat[level] = "Rookie") { mysql_query(" update `players` set `level`='Thug' where `id`='$stat[id]' "); mysql_query(" update `players` set `exp`='0' where `id`='$stat[id]' "); } if ($percent > 99.9 || $stat[level] = "Thug") { mysql_query(" update `players` set `level`='Gangster' where `id`='$stat[id]' "); mysql_query(" update `players` set `exp`='0' where `id`='$stat[id]' "); } if ($percent > 99.9 || $stat[level] = "Gangster") { mysql_query(" update `players` set `level`='Bodyguard' where `id`='$stat[id]' "); mysql_query(" update `players` set `exp`='0' where `id`='$stat[id]' "); } if ($percent > 99.9 || $stat[level] = "Bodyguard") { mysql_query(" update `players` set `level`='Agent' where `id`='$stat[id]' "); mysql_query(" update `players` set `exp`='0' where `id`='$stat[id]' "); } if ($percent > 99.9 || $stat[level] = "Agent") { mysql_query(" update `players` set `level`='Associate' where `id`='$stat[id]' "); mysql_query(" update `players` set `exp`='0' where `id`='$stat[id]' "); } if ($percent > 99.9 || $stat[level] = "Associate") { mysql_query(" update `players` set `level`='Capo' where `id`='$stat[id]' "); mysql_query(" update `players` set `exp`='0' where `id`='$stat[id]' "); } if ($percent > 99.9 || $stat[level] = "Capo") { mysql_query(" update `players` set `level`='Underboss' where `id`='$stat[id]' "); mysql_query(" update `players` set `exp`='0' where `id`='$stat[id]' "); } if ($percent > 99.9 || $stat[level] = "Global Threat") { mysql_query(" update `players` set `level`='Untouchable' where `id`='$stat[id]' "); mysql_query(" update `players` set `exp`='0' where `id`='$stat[id]' "); } if ($percent > 99.9 || $stat[level] = "Untouchable") { mysql_query(" update `players` set `level`='Legendary Assassin' where `id`='$stat[id]' "); mysql_query(" update `players` set `exp`='0' where `id`='$stat[id]' "); } if ($percent > 99.9 || $stat[level] = "Legendary Assassin") { mysql_query(" update `players` set `level`='National Legend' where `id`='$stat[id]' "); mysql_query(" update `players` set `exp`='0' where `id`='$stat[id]' "); } if ($percent > 99.9 || $stat[level] = "National Legend") { mysql_query(" update `players` set `level`='Worldwide SL legend' where `id`='$stat[id]' "); mysql_query(" update `players` set `exp`='0' where `id`='$stat[id]' "); }
} ?> <?php include "footer.php"; ?>
Please help as i am very confused!
LoL
Thanks in advance!
Ash~
|