Jump to content

RSC-

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Posts posted by RSC-

  1. I am currently trying to make a database game/ textbased game/ mmporpg/ or what ever you want to call it. I am trying to add "covert" weapons.

    In the vsys I have:

    function RepairWeapon($wepid,$wal,$user,$type)
    {
    global $conf;
    if($type)$tp='weapon';
    else $tp='defenseweapon';
    $q = @mysql_query("select weaponCount,weaponStrength from `Weapon` where weaponID='$wepid' and userID='$user->ID' and isAtack='$type' ");
    $el=mysql_fetch_array($q, MYSQL_ASSOC);
    if($conf["race"][$user->race][$tp][$wepid]["strength"]!=0)
    $pris=round(700/$conf["race"][$user->race][$tp][$wepid]["strength"])*$wal*$el["weaponCount"];
    else return;
    if($pris <= ($user->gold)){
    if(($wal+$el["weaponStrength"]) <= $conf["race"][$user->race][$tp][$wepid]["strength"]){
    $q = @mysql_query("update `Weapon` set weaponStrength=weaponStrength+'$wal' where weaponID='$wepid' and userID='$user->ID' and isAtack='$type' ");
    $q = @mysql_query("update `UserDetails` set gold=gold-'$pris' where ID='$user->ID' ");}}
    else return 'NO GOLD LEFT!!!';
    }

    function ScrapSell($wepid,$wal,$a,$user,$type)
    {
    global $conf;
    if($type)$tp='weapon';
    else $tp='defenseweapon';
    else $tp='covert';
    $q = @mysql_query("select weaponCount,weaponStrength from `Weapon` where weaponID='$wepid' and userID='$user->ID' and isAtack='$type' ");
    $el=mysql_fetch_array($q, MYSQL_ASSOC);
    if($conf["race"][$user->race][$tp][$wepid]["strength"]!=0)
    {$pris=round($conf["race"][$user->race][$tp][$wepid]["price"]*($el["weaponStrength"]/$conf["race"][$user->race][$tp][$wepid]["strength"]-0.2))*$wal;}
    else return;
    if($wal<$el["weaponCount"]){
    $q = @mysql_query("update `Weapon` set weaponCount=weaponCount-'$wal' where weaponID='$wepid' and userID='$user->ID' and isAtack='$type' ");
    if($a!='Scrap'){$q = @mysql_query("update `UserDetails` set gold=gold+'$pris' where ID='$user->ID' ");}}
    if($wal==$el["weaponCount"]){
    $q = @mysql_query("delete from `Weapon` where weaponID='$wepid' and userID='$user->ID' and isAtack='$type' ");
    if($a!='Scrap'){$q = @mysql_query("update `UserDetails` set gold=gold+'$pris' where ID='$user->ID' ");}}
    }

    function BuyWeapon($wepid,$wal,$at,$user)
    {
    global $conf;
    if($at)$tp='weapon';
    else $tp='defenseweapon';
    else $tp='covert';
    $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!!!';



    Is there anything wrong with that? and also what else should I put?
×
×
  • 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.