Jump to content

Help


RSC-

Recommended Posts

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?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.