
bmw11
Members-
Posts
88 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Everything posted by bmw11
-
If you need me , just PM me :)
-
YEP looks Great m8 , i would also like to see this on the internet , have you linked it to a website yet .
-
yup i rememba u , yes he does have re sell permission
-
Parse error: syntax error, unexpected T_STRING in /home/husain/public_html/itemmarket.php on line 157
-
<?php /* itemmarket.php by Lithium MODIFIED BY CURT distribution/selling/sharing of this file is illegal without permission. */ include "globals.php"; echo'<div class="gray-block"> <div class="heading">Item Market</div>'; function quote_smart($value) { if (get_magic_quotes_gpc()) { $value = stripslashes($value); } if (!is_numeric($value)) { $value = "'" . mysql_real_escape_string($value) . "'"; } return $value; } function item_mremove() { global $ir,$c,$userid,$h; $q = mysql_query("SELECT im.*,i.* FROM `itemmarket` `im` LEFT JOIN `items` `i` ON `im`.`imITEM` = `i`.`itmid` WHERE `imID` = '{$_GET['ID']}' AND `imADDER` = $userid"); if(!mysql_num_rows($q)) { ?> Error, either this item does not exist, or you are not the owner. <a href="http://itemmarket.php" target="_blank">Go Back</a> <? $h->endpage(); exit; } $r = mysql_fetch_array($q); if ($r['imQTY']>1) { if (isset($_POST['rqty'])) { $_POST['rqty']=abs((int)$_POST['rqty']); if ($r['imQTY']<$_POST['rqty']) { ?> Error, you do not have this many to remove!. <a href="http://itemmarket.php" target="_blank">Go Back</a> <? $h->endpage(); exit; } else { mysql_query("UPDATE `itemmarket` SET `imQTY`=`imQTY`-{$_POST['rqty']} WHERE `imID`={$_GET['ID']} AND `imADDER`={$ir['userid']}",$c); mysql_query("DELETE FROM `itemmarket` WHERE `imQTY`=0",$c); item_add($userid, $r['itmid'], $_POST['rqty']); ?> Item's Removed from Market! <a href="http://itemmarket.php" target="_blank">Go Back</a> <? } } else { ?> How many <?=$r['itmname']?>'s would you like to remove ? <form action='' method='POST'><input type='hidden' name='imID' value=<?=$r['imID']?> > Quanity: <input type='text' size=4 name='rqty' value=<?=$r['imQTY']?>> <input type='submit' value='Remove Items'></form> <? } } else { item_add($userid, $r['imITEM'], 1); mysql_query("DELETE FROM `itemmarket` WHERE `imID`={$_GET['ID']}",$c); mysql_query("INSERT INTO `imremovelogs` VALUES ('', {$r['imITEM']}, {$r['imADDER']}, $userid, {$r['imID']}, $i, unix_timestamp(), '{$ir['username']} removed a {$r['itmname']} from the item market.')", $c); ?> Item removed from market! <a href="http://itemmarket.php" target="_blank">Go Back</a> <? } } function item_buy() { global $ir,$c,$userid,$h; $q = mysql_query("SELECT * FROM `itemmarket` `im` LEFT JOIN `items` `i` ON `i`.`itmid` = `im`.`imITEM` WHERE `imID` = {$_GET['ID']}"); if(!mysql_num_rows($q)) { ?> Error, either this item does not exist, or it has already been bought. <a href="http://itemmarket.php" target="_blank">Go Back</a> <? $h->endpage(); exit; } $r = mysql_fetch_array($q); if ($r['imQTY']>1) { if (isset($_POST['buyqty'])) { $_POST['buyqty']=abs((int)$_POST['buyqty']); $_POST['imID']=abs((int)$_POST['imID']); $PRICE=$r['imPRICE']*$_POST['buyqty']; $POINTS=$r['imPOINTS']*$_POST['buyqty']; if($r['imQTY'] < $_POST['buyqty']) { ?> Error, you have selected more items than there really is. <a href="http://itemmarket.php" target="_blank">Go Back</a> <? $h->endpage(); exit; } if($PRICE > $ir['money']) { ?> Error, you do not have the funds to buy this item. <a href="http://itemmarket.php" target="_blank">Go Back</a> <? $h->endpage(); exit; } if($POINTS > $ir['crystals']) { ?> Error, you do not have the funds to buy this item. <a href="http://itemmarket.php" target="_blank">Go Back</a> <? $h->endpage(); exit; } $i=0; item_add($userid, $r['imITEM'], $_POST['buyqty']); mysql_query("UPDATE itemmarket SET imQTY=imQTY-{$_POST['buyqty']} WHERE imID={$_GET['ID']}",$c); mysql_query("DELETE FROM itemmarket WHERE imQTY=0",$c); mysql_query("UPDATE users SET money=money-$PRICE, crystals=crystals-$POINTS WHERE userid=$userid",$c); mysql_query("UPDATE users SET money=money+$PRICE, crystals=crystals+$POINTS WHERE userid={$r['imADDER']}",$c); event_add($r['imADDER'],"<a href="http://viewuser.php?u=$userid" target="_blank">{$ir['username']}</a> bought [x{$_POST['buyqty']}] {$r['itmname']}'s from the market for \$".number_format($PRICE)." and $POINTS Points!.",$c); mysql_query("INSERT INTO imbuylogs VALUES ('', {$r['imITEM']}, {$r['imADDER']}, $userid, {$r['imPRICE']}, {$r['imID']}, $i, unix_timestamp(), '{$ir['username']} bought a {$r['itmname']} from the item market for \$$PRICE and $POINTS Points from user ID {$r['imADDER']}')", $c); ?> You bought [x<?=$_POST['buyqty']?>] <?=$r['itmname']?>'s from the market for $<?=number_format($PRICE)?> and <?=$POINTS?> Points!. <a href="http://itemmarket.php" target="_blank">Go Back</a> <? $h->endpage(); exit; } else { ?> How many <?=$r['itmname']?>'s do you want to buy ? There is [x<?=$r['imQTY']?>] available. They cost $<?=number_format($r['imPRICE'])?> and <?=$r['imPOINTS']?> Points Each! <form action='' method='POST'><input type='hidden' name='imID' value=<?=$r['imID']?>> How Many ? <input type='text' size=4 name='buyqty' value='0'> <input type='submit' value='Buy Items'></form> <? } } else { if($r['imPRICE'] > $ir['money']) { ?> Error, you do not have the funds to buy this item. <a href="http://itemmarket.php" target="_blank">Go Back</a> <? $h->endpage(); exit; } if($r['imPOINTS'] > $ir['crystals']) { ?> Error, you do not have the funds to buy this item. <a href="http://itemmarket.php" target="_blank">Go Back</a> <? $h->endpage(); exit; } mysql_query("INSERT INTO inventory VALUES('',{$r['imITEM']},$userid,1)",$c) or die(mysql_error()); $i=mysql_insert_id($c); mysql_query("DELETE FROM itemmarket WHERE imID={$_GET['ID']}",$c); mysql_query("UPDATE users SET money=money-{$r['imPRICE']} where userid=$userid",$c); mysql_query("UPDATE users SET money=money+{$r['imPRICE']} where userid={$r['imADDER']}",$c); event_add($r['imADDER'],"<a href="http://viewuser.php?u=$userid" target="_blank">{$ir['username']}</a> bought your {$r['itmname']} item from the market for \$".number_format($r['imPRICE']).".",$c); mysql_query("INSERT INTO imbuylogs VALUES ('', {$r['imITEM']}, {$r['imADDER']}, $userid, {$r['imPRICE']}, {$r['imID']}, $i, unix_timestamp(), '{$ir['username']} bought a {$r['itmname']} from the item market for \${$r['imPRICE']} from user ID {$r['imADDER']}')", $c); ?> You bought the <?=$r['itmname']?> from the market for $<?=number_format($r['imPRICE'])?>. <a href="http://itemmarket.php" target="_blank">Go Back</a> <? $h->endpage(); exit; } } function item_gift1() { global $ir,$c,$userid,$h; $q=mysql_query("SELECT * FROM itemmarket im LEFT JOIN items i ON i.itmid=im.imITEM WHERE imID={$_GET['ID']}",$c); if(!mysql_num_rows($q)) { ?> Error, either this item does not exist, or it has already been bought. <a href="http://itemmarket.php" target="_blank">Go Back</a> <? $h->endpage(); exit; } $r=mysql_fetch_array($q); if($r['imPRICE'] > $ir['money']) { ?> You do not have the funds to buy this item. <a href="http://itemmarket.php" target="_blank">Go Back</a> <? $h->endpage(); exit; } ?> Buying [x<?=$r['imQTY']?>] <b><?=$r['itmname']?>'s</b> for $<?=number_format($r['imPRICE'])?> and <?=$r['imPOINTS']?> Points each as a gift for... <form action="itemmarket.php?action=gift2" method="post"> <input type="hidden" name="ID" value="<?=$_GET['ID']?>" /> User to give gift to: <?=user_dropdown($c,'user')?> How many to buy ? <input type='text' size=4 name='giftqty' value=0> <input type="submit" value="Buy Item and Send Gift" /> </form> <? } function item_gift2() { global $ir,$c,$userid,$h; $_POST['giftqty']=abs((int)$_POST['giftqty']); $q=mysql_query("SELECT * FROM itemmarket im LEFT JOIN items i ON i.itmid=im.imITEM WHERE imID={$_POST['ID']}",$c); if(!mysql_num_rows($q)) { ?> Error, either this item does not exist, or it has already been bought. <a href="http://itemmarket.php" target="_blank">> Back</a> <? $h->endpage(); exit; } $qqq=mysql_query("SELECT username FROM users WHERE userid={$_POST['user']}",$c); if(!mysql_num_rows($qqq)) { ?> Error, this person does not exist. <a href="http://itemmarket.php" target="_blank">> Back</a> <? $h->endpage(); exit; } $r=mysql_fetch_array($q); $MONEY=$r['imPRICE']*$_POST['giftqty']; $POINTS=$r['imPOINTS']*$_POST['giftqty']; $_POST['user']=abs((int)$_POST['user']); if($r['imQTY'] < $_POST['giftqty']) { ?> Error, you have selected more items than there is! <a href="http://itemmarket.php" target="_blank">Go Back</a> <? $h->endpage(); exit; } if($MONEY > $ir['money']) { ?> Error, you do not have the funds to buy this item. <a href="http://itemmarket.php" target="_blank">Go Back</a> <? $h->endpage(); exit; } if($POINTS > $ir['crystals']) { ?> Error, you do not have the funds to buy this item. <a href="http://itemmarket.php" target="_blank">Go Back</a> <? $h->endpage(); exit; } item_add($_POST['user'], $r['imITEM'], $_POST['giftqty']); mysql_query("UPDATE itemmarket SET imQTY=imQTY-{$_POST['giftqty']} WHERE imID={$_GET['ID']}",$c); mysql_query("DELETE FROM itemmarket WHERE imQTY=0",$c); mysql_query("UPDATE users SET money=money-$MONEY, crystals=crystals-$POINTS where userid=$userid",$c); mysql_query("UPDATE users SET money=money+$MONEY, crystals=crystals-$POINTS where userid={$r['imADDER']}",$c); event_add($r['imADDER'],"<a href="http://viewuser.php?u=$userid" target="_blank">{$ir['username']}</a> bought [x{$_POST['giftqty']}] {$r['itmname']}'s from the market for \$".number_format($MONEY)." and $POINTS Points.",$c); event_add($_POST['user'], "<a href="http://viewuser.php?u=$userid" target="_blank">{$ir['username']}</a> bought you [x{$_POST['giftqty']}] {$r['itmname']}'s from the item market as a gift.",$c); $u=mysql_query("SELECT * FROM users WHERE userid={$_POST['user']}",$c); $uname=mysql_result($u,0,1); mysql_query("INSERT INTO imbuylogs VALUES ('', {$r['imITEM']}, {$r['imADDER']}, $userid, {$r['imPRICE']}, {$r['imID']}, $i, unix_timestamp(), '{$ir['username']} bought a {$r['itmname']} from the item market for \$$MONEY and $POINTS Points from user ID {$r['imADDER']} as a gift for $uname [{$_POST['user']}]')", $c); ?> You bought [x<?=$_POST['giftqty']?>] <?=$r['itmname']?>'s from the market for $<?=number_format($MONEY)?> and <?=$POINTS?> Points and sent the gift to <?=$uname?>! <? } /* check which items are valid to use edit $invalid_ids to suit your needs each array placed here won't be listed (category ID on db) */ $invalid_ids = array('8','9','10','999','1000'); $q = "SELECT itmtypeid,itmtypename FROM itemtypes"; $q1 = "SELECT DISTINCT im.imITEM , i.itmid, i.itmtype,i.itmname FROM items i LEFT JOIN itemmarket im ON i.itmid=im.imITEM"; if(is_array($invalid_ids) && !empty($invalid_ids)) { $q.=" WHERE itmtypeid NOT IN ("; $q1.=" WHERE i.itmid=im.imITEM AND i.itmtype NOT IN ("; $count = count($invalid_ids); for($i=0; $i< $count;$i++) { $i_v .= "'".$invalid_ids[$i]."'"; if($i < $count-1) $i_v .= ","; } $q.= $i_v.")"; $q1.= $i_v.")"; } $q.= " ORDER BY itmtypeid"; $q1.= " ORDER BY i.itmtype"; $x = mysql_query($q,$c); while($xx = mysql_fetch_array($x)) { $title_item[$xx['itmtypeid']] = $xx['itmtypename']; $a[$xx['itmtypeid']][] = array(); } $x = mysql_query($q1,$c); while($xx = mysql_fetch_array($x)) { $a[$xx['itmtype']][] = $xx; } ?> <table width="100%" class="inner"> <tr class="fill"> <td colspan=3 class="inner">Item Market <form id="form" name="form" method="post" action="<?=$_SERVER['PHP_SELF']?>"></td> </tr> <tr> <td colspan=3 class="inner"> Select the item type you want to buy from the dropdown boxes. If there is any item fro sale it will show you the links to it.</td> </tr> <tr> <td> <? $i=0; foreach ($a as $key => $value) { $xx = $value; $i++; ?> <table width="100%" class="inner"> <tr class="fill"> <td class="inner"><?=$title_item[$key]?></td> </tr> <tr> <td class="inner"> <select name="s_<?=$key?>" id="s_<?=$key?>"> <option value="0"></option> <option value="-1">Check All</option> <? if(is_array($xx)){ foreach($xx as $x) { if(!empty($x)) { ?> <option value="<?=$x['itmid']?>"> <? echo $x['itmname'];?> </option> <?} } }?> </select> </td> </tr> </table> <? if( $i > 0 && $i < 3) { ?> </td> <td> <? } else { $i = 0; ?> <tr> <td> <? } } for($j=$i;$j > 0; $j--) { ?> </td><td> <? } ?> </td> </tr> <tr class="fill"> <td colspan=3 class="inner"> <input type="submit" name="search" id="search" value="Search" /> </td> </tr> </table> </form> <? switch($_GET['action']) { case "buy": item_buy(); break; case "gift1": item_gift1(); break; case "gift2": item_gift2(); break; case "remove": item_mremove(); break; } if(isset($_POST) && isset($_POST['search'])) { foreach($_POST as $key => $value) { if(preg_match("/^s_(\d*)$/", $key, $match)) { if($value == -1) { $a_it[]= quote_smart($match[1]); } else if($value != 0 && $value != -1) { $a_id[]= quote_smart($value); } } } $sql_get ="SELECT DISTINCT username, userid, itmid, itmname, imPRICE,imPOINTS,imQTY, imID, imADDER FROM itemmarket LEFT JOIN items ON items.itmid = itemmarket.imITEM LEFT JOIN itemtypes ON itemtypes.itmtypeid = items.itmtype LEFT JOIN users ON users.userid = itemmarket.imADDER "; if(isset($a_id) || isset($a_it)) { $sql_get.= "WHERE "; } else { ?> No items found. Please try some other search option! <? $h->endpage(); exit; } if(isset($a_id) && is_array($a_id) && !empty($a_id)) { $count = count($a_id); for($i=0; $i < $count; $i++) { $sql_get.= "itmid = '".$a_id[$i]."' "; if($i < $count - 1) $sql_get.= "OR "; } } if(isset($a_it) && is_array($a_it) && !empty($a_it)) { if(isset($a_id)) $sql_get.= "OR "; $count = count($a_it); for($i=0; $i < $count; $i++) { $sql_get.= "itmtype = '".$a_it[$i]."' "; if($i < $count - 1) $sql_get.= "OR "; } } $sql_get.= " ORDER BY imPRICE ASC"; $q=mysql_query($sql_get); if(!mysql_num_rows($q)) { ?> No items found. Please try some other search option! <? $h->endpage(); exit; } else { ?> <table width="100%" class="inner"> <tr class="fill"> <td colspan="4" class="inner">Your search returned the following results</td> </tr> <tr> <td width="20%" class="inner">Adder</td> <td width="5%" class="inner">Qty</td> <td width="25%" class="inner">Item</td> <td width="20%" class="inner">Money</td> <td width="10%" class="inner">Points</td> <td width="20%" class="inner">Links</td> </tr> <? $lt=""; while($r=mysql_fetch_array($q)) { if($r['imADDER'] == $userid) { $link = "[<a href="http://itemmarket.php?action=remove&ID={$r[" target="_blank">Remove</a>]"; } else { $link = "[<a href="http://itemmarket.php?action=buy&ID={$r[" target="_blank">Buy</a>] [<a href="http://itemmarket.php?action=gift1&ID={$r[" target="_blank">Gift</a>]"; } ?> <tr> <td class="inner"><a href="http://viewuser.php?u=<?=$r[" target="_blank">'><?=$r['username']?></a> [<?=$r['userid']?>]</td> <td class="inner"><?=$r['imQTY']?></td> <td class="inner"><?=$r['itmname']?></td> <td class="inner">$<?=number_format($r['imPRICE'])?></td> <td class="inner"><?=number_format($r['imPOINTS'])?></td> <td class="inner">[<a href="http://iteminfo.php?ID=<?=$r['itmid']?>" target="_blank">Info</a>]<?=$link?></td> </tr> <?}?> </table> <? } } echo "</div>"; $h->endpage(); ?>
-
or do i have to change this bit too , $db->query("UPDATE users SET money=money-10,ammo=6 WHERE userid=$userid",$c); as i want the shop to sell more bullets , also can i make it so the buyer can type how many bullets they want and the price like $2 a bullet
-
ok so i think i know what to do but im not sure . do i have to copy this bit out if($_GET['spend'] == '6') { if($ir['money'] <10) { print "You don't have enough money to buy 6 Bullets, you need $10!"; } else { if($ir['money'] >10) { print "Congratulations, you bought 6 Bullets for $10! } and change the amounts to my liking
-
i have ammo shop script <?php //mod coded by sniko` //FREE MODIFICATION //2008 //free MOD include "globals.php"; print "<h2>Harry's Ammo Shop</h2> <i>Here you can buy Ammo, Ammo is needed to attack people with guns.</i> You Currently Have {$ir['ammo']} Bullets. <table width=100% border=1> <th height=10%>Ammo Ammount</th><th height=10%>Price</th><th height=10%>Buy</th> <tr> <td> 6 </td> <td> \$10 </td> <td> <a href=\"ammoshop.php?spend=6\" target=\"_blank\">Buy 6 Bullets</a> </td> <tr> <td> out of stock </td> <td> Not Available </td> <td> not Available </td> <tr> <td> Out Of Stock </td> <td> Not Available </td> <td> Not Available </td> </table>"; if($_GET['spend'] == '6') { if($ir['money'] <10) { print "You don't have enough money to buy 6 Bullets, you need $10!"; } else { if($ir['money'] >10) { print "Congratulations, you bought 6 Bullets for $10! } <a href=\"index.php\" target=\"_blank\">Go Home</a> <a href=\"inventory.php\" target=\"_blank\">Inventory</a> "; $db->query("UPDATE users SET money=money-10,ammo=6 WHERE userid=$userid",$c); } } } $h->endpage(); ?> ammo but i want to be able to sell more than 6 bullets , how would i do this .
-
i think it works but doesnt take a bullet off each time i take a shot , anyway thank you very very much lucky and dayo
-
Parse error: syntax error, unexpected T_ELSE in /home/husain/public_html/attack.php on line 31 now i get this error
-
hey lucky you still here
-
hey i dont understand , i have a error : Parse error: syntax error, unexpected $end in /home/husain/public_html/attack.php on line 312 i dont see what your telling me to do danny , (add a bracket) but where
-
this is now my error : Parse error: syntax error, unexpected $end in /home/husain/public_html/attack.php on line 312 my code <?php $menuhide=1; $atkpage=1; include "globals.php"; $_GET['ID'] == (int) $_GET['ID']; if(!$_GET['ID']) { print "WTF you doing, bro?"; $h->endpage(); exit; } else if($_GET['ID'] == $userid) { print "Only the crazy attack themselves."; $h->endpage(); exit; } else if ($ir['hp'] <= 1){ print "Only the crazy attack when their unconscious."; } else if ($r['ammo'] >= 1){ print "You Have NO Bullets Go Buy Some From The Ammo Shop <a href='http://index.php' target='_blank'>Back</a>"; $h->endpage(); exit; print " <a href='index.php'>Back</a>"; $h->endpage(); exit; } else if ($_SESSION['attacklost'] == 1) { print "Only the losers of all their EXP attack when they've already lost. <a href='index.php'>Back</a>"; $_SESSION['attacklost']=0; $h->endpage(); exit; } { //get player data $youdata=$ir; $q=$db->query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid={$_GET['ID']}"); $odata=$db->fetch_row($q); $myabbr=($ir['gender']=="Male") ? "his" : "her"; $oabbr=($ir['gender']=="Male") ? "his" : "her"; if($ir['attacking'] && $ir['attacking'] != $_GET['ID']) { print "Bad, bad, bad girl.<br /> <a href='index.php'>Back</a>"; $_SESSION['attacklost']=0; $h->endpage(); exit; } if($odata['hp'] == 1) { print "This player is unconscious.<br /> <a href='index.php'>> Back</a>"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } else if($odata['hospital']) { print "This player is in hospital.<br /> <a href='index.php'>> Back</a>"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } else if($ir['hospital']) { print "While in hospital you can't attack.<br /> <a href='hospital.php'>> Back</a>"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } else if($odata['jail']) { print "This player is in jail.<br /> <a href='index.php'>> Back</a>"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } else if($ir['jail']) { print "While in jail you can't attack.<br /> <a href='jail.php'>> Back</a>"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } else if($odata['travelling']) { print "That player is travelling.<br /> <a href='index.php'>> Back</a>"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } print "<table width=100%><tr><td colspan=2 align=center>"; if($_GET['wepid']) { if($_SESSION['attacking']==0 && $ir['attacking'] == 0) { if ($youdata['energy'] >= $youdata['maxenergy']/2) { $youdata['energy']-= floor($youdata['maxenergy']/2); $me=floor($youdata['maxenergy']/2); $db->query("UPDATE users SET energy=energy- {$me} WHERE userid=$userid"); $_SESSION['attacklog']=""; $_SESSION['attackdmg']=0; } else { print "You can only attack someone when you have 50% energy"; $h->endpage(); exit; } } $_SESSION['attacking']=1; $ir['attacking']=$odata['userid']; $db->query("UPDATE users SET attacking={$ir['attacking']} WHERE userid=$userid"); $_GET['wepid'] = (int) $_GET['wepid']; $_GET['nextstep'] = (int) $_GET['nextstep']; //damage if($_GET['wepid'] != $ir['equip_primary'] && $_GET['wepid'] != $ir['equip_secondary']) { print "Stop trying to abuse a game bug. You can lose all your EXP for that.<br /> <a href='index.php'>> Home</a>"; $db->query("UPDATE users SET exp=0 where userid=$userid",$c); die(""); } $qo=$db->query("SELECT i.* FROM items i WHERE i.itmid={$_GET['wepid']}"); $r1=$db->fetch_row($qo); $mydamage=(int) (($r1['weapon']*$youdata['strength']/($odata['guard']/1.5))*(rand(8000,12000)/10000)); $hitratio=max(10,min(60*$ir['agility']/$odata['agility'],95)); if(rand(1,100) <= $hitratio ) { $q3=$db->query("SELECT i.armor FROM items i WHERE itmid={$odata['equip_armor']} ORDER BY rand()"); if($db->num_rows($q3)) { $mydamage-=$db->fetch_single($q3); } if($mydamage < -100000) { $mydamage=abs($mydamage); } else if($mydamage < 1) { $mydamage=1; } $crit=rand(1,40); if($crit==17) { $mydamage*=rand(20,40)/10; } else if($crit==25 or $crit == 8) { $mydamage/=(rand(20,40)/10); } $mydamage=round($mydamage); $odata['hp']-=$mydamage; if($odata['hp']==1) { $odata['hp']=0;$mydamage+=1; } $db->query("UPDATE users SET hp=hp-$mydamage WHERE userid={$_GET['ID']}"); print "<font color=red>{$_GET['nextstep']}. Using your {$r1['itmname']} you hit {$odata['username']} doing $mydamage damage ({$odata['hp']})</font><br />\n"; $_SESSION['attackdmg']+=$mydamage; $_SESSION['attacklog'].="<font color=red>{$_GET['nextstep']}. Using {$myabbr} {$r1['itmname']} {$ir['username']} hit {$odata['username']} doing $mydamage damage ({$odata['hp']})</font><br />\n"; } else { print "<font color=red>{$_GET['nextstep']}. You tried to hit {$odata['username']} but missed ({$odata['hp']})</font><br />\n"; $_SESSION['attacklog'].="<font color=red>{$_GET['nextstep']}. {$ir['username']} tried to hit {$odata['username']} but missed ({$odata['hp']})</font><br />\n"; } if($odata['hp'] <= 0) { $odata['hp']=0; $_SESSION['attackwon']=$_GET['ID']; $db->query("UPDATE users SET hp=0 WHERE userid={$_GET['ID']}"); print "<br /> <b>What do you want to do with {$odata['username']} now?</b><br /> <form action='attackwon.php?ID={$_GET['ID']}' method='post'><input type='submit' value='Mug Them' /></form> <form action='attackbeat.php?ID={$_GET['ID']}' method='post'><input type='submit' value='Hospitalize Them' /></form> <form action='attacktake.php?ID={$_GET['ID']}' method='post'><input type='submit' value='Leave Them' /></form>"; } else { //choose opp gun $eq=$db->query("SELECT i.* FROM items i WHERE i.itmid IN({$odata['equip_primary']}, {$odata['equip_secondary']})"); if(mysql_num_rows($eq) == 0) { $wep="Fists"; $dam=(int)((((int) ($odata['strength']/$ir['guard']/100)) +1)*(rand(8000,12000)/10000)); } else { $cnt=0; while($r=$db->fetch_row($eq)) { $enweps[]=$r; $cnt++; } $weptouse=rand(0,$cnt-1); $wep=$enweps[$weptouse]['itmname']; $dam=(int) (($enweps[$weptouse]['weapon']*$odata['strength']/($youdata['guard']/1.5))*(rand(8000,12000)/10000)); } $hitratio=max(10,min(60*$odata['agility']/$ir['agility'],95)); if(rand(1,100) <= $hitratio) { $q3=$db->query("SELECT i.armor FROM items i WHERE itmid={$ir['equip_armor']} ORDER BY rand()"); if($db->num_rows($q3)) { $dam-=$db->fetch_single($q3); } if($dam < -100000) { $dam=abs($dam); } else if($dam < 1) { $dam=1; } $crit=rand(1,40); if($crit==17) { $dam*=rand(20,40)/10; } else if($crit==25 or $crit == 8) { $dam/=(rand(20,40)/10); } $dam=round($dam); $youdata['hp']-=$dam; if ($youdata['hp']==1) { $dam+=1; $youdata['hp']=0; } $db->query("UPDATE users SET hp=hp-$dam WHERE userid=$userid"); $ns=$_GET['nextstep']+1; print "<font color=blue>{$ns}. Using $oabbr $wep {$odata['username']} hit you doing $dam damage ({$youdata['hp']})</font><br />\n"; $_SESSION['attacklog'].="<font color=blue>{$ns}. Using $oabbr $wep {$odata['username']} hit {$ir['username']} doing $dam damage ({$youdata['hp']})</font><br />\n"; } else { $ns=$_GET['nextstep']+1; print "<font color=red>{$ns}. {$odata['username']} tried to hit you but missed ({$youdata['hp']})</font><br />\n"; $_SESSION['attacklog'].="<font color=blue>{$ns}. {$odata['username']} tried to hit {$ir['username']} but missed ({$youdata['hp']})</font><br />\n"; } if($youdata['hp'] <= 0) { $youdata['hp']=0; $_SESSION['attacklost']=1; $db->query("UPDATE users SET hp=0 WHERE userid=$userid"); print "<form action='attacklost.php?ID={$_GET['ID']}' method='post'><input type='submit' value='Continue' />"; } } } else if ($odata['hp'] < 5) { print "You can only attack those who have health"; $h->endpage(); exit; } else if ($ir['gang'] == $odata['gang'] && $ir['gang'] > 0) { print "You are in the same gang as {$odata['username']}! What are you smoking today dude!"; $h->endpage(); exit; } else if ($youdata['energy'] < $youdata['maxenergy']/2) { print "You can only attack someone when you have 50% energy"; $h->endpage(); exit; } else if ($youdata['location'] != $odata['location']) { print "You can only attack someone in the same location!"; $h->endpage(); exit; } else { } print "</td></tr>"; if($youdata['hp'] <= 0 || $odata['hp'] <= 0) { print "</table>"; } else { $vars['hpperc']=round($youdata['hp']/$youdata['maxhp']*100); $vars['hpopp']=100-$vars['hpperc']; $vars2['hpperc']=round($odata['hp']/$odata['maxhp']*100); $vars2['hpopp']=100-$vars2['hpperc']; $mw=$db->query("SELECT i.* FROM items i WHERE i.itmid IN({$ir['equip_primary']}, {$ir['equip_secondary']})"); print "<tr><td colspan=2 align='center'>Attack with:<br />"; if($db->num_rows($mw) > 0) { while($r=$db->fetch_row($mw)) { if(!$_GET['nextstep']) { $ns=1; } else { $ns=$_GET['nextstep']+2; } if($r['itmid']==$ir['equip_primary']) { print "<b>Primary Weapon:</b> "; } if($r['itmid']==$ir['equip_secondary']) { print "<b>Secondary Weapon:</b> "; } print "<a href='attack.php?nextstep=$ns&ID={$_GET['ID']}&wepid={$r['itmid']}'>{$r['itmname']}</a><br />"; } } else { print "You have nothing to fight with."; } print "</table>"; print "<table width='50%' align='center'><tr><td align=right>Your Health: </td><td><img src=greenbar.png width={$vars['hpperc']} height=10><img src=redbar.png width={$vars['hpopp']} height=10></td><tr><td align=right>Opponents Health: </td><td><img src=greenbar.png width={$vars2['hpperc']} height=10><img src=redbar.png width={$vars2['hpopp']} height=10></td></tr></table>"; } $h->endpage(); ?> sorry for all this bother lucky
-
hey lucky thanks for all this help but there is a :Parse error: syntax error, unexpected T_STRING in /home/husain/public_html/attack.php on line 30 this is my code so far <?php $menuhide=1; $atkpage=1; include "globals.php"; $_GET['ID'] == (int) $_GET['ID']; if(!$_GET['ID']) { print "WTF you doing, bro?"; $h->endpage(); exit; } else if($_GET['ID'] == $userid) { print "Only the crazy attack themselves."; $h->endpage(); exit; } else if ($ir['hp'] <= 1){ print "Only the crazy attack when their unconscious."; } else if ($r['ammo'] >= 1){ print "You Have NO Bullets Go Buy Some From The Ammo Shop <a href='http://index.php' target='_blank'>Back</a>'; $h->endpage(); exit; } print " <a href='index.php'>Back</a>"; $h->endpage(); exit; } else if ($_SESSION['attacklost'] == 1) { print "Only the losers of all their EXP attack when they've already lost. <a href='index.php'>Back</a>"; $_SESSION['attacklost']=0; $h->endpage(); exit; } } //get player data $youdata=$ir; $q=$db->query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid={$_GET['ID']}"); $odata=$db->fetch_row($q); $myabbr=($ir['gender']=="Male") ? "his" : "her"; $oabbr=($ir['gender']=="Male") ? "his" : "her"; if($ir['attacking'] && $ir['attacking'] != $_GET['ID']) { print "Bad, bad, bad girl.<br /> <a href='index.php'>Back</a>"; $_SESSION['attacklost']=0; $h->endpage(); exit; } if($odata['hp'] == 1) { print "This player is unconscious.<br /> <a href='index.php'>> Back</a>"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } else if($odata['hospital']) { print "This player is in hospital.<br /> <a href='index.php'>> Back</a>"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } else if($ir['hospital']) { print "While in hospital you can't attack.<br /> <a href='hospital.php'>> Back</a>"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } else if($odata['jail']) { print "This player is in jail.<br /> <a href='index.php'>> Back</a>"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } else if($ir['jail']) { print "While in jail you can't attack.<br /> <a href='jail.php'>> Back</a>"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } else if($odata['travelling']) { print "That player is travelling.<br /> <a href='index.php'>> Back</a>"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } print "<table width=100%><tr><td colspan=2 align=center>"; if($_GET['wepid']) { if($_SESSION['attacking']==0 && $ir['attacking'] == 0) { if ($youdata['energy'] >= $youdata['maxenergy']/2) { $youdata['energy']-= floor($youdata['maxenergy']/2); $me=floor($youdata['maxenergy']/2); $db->query("UPDATE users SET energy=energy- {$me} WHERE userid=$userid"); $_SESSION['attacklog']=""; $_SESSION['attackdmg']=0; } else { print "You can only attack someone when you have 50% energy"; $h->endpage(); exit; } } $_SESSION['attacking']=1; $ir['attacking']=$odata['userid']; $db->query("UPDATE users SET attacking={$ir['attacking']} WHERE userid=$userid"); $_GET['wepid'] = (int) $_GET['wepid']; $_GET['nextstep'] = (int) $_GET['nextstep']; //damage if($_GET['wepid'] != $ir['equip_primary'] && $_GET['wepid'] != $ir['equip_secondary']) { print "Stop trying to abuse a game bug. You can lose all your EXP for that.<br /> <a href='index.php'>> Home</a>"; $db->query("UPDATE users SET exp=0 where userid=$userid",$c); die(""); } $qo=$db->query("SELECT i.* FROM items i WHERE i.itmid={$_GET['wepid']}"); $r1=$db->fetch_row($qo); $mydamage=(int) (($r1['weapon']*$youdata['strength']/($odata['guard']/1.5))*(rand(8000,12000)/10000)); $hitratio=max(10,min(60*$ir['agility']/$odata['agility'],95)); if(rand(1,100) <= $hitratio ) { $q3=$db->query("SELECT i.armor FROM items i WHERE itmid={$odata['equip_armor']} ORDER BY rand()"); if($db->num_rows($q3)) { $mydamage-=$db->fetch_single($q3); } if($mydamage < -100000) { $mydamage=abs($mydamage); } else if($mydamage < 1) { $mydamage=1; } $crit=rand(1,40); if($crit==17) { $mydamage*=rand(20,40)/10; } else if($crit==25 or $crit == 8) { $mydamage/=(rand(20,40)/10); } $mydamage=round($mydamage); $odata['hp']-=$mydamage; if($odata['hp']==1) { $odata['hp']=0;$mydamage+=1; } $db->query("UPDATE users SET hp=hp-$mydamage WHERE userid={$_GET['ID']}"); print "<font color=red>{$_GET['nextstep']}. Using your {$r1['itmname']} you hit {$odata['username']} doing $mydamage damage ({$odata['hp']})</font><br />\n"; $_SESSION['attackdmg']+=$mydamage; $_SESSION['attacklog'].="<font color=red>{$_GET['nextstep']}. Using {$myabbr} {$r1['itmname']} {$ir['username']} hit {$odata['username']} doing $mydamage damage ({$odata['hp']})</font><br />\n"; } else { print "<font color=red>{$_GET['nextstep']}. You tried to hit {$odata['username']} but missed ({$odata['hp']})</font><br />\n"; $_SESSION['attacklog'].="<font color=red>{$_GET['nextstep']}. {$ir['username']} tried to hit {$odata['username']} but missed ({$odata['hp']})</font><br />\n"; } if($odata['hp'] <= 0) { $odata['hp']=0; $_SESSION['attackwon']=$_GET['ID']; $db->query("UPDATE users SET hp=0 WHERE userid={$_GET['ID']}"); print "<br /> <b>What do you want to do with {$odata['username']} now?</b><br /> <form action='attackwon.php?ID={$_GET['ID']}' method='post'><input type='submit' value='Mug Them' /></form> <form action='attackbeat.php?ID={$_GET['ID']}' method='post'><input type='submit' value='Hospitalize Them' /></form> <form action='attacktake.php?ID={$_GET['ID']}' method='post'><input type='submit' value='Leave Them' /></form>"; } else { //choose opp gun $eq=$db->query("SELECT i.* FROM items i WHERE i.itmid IN({$odata['equip_primary']}, {$odata['equip_secondary']})"); if(mysql_num_rows($eq) == 0) { $wep="Fists"; $dam=(int)((((int) ($odata['strength']/$ir['guard']/100)) +1)*(rand(8000,12000)/10000)); } else { $cnt=0; while($r=$db->fetch_row($eq)) { $enweps[]=$r; $cnt++; } $weptouse=rand(0,$cnt-1); $wep=$enweps[$weptouse]['itmname']; $dam=(int) (($enweps[$weptouse]['weapon']*$odata['strength']/($youdata['guard']/1.5))*(rand(8000,12000)/10000)); } $hitratio=max(10,min(60*$odata['agility']/$ir['agility'],95)); if(rand(1,100) <= $hitratio) { $q3=$db->query("SELECT i.armor FROM items i WHERE itmid={$ir['equip_armor']} ORDER BY rand()"); if($db->num_rows($q3)) { $dam-=$db->fetch_single($q3); } if($dam < -100000) { $dam=abs($dam); } else if($dam < 1) { $dam=1; } $crit=rand(1,40); if($crit==17) { $dam*=rand(20,40)/10; } else if($crit==25 or $crit == 8) { $dam/=(rand(20,40)/10); } $dam=round($dam); $youdata['hp']-=$dam; if ($youdata['hp']==1) { $dam+=1; $youdata['hp']=0; } $db->query("UPDATE users SET hp=hp-$dam WHERE userid=$userid"); $ns=$_GET['nextstep']+1; print "<font color=blue>{$ns}. Using $oabbr $wep {$odata['username']} hit you doing $dam damage ({$youdata['hp']})</font><br />\n"; $_SESSION['attacklog'].="<font color=blue>{$ns}. Using $oabbr $wep {$odata['username']} hit {$ir['username']} doing $dam damage ({$youdata['hp']})</font><br />\n"; } else { $ns=$_GET['nextstep']+1; print "<font color=red>{$ns}. {$odata['username']} tried to hit you but missed ({$youdata['hp']})</font><br />\n"; $_SESSION['attacklog'].="<font color=blue>{$ns}. {$odata['username']} tried to hit {$ir['username']} but missed ({$youdata['hp']})</font><br />\n"; } if($youdata['hp'] <= 0) { $youdata['hp']=0; $_SESSION['attacklost']=1; $db->query("UPDATE users SET hp=0 WHERE userid=$userid"); print "<form action='attacklost.php?ID={$_GET['ID']}' method='post'><input type='submit' value='Continue' />"; } } } else if ($odata['hp'] < 5) { print "You can only attack those who have health"; $h->endpage(); exit; } else if ($ir['gang'] == $odata['gang'] && $ir['gang'] > 0) { print "You are in the same gang as {$odata['username']}! What are you smoking today dude!"; $h->endpage(); exit; } else if ($youdata['energy'] < $youdata['maxenergy']/2) { print "You can only attack someone when you have 50% energy"; $h->endpage(); exit; } else if ($youdata['location'] != $odata['location']) { print "You can only attack someone in the same location!"; $h->endpage(); exit; } else { } print "</td></tr>"; if($youdata['hp'] <= 0 || $odata['hp'] <= 0) { print "</table>"; } else { $vars['hpperc']=round($youdata['hp']/$youdata['maxhp']*100); $vars['hpopp']=100-$vars['hpperc']; $vars2['hpperc']=round($odata['hp']/$odata['maxhp']*100); $vars2['hpopp']=100-$vars2['hpperc']; $mw=$db->query("SELECT i.* FROM items i WHERE i.itmid IN({$ir['equip_primary']}, {$ir['equip_secondary']})"); print "<tr><td colspan=2 align='center'>Attack with:<br />"; if($db->num_rows($mw) > 0) { while($r=$db->fetch_row($mw)) { if(!$_GET['nextstep']) { $ns=1; } else { $ns=$_GET['nextstep']+2; } if($r['itmid']==$ir['equip_primary']) { print "<b>Primary Weapon:</b> "; } if($r['itmid']==$ir['equip_secondary']) { print "<b>Secondary Weapon:</b> "; } print "<a href='attack.php?nextstep=$ns&ID={$_GET['ID']}&wepid={$r['itmid']}'>{$r['itmname']}</a><br />"; } } else { print "You have nothing to fight with."; } print "</table>"; print "<table width='50%' align='center'><tr><td align=right>Your Health: </td><td><img src=greenbar.png width={$vars['hpperc']} height=10><img src=redbar.png width={$vars['hpopp']} height=10></td><tr><td align=right>Opponents Health: </td><td><img src=greenbar.png width={$vars2['hpperc']} height=10><img src=redbar.png width={$vars2['hpopp']} height=10></td></tr></table>"; } $h->endpage(); ?>
-
the error is still there : Parse error: syntax error, unexpected T_STRING in /home/husain/public_html/attack.php on line 30
-
done : Parse error: syntax error, unexpected T_STRING in /home/husain/public_html/attack.php on line 30
-
ok thank you for helping me out lucky and blueman
-
does it have to be like this
-
print "Only the crazy attack when their unconscious."<br /> } else if ($r['ammo'] > = 1)
-
il try it and see yep i know i see line 25 error lol
-
ok il try it thanks
-
ok thats fixd but now it says print Parse error: syntax error, unexpected '>' in /home/husain/public_html/attack.php on line 21
-
ok so i think i have to add a quote at the end of line 22
-
ok thanks for your help +rep
-
there is anouther problem , in attack.php it says : Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/husain/public_html/attack.php on line 23 attack : <?php $menuhide=1; $atkpage=1; include "globals.php"; $_GET['ID'] == (int) $_GET['ID']; if(!$_GET['ID']) { print "WTF you doing, bro?"; $h->endpage(); exit; } else if($_GET['ID'] == $userid) { print "Only the crazy attack themselves."; $h->endpage(); exit; } else if ($ir['hp'] <= 1) { print "Only the crazy attack when their unconscious.<br /> } else if ($r['ammo'] > = 1) { print "You Have NO Bullets Go Buy Some From The Ammo Shop <a href="http://index.php" target="_blank">Back</a>"; $h->endpage(); exit; } <a href='index.php'>Back</a>"; $h->endpage(); exit; } else if ($_SESSION['attacklost'] == 1) { print "Only the losers of all their EXP attack when they've already lost.<br /> <a href='index.php'>Back</a>"; $_SESSION['attacklost']=0; $h->endpage(); exit; } //get player data $youdata=$ir; $q=$db->query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid={$_GET['ID']}"); $odata=$db->fetch_row($q); $myabbr=($ir['gender']=="Male") ? "his" : "her"; $oabbr=($ir['gender']=="Male") ? "his" : "her"; if($ir['attacking'] && $ir['attacking'] != $_GET['ID']) { print "Bad, bad, bad girl.<br /> <a href='index.php'>Back</a>"; $_SESSION['attacklost']=0; $h->endpage(); exit; } if($odata['hp'] == 1) { print "This player is unconscious.<br /> <a href='index.php'>> Back</a>"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } else if($odata['hospital']) { print "This player is in hospital.<br /> <a href='index.php'>> Back</a>"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } else if($ir['hospital']) { print "While in hospital you can't attack.<br /> <a href='hospital.php'>> Back</a>"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } else if($odata['jail']) { print "This player is in jail.<br /> <a href='index.php'>> Back</a>"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } else if($ir['jail']) { print "While in jail you can't attack.<br /> <a href='jail.php'>> Back</a>"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } else if($odata['travelling']) { print "That player is travelling.<br /> <a href='index.php'>> Back</a>"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } print "<table width=100%><tr><td colspan=2 align=center>"; if($_GET['wepid']) { if($_SESSION['attacking']==0 && $ir['attacking'] == 0) { if ($youdata['energy'] >= $youdata['maxenergy']/2) { $youdata['energy']-= floor($youdata['maxenergy']/2); $me=floor($youdata['maxenergy']/2); $db->query("UPDATE users SET energy=energy- {$me} WHERE userid=$userid"); $_SESSION['attacklog']=""; $_SESSION['attackdmg']=0; } else { print "You can only attack someone when you have 50% energy"; $h->endpage(); exit; } } $_SESSION['attacking']=1; $ir['attacking']=$odata['userid']; $db->query("UPDATE users SET attacking={$ir['attacking']} WHERE userid=$userid"); $_GET['wepid'] = (int) $_GET['wepid']; $_GET['nextstep'] = (int) $_GET['nextstep']; //damage if($_GET['wepid'] != $ir['equip_primary'] && $_GET['wepid'] != $ir['equip_secondary']) { print "Stop trying to abuse a game bug. You can lose all your EXP for that.<br /> <a href='index.php'>> Home</a>"; $db->query("UPDATE users SET exp=0 where userid=$userid",$c); die(""); } $qo=$db->query("SELECT i.* FROM items i WHERE i.itmid={$_GET['wepid']}"); $r1=$db->fetch_row($qo); $mydamage=(int) (($r1['weapon']*$youdata['strength']/($odata['guard']/1.5))*(rand(8000,12000)/10000)); $hitratio=max(10,min(60*$ir['agility']/$odata['agility'],95)); if(rand(1,100) <= $hitratio ) { $q3=$db->query("SELECT i.armor FROM items i WHERE itmid={$odata['equip_armor']} ORDER BY rand()"); if($db->num_rows($q3)) { $mydamage-=$db->fetch_single($q3); } if($mydamage < -100000) { $mydamage=abs($mydamage); } else if($mydamage < 1) { $mydamage=1; } $crit=rand(1,40); if($crit==17) { $mydamage*=rand(20,40)/10; } else if($crit==25 or $crit == 8) { $mydamage/=(rand(20,40)/10); } $mydamage=round($mydamage); $odata['hp']-=$mydamage; if($odata['hp']==1) { $odata['hp']=0;$mydamage+=1; } $db->query("UPDATE users SET hp=hp-$mydamage WHERE userid={$_GET['ID']}"); print "<font color=red>{$_GET['nextstep']}. Using your {$r1['itmname']} you hit {$odata['username']} doing $mydamage damage ({$odata['hp']})</font><br />\n"; $_SESSION['attackdmg']+=$mydamage; $_SESSION['attacklog'].="<font color=red>{$_GET['nextstep']}. Using {$myabbr} {$r1['itmname']} {$ir['username']} hit {$odata['username']} doing $mydamage damage ({$odata['hp']})</font><br />\n"; } else { print "<font color=red>{$_GET['nextstep']}. You tried to hit {$odata['username']} but missed ({$odata['hp']})</font><br />\n"; $_SESSION['attacklog'].="<font color=red>{$_GET['nextstep']}. {$ir['username']} tried to hit {$odata['username']} but missed ({$odata['hp']})</font><br />\n"; } if($odata['hp'] <= 0) { $odata['hp']=0; $_SESSION['attackwon']=$_GET['ID']; $db->query("UPDATE users SET hp=0 WHERE userid={$_GET['ID']}"); print "<br /> <b>What do you want to do with {$odata['username']} now?</b><br /> <form action='attackwon.php?ID={$_GET['ID']}' method='post'><input type='submit' value='Mug Them' /></form> <form action='attackbeat.php?ID={$_GET['ID']}' method='post'><input type='submit' value='Hospitalize Them' /></form> <form action='attacktake.php?ID={$_GET['ID']}' method='post'><input type='submit' value='Leave Them' /></form>"; } else { //choose opp gun $eq=$db->query("SELECT i.* FROM items i WHERE i.itmid IN({$odata['equip_primary']}, {$odata['equip_secondary']})"); if(mysql_num_rows($eq) == 0) { $wep="Fists"; $dam=(int)((((int) ($odata['strength']/$ir['guard']/100)) +1)*(rand(8000,12000)/10000)); } else { $cnt=0; while($r=$db->fetch_row($eq)) { $enweps[]=$r; $cnt++; } $weptouse=rand(0,$cnt-1); $wep=$enweps[$weptouse]['itmname']; $dam=(int) (($enweps[$weptouse]['weapon']*$odata['strength']/($youdata['guard']/1.5))*(rand(8000,12000)/10000)); } $hitratio=max(10,min(60*$odata['agility']/$ir['agility'],95)); if(rand(1,100) <= $hitratio) { $q3=$db->query("SELECT i.armor FROM items i WHERE itmid={$ir['equip_armor']} ORDER BY rand()"); if($db->num_rows($q3)) { $dam-=$db->fetch_single($q3); } if($dam < -100000) { $dam=abs($dam); } else if($dam < 1) { $dam=1; } $crit=rand(1,40); if($crit==17) { $dam*=rand(20,40)/10; } else if($crit==25 or $crit == 8) { $dam/=(rand(20,40)/10); } $dam=round($dam); $youdata['hp']-=$dam; if ($youdata['hp']==1) { $dam+=1; $youdata['hp']=0; } $db->query("UPDATE users SET hp=hp-$dam WHERE userid=$userid"); $ns=$_GET['nextstep']+1; print "<font color=blue>{$ns}. Using $oabbr $wep {$odata['username']} hit you doing $dam damage ({$youdata['hp']})</font><br />\n"; $_SESSION['attacklog'].="<font color=blue>{$ns}. Using $oabbr $wep {$odata['username']} hit {$ir['username']} doing $dam damage ({$youdata['hp']})</font><br />\n"; } else { $ns=$_GET['nextstep']+1; print "<font color=red>{$ns}. {$odata['username']} tried to hit you but missed ({$youdata['hp']})</font><br />\n"; $_SESSION['attacklog'].="<font color=blue>{$ns}. {$odata['username']} tried to hit {$ir['username']} but missed ({$youdata['hp']})</font><br />\n"; } if($youdata['hp'] <= 0) { $youdata['hp']=0; $_SESSION['attacklost']=1; $db->query("UPDATE users SET hp=0 WHERE userid=$userid"); print "<form action='attacklost.php?ID={$_GET['ID']}' method='post'><input type='submit' value='Continue' />"; } } } else if ($odata['hp'] < 5) { print "You can only attack those who have health"; $h->endpage(); exit; } else if ($ir['gang'] == $odata['gang'] && $ir['gang'] > 0) { print "You are in the same gang as {$odata['username']}! What are you smoking today dude!"; $h->endpage(); exit; } else if ($youdata['energy'] < $youdata['maxenergy']/2) { print "You can only attack someone when you have 50% energy"; $h->endpage(); exit; } else if ($youdata['location'] != $odata['location']) { print "You can only attack someone in the same location!"; $h->endpage(); exit; } else { } print "</td></tr>"; if($youdata['hp'] <= 0 || $odata['hp'] <= 0) { print "</table>"; } else { $vars['hpperc']=round($youdata['hp']/$youdata['maxhp']*100); $vars['hpopp']=100-$vars['hpperc']; $vars2['hpperc']=round($odata['hp']/$odata['maxhp']*100); $vars2['hpopp']=100-$vars2['hpperc']; $mw=$db->query("SELECT i.* FROM items i WHERE i.itmid IN({$ir['equip_primary']}, {$ir['equip_secondary']})"); print "<tr><td colspan=2 align='center'>Attack with:<br />"; if($db->num_rows($mw) > 0) { while($r=$db->fetch_row($mw)) { if(!$_GET['nextstep']) { $ns=1; } else { $ns=$_GET['nextstep']+2; } if($r['itmid']==$ir['equip_primary']) { print "<b>Primary Weapon:</b> "; } if($r['itmid']==$ir['equip_secondary']) { print "<b>Secondary Weapon:</b> "; } print "<a href='attack.php?nextstep=$ns&ID={$_GET['ID']}&wepid={$r['itmid']}'>{$r['itmname']}</a><br />"; } } else { print "You have nothing to fight with."; } print "</table>"; print "<table width='50%' align='center'><tr><td align=right>Your Health: </td><td><img src=greenbar.png width={$vars['hpperc']} height=10><img src=redbar.png width={$vars['hpopp']} height=10></td><tr><td align=right>Opponents Health: </td><td><img src=greenbar.png width={$vars2['hpperc']} height=10><img src=redbar.png width={$vars2['hpopp']} height=10></td></tr></table>"; } $h->endpage(); ?>