Jump to content
MakeWebGames

eracing69

Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Everything posted by eracing69

  1. Re: [mccode] [TGM] Crystal Market Logs [TGM] I got this working VERY good, thanks Cronus! +1 :mrgreen:
  2. Re: [mccode] [TGM] Crystal Market Logs [TGM] This is the code on the file. 1. Add the following line to the crystal market page where the users actually receive the stuff: mysql_query("INSERT INTO clogs VALUES('',$userid,{$r['cmADDER']},{$r['cmQTY']},{$r['cmPRICE']},unix_timestamp());",$c);   2. Put in the mysql dump. 3. Insert the following as a function to your assistant/secretary/admin panels. Make sure to link to it and make a case; break; thing for it:   function view_crystal_logs() { global $ir,$c,$h,$userid; print "<h3>Crystal Market Logs</h3> <table width=75% border=1> <tr style='background:gray'> <th>ID</th> <th>Time</th> <th>Buyer</th> <th>Seller</th> <th>Quantity</th> <th>Total Cost</th></tr>"; $q=mysql_query("SELECT * FROM clogs ORDER BY clogTIME DESC",$c); while($r=mysql_fetch_array($q)) { $t=mysql_query("SELECT * FROM users WHERE userid={$r['clogSELLER']}",$c); $seller=mysql_fetch_array($t); $t=mysql_query("SELECT * FROM users WHERE userid={$r['clogBUYER']}",$c); $buyer=mysql_fetch_array($t); print"<tr><td>{$r['clogID']}</td> <td>".date('F j, Y, g:i:s a',$r['clogTIME'])."</td><td>[url='viewuser.php?u={$buyer[']{$buyer['username']}[/url]</td><td>[url='viewuser.php?u={$seller[']{$seller['username']}[/url]</td> <td>{$r['clogCRYSTALS']}</td> <td> \${$r['clogCOST']}</td></tr>"; } }     <?php /*----------------------------------------------------- -- Mono Country v1.0 BETA -- A product of DBS-entertainment -- Copyright held 2005 by Dabomstew -- INDEX.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); $h->menuarea(); print "<h3>Crystal Market</h3>"; switch($_GET['action']) { case "buy": crystal_buy(); break; case "remove": crystal_remove(); break; case "add": crystal_add(); break; default: cmarket_index(); break; } function cmarket_index() { global $ir,$c,$userid,$h; print "[url='cmarket.php?action=add']> Add A Listing[/url] (price limit is $100,000 each) Viewing all listings... <table width=75%> <tr style='background:gray'> <th>Adder</th> <th>Qty</th> <th>Price each</th> <th>Price total</th> <th>Links</th> </tr>"; $q=mysql_query("SELECT cm.*, u.* FROM crystalmarket cm LEFT JOIN users u ON u.userid=cm.cmADDER ORDER BY cmPRICE/cmQTY ASC",$c); while($r=mysql_fetch_array($q)) { if($r['cmADDER'] == $userid) { $link = "[url='cmarket.php?action=remove&ID={$r[']Remove[/url]"; } else { $link = "[url='cmarket.php?action=buy&ID={$r[']Buy[/url]"; } $each= (int) $r['cmPRICE'] / $r['cmQTY']; print "\n<tr> <td>[url='viewuser.php?u={$r[']{$r['username']}[/url] [{$r['userid']}]</td> <td>{$r['cmQTY']}</td> <td> \$" . number_format($each)."</td> <td>\$".number_format($r['cmPRICE'])."</td> <td>[$link]</td> </tr>"; } print "</table>"; } function crystal_remove() { global $ir,$c,$userid,$h; $q=mysql_query("SELECT * FROM crystalmarket WHERE cmID={$_GET['ID']} AND cmADDER=$userid",$c); if(!mysql_num_rows($q)) { print "Error, either these crystals do not exist, or you are not the owner. [url='cmarket.php']> Back[/url]"; $h->endpage(); exit; } $r=mysql_fetch_array($q); mysql_query("UPDATE users SET crystals=crystals+{$r['cmQTY']} where userid=$userid",$c) or die(mysql_error()); mysql_query("DELETE FROM crystalmarket WHERE cmID={$_GET['ID']}",$c); print "Crystals removed from market! [url='cmarket.php']> Back[/url]"; } function crystal_buy() { global $ir,$c,$userid,$h; $q=mysql_query("SELECT * FROM crystalmarket cm WHERE cmID={$_GET['ID']}",$c); if(!mysql_num_rows($q)) { print "Error, either these crystals do not exist, or they have already been bought. [url='cmarket.php']> Back[/url]"; $h->endpage(); exit; } $r=mysql_fetch_array($q); if($r['cmPRICE'] > $ir['money']) { print "Error, you do not have the funds to buy these crystals. [url='cmarket.php']> Back[/url]"; $h->endpage(); exit; } mysql_query("UPDATE users SET crystals=crystals+{$r['cmQTY']} where userid=$userid",$c) or die(mysql_error()); mysql_query("DELETE FROM crystalmarket WHERE cmID={$_GET['ID']}",$c); mysql_query("UPDATE users SET money=money-{$r['cmPRICE']} where userid=$userid",$c); mysql_query("INSERT INTO clogs VALUES('',$userid,{$r['cmADDER']},{$r['cmQTY']},{$r['cmPRICE']});",$c); mysql_query("UPDATE users SET money=money+{$r['cmPRICE']} where userid={$r['cmADDER']}",$c); event_add($r['cmADDER'],"[url='viewuser.php?u=$userid']{$ir['username']}[/url] bought your {$r['cmQTY']} crystals from the market for \$".number_format($r['cmPRICE']).".",$c,'trading'); print "You bought the {$r['cmQTY']} crystals from the market for \$".number_format($r['cmPRICE'])."."; } function crystal_add() { global $ir,$c,$userid,$h; $_POST['amnt'] = abs((int) $_POST['amnt']); $_POST['price'] = abs((int) $_POST['price']); if($_POST['amnt']) { if($_POST['amnt'] > $ir['crystals']) { die ("You are trying to add more crystals to the market than you have. [url='cmarket.php']> Back[/url]"); } else if ( $_POST['price'] > 100000 ) { die ("The maximum you can charge for crystals is $100,000 each [url='cmarket.php']> Back[/url]"); } $tp=$_POST['amnt']*$_POST['price']; mysql_query("INSERT INTO crystalmarket VALUES('',{$_POST['amnt']},$userid,$tp)", $c); mysql_query("UPDATE users SET crystals=crystals-{$_POST['amnt']} WHERE userid=$userid", $c); print "Crystals added to market! [url='cmarket.php']> Back[/url]"; } else { print "[b]Adding a listing...[/b] You have [b]{$ir['crystals']}[/b] crystal(s) that you can add to the market. The most you can ask for per crystal is [b]\$100,000[/b] <form action='cmarket.php?action=add' method='post'><table width=50% border=2><tr> <td>Crystals:</td> <td><input type='text' name='amnt' value='{$ir['crystals']}' /></td></tr><tr> <td>Price Each:</td> <td><input type='text' name='price' value='0' /></td></tr><tr> <td colspan=2 align=center><input type='submit' value='Add To Market' /></tr></table></form>"; } } $h->endpage(); ?>   I'm looking for something like this that I can have on MCCodesV2, anybody has anything available?
  3. Re: Code takes longer than 30 sec to run. Did you have this working properly? I will be interest and I will pay if I have to for the mod.
  4. Re: [mccode] Streets for v2.0 Hi guys... I added this to my game and work good, thanks!!! I have a question, my street is giving to items but when they go to the inventory they dont group together, you get one line for each time you win even been the same item. Any idea what I did wrong?
×
×
  • Create New...