Jump to content
MakeWebGames

GregFest

Members
  • Posts

    98
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

GregFest's Achievements

Newbie

Newbie (1/14)

  • First Post Rare
  • Collaborator Rare
  • Reacting Well Rare
  • Conversation Starter Rare
  • Week One Done

Recent Badges

0

Reputation

  1. I am currently in the process of converting a v1 game to work with today's php and sql. Or would it be easier to start with v2. I issue i am having is some pages will give me cant post neg into the database
  2. FIXED
  3. Anyone got a copy of Snikos New Gang System. Loved the mod. But have lost it. Thanks in advanced.
  4. pm'ed you
  5. got all the psds. htmls css and so on. just need it integrated with mccodes
  6. willing to through in a bonus 50$
  7. everything is basic atm.
  8. Hello looking for someone to do a template integration for me. Just the usual login, register and in-game. Name your price
  9. We have a template just needed then in game part coded, if i can get cost for work as well that would be great.
  10. I need this attack put to a oneclick attack, if it can be done. with this attack you dont equip weapons and armour so if it can be done ill pay for the need work   <?php session_start(); require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); check_level(); $fm=money_formatter($ir['money']); $cm=money_formatter($ir['crystals'],''); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm,$cm,$sm,0); if ($ir['prison']>0) { die ("You cannot attack while in Prison"); } if ($ir['location'] == 11) { mysql_query("UPDATE users SET prison=10 WHERE userid=$userid", $c); die ("You cannot attack while in Safe Haven! To jail with you!</br> ><a href='index.php'>Back</a>"); } if ($ir['hospital']>0) { die ("You cannot attack while in the SickBay.</br> ><a href='index.php'>Back</a>"); } $_GET['ID'] == (int) $_GET['ID']; if(!$_GET['ID']) { print "<font color='red'>What do you think your doing?</font></b>"; $h->endpage(); exit; } else if($_GET['ID'] == $userid) { print "<font color='red'><b>Only the crazy attack themselves!</font></b>"; $h->endpage(); exit; } else if($_GET['ID'] == 0) { die ("This account cannot be attacked."); } else if($_GET['ID'] == 1) { die ("Dont kill artos"); } else if($ir['attackban'] > 0) { die("<font color=red><h3>! ERROR</font></h3> <font color=red>You are attack banned for</font><font color=red><b> {$ir['attackban']}</b></font><font color=red> days.</font><br /> <br /> <b><font color=red>Reason:</font><font color=red> {$ir['attackbanreason']}</font></b><br/><br/><a href='index.php'>> Back</a>"); $h->endpage(); exit; } //get player data $youdata=$ir; if ($ir['hp']<=0) { die ("<center><form action='attacklost.php?ID={$_GET['ID']}' method='post'><input type='submit' value='Continue' /></center>"); } $q=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid={$_GET['ID']}",$c); $odata=mysql_fetch_array($q); if($odata['hp'] == 1) { print "<b><font color='red'>This player is unconscious.</font></b><br /> <a href='index.php'>> Back</a>"; $h->endpage(); $_SESSION['attacking']=0; exit; } if($ir['hp'] == 0) { mysql_query("UPDATE users SET hospital=300,hospreason='Tried to run from {$odata['username']}' where userid=$userid", $c); print "<center>No Refreshing<br /> <a href='index.php'>> Back </a></center>"; $h->endpage(); $_SESSION['attacking']=0; exit; } else if($odata['prison']>0) { print "<font color='red'><b>This player is in the Prison.</b><font><br /> <a href='index.php'>> Back</a>"; $h->endpage(); $_SESSION['attacking']=0; exit; } else if($odata['hospital']>0) { print "<font color='red'><b>This player is in the SickBay.</b><font><br /> <a href='index.php'>> Back</a>"; $h->endpage(); $_SESSION['attacking']=0; exit; } else if($ir['hospital']) { print "<b><font color='red'>You can not attack while in sickbay.</font></b><br /> <a href='hospital.php'>> Back</a>"; $h->endpage(); $_SESSION['attacking']=0; exit; } print "<table width=100%><tr><td colspan=2 align=center>"; if($_GET['wepid']) { if($_SESSION['attacking']==0) { if ($youdata['energy'] >= $youdata['maxenergy']/2.1) { $youdata['energy']-= $youdata['maxenergy']/2.1; $me=$youdata['maxenergy']/2.1; mysql_query("UPDATE users SET energy=energy- {$me} WHERE userid=$userid",$c); $_SESSION['attacklog']=""; } else { print "<font color='red'><b>You can only attack someone when you have 50% energy</font></b>"; $h->endpage(); exit; } } $_SESSION['attacking']=1; $_GET['wepid'] = (int) $_GET['wepid']; $_GET['nextstep'] = (int) $_GET['nextstep']; //damage $qr=mysql_query("SELECT * FROM inventory WHERE inv_itemid={$_GET['wepid']} and inv_userid=$userid",$c); if(mysql_num_rows($qr)==0) { print "<font color='red'>Stop trying to abuse a game bug. You can lose all your EXP for that.</font></b><br /> <a href='index.php'>> Home</a>"; mysql_query("UPDATE users SET exp=0 where userid=$userid",$c); die(""); } $qo=mysql_query("SELECT i.*,w.* FROM items i LEFT JOIN weapons w ON i.itmid=w.item_id WHERE w.item_id={$_GET['wepid']}",$c); $r1=mysql_fetch_array($qo); $mydamage=(int) (($r1['damage']*$youdata['mastery']/$odata['defense'])*(rand(8000,12000)/10000)); $hitratio=min(30*$ir['accuracy']/$odata['accuracy'],65); if ($userid==3) { $hitratio=100; } if ($userid==1) { $hitratio=100; } if($userid==1) { $hitratio=100; } if(rand(1,100) <= $hitratio) if($userid==3) { $hitratio=100; } if(rand(1,100) <= $hitratio) { $q3=mysql_query("SELECT a.Defence FROM inventory iv LEFT JOIN items i ON iv.inv_itemid = i.itmid LEFT JOIN armour a ON i.itmid=a.item_ID WHERE i.itmtype=7 AND iv.inv_userid={$_GET['ID']} ORDER BY rand()", $c); if(mysql_num_rows($q3)) { $mydamage-=mysql_result($q3,0,0); } if($mydamage < 1) { $mydamage=1; } $odata['hp']-=$mydamage; if($odata['hp']==1) { $odata['hp']=0;$mydamage+=1; } mysql_query("UPDATE users SET hp=hp-$mydamage WHERE userid={$_GET['ID']}",$c); print "<font color=red>{$_GET['nextstep']}. Using your {$r1['itmname']} you hit {$odata['username']} doing $mydamage damage ({$odata['hp']})</font><br />\n"; $_SESSION['attacklog'].="<font color=red>{$_GET['nextstep']}. Using his {$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']; mysql_query("UPDATE users SET hp=0 WHERE userid={$_GET['ID']}",$c); print "<form action='attackleave.php?ID={$_GET['ID']}' method='post'><input type='submit' value='Leave Them' /></form> <form action='attackmug.php?ID={$_GET['ID']}' method='post'><input type='submit' value='Mug Them'></form> <form action='attackhosp.php?ID={$_GET['ID']}' method='post'><input type='submit' value='Hospitalize Them'></form>"; } else { //choose opp gun $eq=mysql_query("SELECT iv.*,i.*,w.* FROM inventory iv LEFT JOIN items i ON iv.inv_itemid=i.itmid LEFT JOIN weapons w ON iv.inv_itemid=w.item_id WHERE iv.inv_userid={$_GET['ID']} AND ( i.itmtype=3 OR i.itmtype=4 )",$c); if(mysql_num_rows($eq) == 0) { $wep="Fists"; $dam=(int)((((int) ($odata['mastery']/100)) +1)*(rand(1,2)*0)); } else { $cnt=0; while($r=mysql_fetch_array($eq)) { $enweps[]=$r; $cnt++; } $weptouse=rand(0,$cnt-1); $wep=$enweps[$weptouse]['itmname']; $dam=(int) (($enweps[$weptouse]['damage']*$odata['mastery']/$youdata['defense'])*(rand(8000,12000)/10000)); } $hitratio=min(50*$odata['accuracy']/$ir['accuracy'],95); if(rand(1,100) <= $hitratio) { $q3=mysql_query("SELECT a.Defence FROM inventory iv LEFT JOIN items i ON iv.inv_itemid = i.itmid LEFT JOIN armour a ON i.itmid=a.item_ID WHERE i.itmtype=7 AND iv.inv_userid=$userid ORDER BY rand()", $c); if(mysql_num_rows($q3)) { $dam-=mysql_result($q3,0,0); } if($dam < 1) { $dam=1; } $youdata['hp']-=$dam; mysql_query("UPDATE users SET hp=hp-$dam WHERE userid=$userid",$c); $ns=$_GET['nextstep']+1; print "<font color=blue>{$ns}. Using his $wep {$odata['username']} hit you doing $dam damage ({$youdata['hp']})</font><br />\n"; $_SESSION['attacklog'].="<font color=blue>{$ns}. Using his $wep {$odata['username']} hit {$ir['username']} doing $dam damage ({$youdata['hp']})</font><br />\n"; } else { $ns=$_GET['nextstep']+1; print "<font color=blue>{$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; mysql_query("UPDATE users SET hp=0 WHERE userid=$userid",$c); print "<form action='attacklost.php?ID={$_GET['ID']}' method='post'><input type='submit' value='Continue' />"; } } } else if ($odata['hp'] < $odata['maxhp']/4) { print "You can only attack those who have at least 1/4 their max health this is to prevent kill stealing.."; $h->endpage(); exit; } else if ($ir['gang'] == $odata['gang'] && $ir['gang'] > 0) { print "You are in the same Federation as {$odata['username']}! What are you smoking today dude?"; $h->endpage(); exit; } else if ($youdata['energy'] < $youdata['maxenergy']/2.1) { print "You can only attack someone when you have 50% energy."; $h->endpage(); exit; } else if($ir['attackban'] > 0) { die("<font color=red><h3>! ERROR</font></h3> <font color=red>Your attack banned for</font><font color=red><b> {$ir['attackban']}</b></font><font color=red> days.</font><br /> <br /> <b><font color=red>Reason:</font><font color=red> {$ir['attackbanreason']}</font></b><br/><br/><a href='index.php'>> Back</a>"); $h->endpage(); exit; } else if ($odata['user_level'] == 10) { print "You cannot attack a test player!"; $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 { print "<center><tr><td>Your Health: {$youdata['hp']}/{$youdata['maxhp']}</td><td>Opponents Health: {$odata['hp']}/{$odata['maxhp']}</td></tr></center>"; $mw=mysql_query("SELECT iv.*,i.* FROM inventory iv LEFT JOIN items i ON iv.inv_itemid=i.itmid WHERE iv.inv_userid=$userid AND (i.itmtype = 3 || i.itmtype = 4)",$c); print "<tr><td colspan=2 align='center'>Attack with:<br />"; while($r=mysql_fetch_array($mw)) { if(!$_GET['nextstep']) { $ns=1; } else { $ns=$_GET['nextstep']+2; } print "<a href='attack.php?nextstep=$ns&ID={$_GET['ID']}&wepid={$r['itmid']}'>{$r['itmname']}</a><br />"; } print "</table>"; } $h->endpage(); ?>
  11. FIXED thanks SomeRandomBastard for those words
  12. itemmarket.php <?php /* Engine: MC V2.5 (Redux) File: itemmarket.php Author: mccodes.com */ if ( !defined($_CONFIG['define_code']) ) { echo 'This file cannot be accessed directly.'; exit; } echo "<h3>Item Market</h3>"; switch($_GET['action']) { case "buy": item_buy(); break; case "gift1": item_gift1(); break; case "gift2": item_gift2(); break; case "remove": itemm_remove(); break; default: imarket_index(); break; } function imarket_index() { global $db,$ir,$c,$userid,$h,$set; echo ' <br /> <table width="100%" cellspacing="1" cellpadding="1" class="table" align="center"> <tr> <th width="25%">Adder</th> <th width="25%">Item</th> <th width="20%">Price Each</th> <th width="20%">Price Total</th> <th width="10%">Links</th> </tr> '; $q = $db->query("SELECT im.`imPRICE`,`imQTY`,`imCURRENCY`,`imADDER`,`imID`, i.`itmid`,`itmname`, u.`userid`,`username`, it.`itmtypename` FROM `itemmarket` im LEFT JOIN `items` i ON im.`imITEM` = i.`itmid` LEFT JOIN `users` u ON u.`userid` = im.`imADDER` LEFT JOIN `itemtypes` it ON i.`itmtype` = it.`itmtypeid` ORDER BY i.`itmtype`, i.`itmname`, u.`username` ASC"); $cblah = 1; $lt = ''; while ( $r = $db->fetch_row($q) ) { if ( $lt != $r['itmtypename'] ) { $lt = $r['itmtypename']; echo ' <tr> <th colspan="5" align="center">'.$lt.'</th> </tr> '; } $ctprice = ($r['imPRICE'] * $r['imQTY']); if($r['imCURRENCY'] == "main") { $price = money_formatter($r['imPRICE'], '$'); $tprice = money_formatter($ctprice, '$'); } else { $price = number_format($r['imPRICE'])." ".$set['second_currency']; $tprice = number_format($ctprice)." ".$set['second_currency']; } if($r['imADDER'] == $userid) { $link = "[<a href='".gen_url('itemmarket',true)."&action=remove&ID={$r['imID']}'>Remove</a>]"; } else { $link = "[<a href='".gen_url('itemmarket',true)."&action=buy&ID={$r['imID']}'>Buy</a>] [<a href='".gen_url('itemmarket',true)."&action=gift1&ID={$r['imID']}'>Gift</a>]"; } echo ' <tr> <td><a href="'.gen_url('viewuser',true).'&u='.$r['userid'].'">'.$r['username'].'</a> ['.$r['userid'].']</td> <td><a href="'.gen_url('iteminfo',true).'&ID='.$r['itmid'].'">'.$r['itmname'].'</a> '; if ($r['imQTY'] > 1) { echo ' x'.$r['imQTY']; } echo ' </td> <td>'.$price.'</td> <td>'.$tprice.'</td> <td>'.$link.' '; if($ir['user_level'] == '2') { echo ' <br> [<a href="?action=quantify&ID='.$r['imID'].'">Merge</a>] '; } echo ' </td> </tr> '; } echo ' </table> '; } function itemm_remove() { global $db,$ir,$userid,$h,$set; $_GET['ID'] = ( isset($_GET['ID'])&&is_numeric($_GET['ID']) )?abs(intval($_GET['ID'])):''; if ( empty($_GET['ID']) ) { echo 'Something went wrong.<br />> <a href="'.gen_url('itemmarket',true).'" alt="Go Back" title="Go Back">Go Back</a>'; die($h->endpage()); } $q = $db->query("SELECT im.`imITEM`, `imQTY`, `imADDER`, `imID`, i.`itmname` FROM `itemmarket` im LEFT JOIN `items` i ON im.`imITEM`=i.`itmid` WHERE im.`imID` = {$_GET['ID']} AND im.`imADDER` = $userid"); if(!$db->num_rows($q)) { echo "Error, either this item does not exist, or you are not the owner. <br /> <a href='".gen_url('itemmarket',true)."'>> Back</a> "; die($h->endpage()); } $r = $db->fetch_row($q); item_add($userid, $r['imITEM'], $r['imQTY']); $i = ($db->insert_id()) ? $db->insert_id() : 99999; $db->query("DELETE FROM `itemmarket` WHERE `imID`={$_GET['ID']}"); $db->query("INSERT INTO `imremovelogs` VALUES ('', {$r['imITEM']}, {$r['imADDER']}, $userid, {$r['imID']}, $i, unix_timestamp(), '{$ir['username']} removed {$r['itmname']} x {$r['imQTY']} from the item market.')"); echo ' Item removed from market! <br /> <a href="'.gen_url('itemmarket',true).'">> Back</a> '; } function item_buy() { global $db,$ir,$c,$userid,$h,$set; $_GET['ID'] = ( isset($_GET['ID'])&&is_numeric($_GET['ID']) )?abs(intval($_GET['ID'])):''; $_POST['QTY'] = ( isset($_POST['QTY'])&&is_numeric($_POST['QTY']) )?abs(intval($_POST['QTY'])):''; if ( $_GET['ID'] AND !$_POST['QTY'] ) { $q = $db->query("SELECT im.`imADDER`, `imCURRENCY`, `imPRICE`, `imQTY`, `imITEM`, `imID`, i.`itmname` FROM `itemmarket` im LEFT JOIN `items` i ON i.`itmid` = im.`imITEM` WHERE im.`imID`={$_GET['ID']}"); $r = $db->fetch_row($q); echo ' Enter how many <b>'.$r['itmname'].'</b> you want to buy. <br> There is <b>'.$r['imQTY'].'</b> available. <br> <form action="'.gen_url('itemmarket',true).'&action=buy&ID='.$_GET['ID'].'" method="post"> Quantity: <input type="text" name="QTY" value=""> <br> <input type="submit" value="Buy"> </form> '; } elseif ( !$_GET['ID'] ) { echo 'Invalid use of file.'; } else { $q = $db->query("SELECT im.`imADDER`, `imCURRENCY`, `imPRICE`, `imQTY`, `imITEM`, `imID`, i.`itmname` FROM `itemmarket` im LEFT JOIN `items` i ON i.`itmid` = im.`imITEM` WHERE im.`imID`={$_GET['ID']}"); if ( !$db->num_rows($q) ) { echo ' Error, either this item does not exist, or it has already been bought. <br /> > <a href="'.gen_url('itemmarket',true).'">Back</a> '; die($h->endpage()); } $r = $db->fetch_row($q); if($r['imADDER'] == $userid) { echo ' Error, you cannot buy you\'re own items.<br> > <a href="'.gen_url('itemmarket',true).'">Back</a> '; die($h->endpage()); } if($_GET['ID'] AND $_POST['QTY']) { $curr = $r['imCURRENCY']; $r['imPRICE'] = $r['imPRICE']*$_POST['QTY']; } if($r['imPRICE'] > $ir[$curr]) { echo ' Error, you do not have the funds to buy this item. <br /> > <a href="'.gen_url('itemmarket',true).'">Back</a> '; die($h->endpage()); } if($_POST['QTY'] > $r['imQTY']) { echo ' Error, you cannot buy more than <b>'.$r['imQTY'].' '.$r['itmname'].'(s)</b> <br> > <a href="'.gen_url('itemmarket',true).'&action=buy&ID='.$_GET['ID'].'">Back</a> '; die($h->endpage()); } item_add($userid, $r['imITEM'], $_POST['QTY']); $i = ($db->insert_id()) ? $db->insert_id() : 99999; if($_POST['QTY'] == $r['imQTY']) { $db->query("DELETE FROM `itemmarket` WHERE `imID` = {$_GET['ID']}"); } elseif ( $_POST['QTY'] < $r['imQTY'] ) { $db->query('UPDATE `itemmarket` SET `imQTY` = `imQTY` - '.$_POST['QTY'].' WHERE imID= '.$_GET['ID']); } $db->query("UPDATE `users` SET `$curr` = `$curr` - {$r['imPRICE']} WHERE `userid` = $userid"); $db->query("UPDATE `users` SET `$curr` = `$curr` + {$r['imPRICE']} WHERE `userid` = {$r['imADDER']}"); if($curr=="main") { event_add($r['imADDER'],"<a href='".gen_url('viewuser',true)."&u=$userid'>{$ir['username']}</a> bought your {$r['itmname']} item from the market for \$".number_format($r['imPRICE']).".",$c); $db->query("INSERT INTO `imbuylogs` VALUES ('', {$r['imITEM']}, {$r['imADDER']}, $userid, {$r['imPRICE']}, {$r['imID']}, $i, unix_timestamp(), '{$ir['username']} bought {$r['itmname']} x{$r['imQTY']} from the item market for \${$r['imPRICE']} from user ID {$r['imADDER']}')"); echo " You bought the {$r['itmname']} x{$_POST['QTY']} from the market for \$".number_format($r['imPRICE'])."."; } else { event_add($r['imADDER'],"<a href='".gen_url('viewuser',true)."&u=$userid'>{$ir['username']}</a> bought your {$r['itmname']} item from the market for ".number_format($r['imPRICE'])." ".$set['second_currency'].".",$c); $db->query("INSERT INTO `imbuylogs` VALUES ('', {$r['imITEM']}, {$r['imADDER']}, $userid, {$r['imPRICE']}, {$r['imID']}, $i, unix_timestamp(), '{$ir['username']} bought {$r['itmname']} x{$r['imQTY']} from the item market for {$r['imPRICE']} {$set['second_currency']} from user ID {$r['imADDER']}')"); echo " You bought the {$r['itmname']} x{$_POST['QTY']} from the market for ".number_format($r['imPRICE'])." ".$set['second_currency'].". "; } } } function item_gift1() { global $db,$ir,$c,$userid,$h,$set; $_GET['ID'] = ( isset($_GET['ID'])&&is_numeric($_GET['ID']) )?abs(intval($_GET['ID'])):''; if ( empty($_GET['ID']) ) { echo 'Something went wrong.<br />> <a href="'.gen_url('itemmarket',true).'" alt="Go Back" title="Go Back">Go Back</a>'; die($h->endpage()); } $q = $db->query("SELECT im.`imCURRENCY`, `imPRICE`, `imQTY`, i.`itmname` FROM `itemmarket` im LEFT JOIN `items` i ON i.`itmid` = im.`imITEM` WHERE im.`imID` = {$_GET['ID']}"); if ( !$db->num_rows($q) ) { echo " Error, either this item does not exist, or it has already been bought. <br /> > <a href='".gen_url('itemmarket',true)."'>Back</a> "; die($h->endpage()); } $r = $db->fetch_row($q); $curr = $r['imCURRENCY']; if ( $r['imPRICE'] > $ir[$curr] ) { echo ' Error, you do not have the funds to buy this item. <br /> > <a href="'.gen_url('itemmarket',true).'">Back</a> '; die($h->endpage()); } if ( $curr == "main" ) { echo " Buying the <b>{$r['itmname']}</b> for \$".number_format($r['imPRICE'])." each as a gift. <br /> There is <b>{$r['imQTY']}</b> available. <br /> <form action='".gen_url('itemmarket',true)."&action=gift2' method='post'> <input type='hidden' name='ID' value='{$_GET['ID']}' /> User to give gift to: ".user_dropdown($c,'user')." <br /> Quantity: <input type='text' name='QTY' value=''> <br /> <input type='submit' value='Buy Item and Send Gift' /> </form> "; } else { echo " Buying the <b>{$r['itmname']}</b> for ".number_format($r['imPRICE'])." ".$set['second_currency']." each as a gift. <br /> There is <b>{$r['imQTY']}</b> available. <br /> <form action='".gen_url('itemmarket',true)."&action=gift2' method='post'> <input type='hidden' name='ID' value='{$_GET['ID']}' /> User to give gift to: ".user_dropdown($c,'user')." <br /> Quantity: <input type='text' name='QTY' value=''> <br /> <input type='submit' value='Buy Item and Send Gift' /> </form> "; } } function item_gift2() { global $db,$ir,$c,$userid,$h,$set; $_POST['QTY'] = ( isset($_POST['QTY'])&&is_numeric($_POST['QTY']) )?abs(intval($_POST['QTY'])):''; $_POST['user'] = ( isset($_POST['user'])&&is_numeric($_POST['user']) )?abs(intval($_POST['user'])):''; $_POST['ID'] = ( isset($_POST['ID'])&&is_numeric($_POST['ID']) )?abs(intval($_POST['ID'])):''; if ( (empty($_POST['ID']) OR empty($_POST['user']) OR empty($_POST['QTY'])) ) { echo 'Something went wrong.<br />> <a href="'.gen_url('itemmarket',true).'" alt="Go Back" title="Go Back">Go Back</a>'; die($h->endpage()); } $query_user_exist = $db->query("SELECT `userid` FROM `users` WHERE `userid` = {$_POST['user']}"); if ( $db->num_rows($query_user_exist) == 0 ) { echo ' User doesn\'t exist. <br /> > <a href="'.gen_url('itemmarket',true).'">Back</a> '; die($h->endpage()); } $q = $db->query("SELECT im.`imADDER`, `imCURRENCY`, `imPRICE`, `imQTY`, `imITEM`, `imID`, i.`itmname` FROM `itemmarket` im LEFT JOIN `items` i ON i.`itmid` = im.`imITEM` WHERE im.`imID` = {$_POST['ID']}"); if ( !$db->num_rows($q) ) { echo ' Error, either this item does not exist, or it has already been bought. <br /> > <a href="'.gen_url('itemmarket',true).'">Back</a> '; die($h->endpage()); } $r = $db->fetch_row($q); if($r['imADDER'] == $userid) { echo ' Error, you cannot buy you\'re own items.<br> > <a href="'.gen_url('itemmarket',true).'">Back</a> '; die($h->endpage()); } $curr = $r['imCURRENCY']; $r['imPRICE'] = $r['imPRICE']*$_POST['QTY']; if($r['imPRICE'] > $ir[$curr]) { echo " Error, you do not have the funds to buy this item. <br /> > <a href='".gen_url('itemmarket',true)."'>Back</a> "; die($h->endpage()); } if($_POST['QTY'] > $r['imQTY']) { echo ' Error, you cannot buy more than <b>'.$r['imQTY'].' '.$r['itmname'].'(s)</b> <br> > <a href="'.gen_url('itemmarket',true).'&action=buy&ID='.$_POST['ID'].'">Back</a> '; die($h->endpage()); } item_add($_POST['user'], $r['imITEM'], $_POST['QTY']); $i = ($db->insert_id()) ? $db->insert_id() : 99999; if ( $_POST['QTY'] == $r['imQTY'] ) { $db->query("DELETE FROM `itemmarket` WHERE `imID` = {$_POST['ID']}"); } elseif ( $_POST['QTY'] < $r['imQTY'] ) { $db->query('UPDATE `itemmarket` SET `imQTY` = `imQTY` - '.$_POST['QTY'].' WHERE `imID` = '.$_POST['ID']); } $db->query("UPDATE `users` SET `$curr` = `$curr` - {$r['imPRICE']} WHERE `userid`= $userid"); $db->query("UPDATE `users` SET `$curr` = `$curr` + {$r['imPRICE']} where `userid` = {$r['imADDER']}"); if($curr=="main") { event_add($r['imADDER'],"<a href='".gen_url('viewuser',true)."&u=$userid'>{$ir['username']}</a> bought your {$r['itmname']} x{$_POST['QTY']} item(s) from the market for \$".number_format($r['imPRICE']).".",$c); event_add($_POST['user'], "<a href='".gen_url('viewuser',true)."&u=$userid'>{$ir['username']}</a> bought you {$r['itmname']} x{$_POST['QTY']} from the item market as a gift.",$c); $u = $db->query("SELECT `username` FROM `users` WHERE `userid` = {$_POST['user']}"); $uname = $db->fetch_single($u); $db->query("INSERT INTO `imbuylogs` VALUES ('', {$r['imITEM']}, {$r['imADDER']}, $userid, {$r['imPRICE']}, {$r['imID']}, $i, unix_timestamp(), '{$ir['username']} bought {$r['itmname']} x{$r['imQTY']} from the item market for \${$r['imPRICE']} from user ID {$r['imADDER']} as a gift for $uname [{$_POST['user']}]')"); echo " You bought the {$r['itmname']} from the market for \$".number_format($r['imPRICE'])." and sent the gift to $uname. "; } else { event_add($r['imADDER'],"<a href='".gen_url('viewuser',true)."&u=$userid'>{$ir['username']}</a> bought your {$r['itmname']} x{$_POST['QTY']} item(s) from the market for ".number_format($r['imPRICE'])." ".$set['second_currency'].".",$c); event_add($_POST['user'], "<a href='".gen_url('viewuser',true)."&u=$userid'>{$ir['username']}</a> bought you {$r['itmname']} x{$_POST['QTY']} from the item market as a gift.",$c); $u = $db->query("SELECT `username` FROM `users` WHERE `userid` = {$_POST['user']}"); $uname = $db->fetch_single($u); $db->query("INSERT INTO `imbuylogs` VALUES ('', {$r['imITEM']}, {$r['imADDER']}, $userid, {$r['imPRICE']}, {$r['imID']}, $i, unix_timestamp(), '{$ir['username']} bought {$r['itmname']} x{$r['imQTY']} from the item market for {$r['imPRICE']} ".$set['second_currency']." from user ID {$r['imADDER']} as a gift for $uname [{$_POST['user']}]')"); echo " You bought the {$r['itmname']} x{$_POST['QTY']} from the market for ".number_format($r['imPRICE'])." ".$set['second_currency']." and sent the gift to $uname. "; } } $h->endpage(); ?>
  13. imadd.php   <?php /* Engine: MC V2.5 (Redux) File: imadd.php Author: mccodes.com */ if ( !defined($_CONFIG['define_code']) ) { echo 'This file cannot be accessed directly.'; exit; } $_GET['ID'] = ( isset($_GET['ID'])&&is_numeric($_GET['ID']) )?abs(intval($_GET['ID'])):''; $_GET['price'] = ( isset($_GET['price'])&&is_numeric($_GET['price']) )?abs(intval($_GET['price'])):''; $_GET['QTY'] = ( isset($_GET['QTY'])&&is_numeric($_GET['QTY']) )?abs(intval($_GET['QTY'])):''; $_GET['currency'] = ( isset($_GET['currency']) && in_array($_GET['currency'], array('main','second')) )?$_GET['currency']:'main'; if ( $_GET['price'] && $_GET['QTY'] && $_GET['ID'] ) { $q=$db->query("SELECT iv.`inv_qty`, `inv_itemid`, `inv_id`, i.`itmname` FROM inventory iv LEFT JOIN items i ON iv.inv_itemid=i.itmid WHERE inv_id={$_GET['ID']} and inv_userid=$userid"); if($db->num_rows($q) == 0) { echo "Invalid Item ID"; } else { $r = $db->fetch_row($q); if ( $r['inv_qty'] < $_GET['QTY'] ) { echo 'You do not have enough of this item.'; $h->endpage(); exit; } $checkq = $db->query('SELECT `imID` FROM `itemmarket` WHERE `imITEM` = '.$r['inv_itemid'].' AND `imPRICE` = "'.$_GET['price'].'" AND `imADDER` = '.$userid.' AND `imCURRENCY` = "'.$_GET['currency'].'"'); if ( $db->num_rows($checkq) ) { $cqty = $db->fetch_row($checkq); $query = sprintf('UPDATE `itemmarket` SET imQTY = imQTY + %u WHERE imID = %u', $_GET['QTY'], $cqty['imID']); $db->query($query); } else { $db->query("INSERT INTO itemmarket VALUES ('','{$r['inv_itemid']}',$userid,{$_GET['price']}, '{$_GET['currency']}', '{$_GET['QTY']}')"); } item_remove($userid, $r['inv_itemid'], $_GET['QTY']); $db->query("INSERT INTO imarketaddlogs VALUES ( '', {$r['inv_itemid']}, {$_GET['price']}, {$r['inv_id']}, $userid, unix_timestamp(), '{$ir['username']} added {$r['itmname']} x{$_GET['QTY']} to the itemmarket for {$_GET['price']} {$_GET['currency']}')"); echo "Item added to market."; } } else { if ( empty($_GET['ID']) ) { echo 'A error occured, please go back and try again.'; die($h->endpage()); } $q = $db->query("SELECT `inv_id` FROM `inventory` WHERE `inv_id` = {$_GET['ID']} AND `inv_userid` = $userid"); if ( $db->num_rows($q) == 0 ) { echo 'Invalid Item ID'; } else { echo ' Adding an item to the item market... <form action="index.php" method="get"> '.gen_url('imadd','hidden').' <input type="hidden" name="ID" value="'.$_GET['ID'].'" /> <br> Quantity: <input type="text" name="QTY" value=""> <br> Price: <input type="text" name="price" value="0" /> <br> <select name="currency" type="dropdown"> <option value="main">'.$set['main_currency'].'</option> <option value="second">'.$set['second_currency'].'</option> </select> <br /> <input type="submit" value="Add" /> </form> '; } } $h->endpage(); ?>
  14. when adding a item to the market you have 2 options 1 money 2 crystals. well players select money and then they post item. when you go to item market it only shows in crystals. and when u have a load of crystals to buy that item you cant, due to "Error, you do not have the funds to buy this item. ". if anyone can help it would be great full.
  15. You can set them up and what no, but when the gang does the crime there are no events or you dont pass or fail it. This is one of my last problems with redux then its all patched :D
×
×
  • Create New...