alcapone Posted May 9, 2007 Share Posted May 9, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/50603-stuck-with-php-upgrade-on-a-rpg-game/ Share on other sites More sharing options...
btherl Posted May 9, 2007 Share Posted May 9, 2007 Use this in place of all your queries: mysql_query($query) or die("Query failed: $query\n" . mysql_error()); That will tell you if any queries fail (probably for syntax reasons). Quote Link to comment https://forums.phpfreaks.com/topic/50603-stuck-with-php-upgrade-on-a-rpg-game/#findComment-248810 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.