Public feed #601923

Stuff

public php v1 · immutable
Raw Edit
·published 2007-07-03 20:08 UTC
rendered paste body
function BuyWeapon($wepid,$wal,$at,$user)      {      global $conf;              if($at == 0) { $tp='weapon'; }              elseif($at == 1) { $tp='defenseweapon'; }              elseif($at == 2) { $tp='spyweapon'; }              elseif($at == 3) { $tp='sentryweapon'; }              $wal = strval($wal);              $pris=$conf["race"][$user->race][$tp][$wepid]["price"]*$wal;              $stren=$conf["race"][$user->race][$tp][$wepid]["strength"];              if($pris <= ($user->gold)){              $q = @mysql_query("select weaponCount from `Weapon` where weaponID='$wepid' and userID='$user->ID' and isAtack='$at' ");              if (@mysql_num_rows($q)){                      $q = @mysql_query("update `Weapon` set weaponCount=weaponCount+'$wal' where weaponID='$wepid' and userID='$user->ID' and isAtack='$at' ");                      $q = @mysql_query("update `UserDetails` set gold=gold-'$pris' where ID='$user->ID' ");}              else{                      $q = @mysql_query("insert into `Weapon` (weaponID, weaponStrength, weaponCount, isAtack, userID) values ('$wepid', '$stren', '$wal', '$at', '$user->ID')");                      $q = @mysql_query("update `UserDetails` set gold=gold-'$pris' where ID='$user->ID' ");}}      else return 'NO GOLD LEFT!!!';      }