Jump to content

stuck with php upgrade on a rpg game


alcapone

Recommended Posts

hello there im looking for any help i can get with this i added this part of the script to my attack script were you will steal the other players guns as well as attack if you win when you attack if not they steal your weapons i have it so they show up when you win bu it dont take the guns away from the other player here is what was added

srand((float)microtime()*100); 
$stolenGlock = 0;$stolenAK47 = 0;$stolenShotgun = 0;$stolenUzi = 0; 
if($your_kills > $his_kills){ 
  $stolenGlock  = round(($pmp[5]/100)*rand(5, 15), 0); 
  $stolenShotgun = round(($pmp[6]/100)*rand(5, 15), 0); 
  $stolenUzi  = round(($pmp[7]/100)*rand(5, 15), 0); 
  $stolenAK47  = round(($pmp[8]/100)*rand(5, 15), 0); 
   
  $query = sprintf("UPDATE %s SET glock=glock+%s, shotgun=shotgun+%s, uzi=uzi+%s, ak47=ak47+%s WHERE id=%s", 
       $tab["pimp"], $stolenGlock, $stolenShotgun, $stolenUzi, $stolenAK47, $id); 
  mysql_query($query); 
$query = sprintf("UPDATE %s SET glock=glock-%s, shotgun=shotgun-%s, uzi=uzi-%s, ak47=ak47-%s WHERE pimp=%s", 
       $tab["pimp"], $stolenGlock, $stolenShotgun, $stolenUzi, $stolenAK47, $pid); 
  mysql_query($query); 
}else{ 
  $stolenGlock  = round(($pimp[16]/100)*rand(5, 15), 0); 
  $stolenShotgun = round(($pimp[17]/100)*rand(5, 15), 0); 
  $stolenUzi  = round(($pimp[18]/100)*rand(5, 15), 0); 
  $stolenAK47  = round(($pimp[19]/100)*rand(5, 15), 0); 
   
  $query = sprintf("UPDATE %s SET glock=glock+%s, shotgun=shotgun+%s, uzi=uzi+%s, ak47=ak47+%s WHERE pimp=%s", 
       $tab["pimp"], $stolenGlock, $stolenShotgun, $stolenUzi, $stolenAK47, $pid); 
  mysql_query($query); 
  $query = sprintf("UPDATE %s SET glock=glock-%s, shotgun=shotgun-%s, uzi=uzi-%s, ak47=ak47-%s WHERE id=%s", 
       $tab["pimp"], $stolenGlock, $stolenShotgun, $stolenUzi, $stolenAK47, $id); 
  mysql_query($query); 
} 
?>  

 

now when you attack some one this is what it will say

 

you killed 1,111 ( 100 thugs 1,011 hitmen 0 bodyguards ) of rocky 's boys in the attack.

your 960 were killed ( 0 thugs 0 hitmen 960 bodyguards )

 

you ganked $ 80 from rocky 's dead thugs.

you also stole 414 AK47s, 502 glocks, 0 shotguns and 0 uzis

 

and it will add the guns to me after the attack but it dont take them away from the player i attack

i beleive the problem is some were in the - part of the code any help would be great


Link to comment
https://forums.phpfreaks.com/topic/50603-stuck-with-php-upgrade-on-a-rpg-game/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.