-
Posts
739 -
Joined
-
Last visited
-
Days Won
41
Content Type
Profiles
Forums
Events
Everything posted by peterisgb
-
mccode-v2 Shops item stock - as requested (Not Tested)
peterisgb replied to radio_active's topic in Free Modifications
Fixed. Fiddled around with it. <?php include "globals.php"; $_GET['ID'] = (isset($_GET['ID']) AND !ereg('[^0-9]', $_GET['ID'])) ? abs(@intval($_GET['ID'])) : FALSE ; $_GET['shop'] = (isset($_GET['shop']) AND !ereg('[^0-9]', $_GET['shop'])) ? abs(@intval($_GET['shop'])) : FALSE ; $_GET['qty'] = (isset($_GET['qty']) AND !ereg('[^0-9]', $_GET['qty'])) ? abs(@intval($_GET['qty'])) : FALSE ; if(!$_GET['ID'] || !$_POST['qty']) { echo "Invalid use of file"; } else if($_POST['qty'] <= 0) { echo "You have been added to the delete list for trying to cheat the game."; } else { $q = $db->query(sprintf("SELECT `itmid`,`itmtype`,`itmname`,`itmbuyprice`,`itmbuyable` FROM items WHERE itmid=('%d')", $_GET['ID'])); $b = $db->query(sprintf("SELECT sitemID,sitemQTY FROM shopitems WHERE sitemITEMID = ('%d')", $_GET['ID'])); if(mysql_num_rows($q) == 0) { echo "Invalid item ID"; } else { $itemd = mysql_fetch_assoc($q); $qty = mysql_fetch_assoc($b); if($ir['money'] < $itemd['itmbuyprice']*$_POST['qty']) { echo "You don't have enough money to buy this item!"; $h->endpage(); exit; } if($itemd['itmbuyable'] == 0) { echo "This item can't be bought!"; $h->endpage(); exit; } if($qty['sitemQTY'] <= 0) { echo "This item is out of stock, you will have to wait for a new shipment"; $h->endpage(); exit; } if($qty['sitemQTY'] < $_POST['qty']) { echo "There isn't enough items in stock to purchase that quantity"; $h->endpage(); exit; } $price = ($itemd['itmbuyprice'] * $_POST['qty']); item_add($userid, $_GET['ID'], $_POST['qty']); $db->query("UPDATE `users` SET `money` = money - ('%d') WHERE `userid` = ('%d')", $price, $userid); $db->query("UPDATE shopitems SET sitemQTY=sitemQTY-{$_POST['qty']} WHERE sitemITEMID='{$_GET['ID']}' "); echo "You bought {$_POST['qty']} {$itemd['itmname']}(s) for \$$price"; } } $h->endpage(); ?> -
mccode-v2 Shops item stock - as requested (Not Tested)
peterisgb replied to radio_active's topic in Free Modifications
i dont even know how to debug, how to you print a qty array? -
mccode-v2 Shops item stock - as requested (Not Tested)
peterisgb replied to radio_active's topic in Free Modifications
This still presents the same error. you can still buy 50 of X item when there is only 20 stock ending total stock being -30 <- it shouldnt go negative nor should it allow to be negative. -
mccode-v2 Shops item stock - as requested (Not Tested)
peterisgb replied to radio_active's topic in Free Modifications
i know this is old but its good, i;m having a little problem, it all works except to the point where you cant buy no more items as there aint none, well it dont happen, it just lets you buy more making the Shop qty into negative, This is what i have so far. <?php include "globals.php"; $_GET['ID'] = (isset($_GET['ID']) AND !ereg('[^0-9]', $_GET['ID'])) ? abs(@intval($_GET['ID'])) : FALSE ; $_GET['shop'] = (isset($_GET['shop']) AND !ereg('[^0-9]', $_GET['shop'])) ? abs(@intval($_GET['shop'])) : FALSE ; $_GET['qty'] = (isset($_GET['qty']) AND !ereg('[^0-9]', $_GET['qty'])) ? abs(@intval($_GET['qty'])) : FALSE ; if(!$_GET['ID'] || !$_POST['qty']) { echo "Invalid use of file"; } else if($_POST['qty'] <= 0) { echo "You have been added to the delete list for trying to cheat the game."; } else { $q = $db->query(sprintf("SELECT `itmid`,`itmtype`,`itmname`,`itmbuyprice`,`itmbuyable` FROM items WHERE itmid=('%d')", $_GET['ID'])); $b = $db->query(sprintf("SELECT sitemID,sitemQTY FROM shopitems WHERE sitemITEMID = ('%d')", $_GET['ID'])); if(mysql_num_rows($q) == 0) { echo "Invalid item ID"; } else { $itemd = mysql_fetch_assoc($q); $qty = mysql_fetch_assoc($b); if($ir['money'] < $itemd['itmbuyprice']*$_POST['qty']) { echo "You don't have enough money to buy this item!"; $h->endpage(); exit; } if($itemd['itmbuyable'] == 0) { echo "This item can't be bought!"; $h->endpage(); exit; } if($qty['sitemQTY'] < 0) { echo "This item is out of stock, you will have to wait for a new shipment"; $h->endpage(); exit; } if($qty['sitemQTY'] < $_GET['qty']) { echo "There isn't enough items in stock to purchase that quantity"; $h->endpage(); exit; } $price = ($itemd['itmbuyprice'] * $_POST['qty']); item_add($userid, $_GET['ID'], $_POST['qty']); $db->query("UPDATE `users` SET `money` = money - ('%d') WHERE `userid` = ('%d')", $price, $userid); $db->query("update shopitems set sitemQTY=sitemQTY-{$_POST['qty']} WHERE sitemITEMID='{$_GET['ID']}' "); echo "You bought {$_POST['qty']} {$itemd['itmname']}(s) for \$$price"; } } $h->endpage(); ?> -
wrong thread mate.
-
this is pretty good, for me i didnt let the users choose what team they could join as they would all join one team which would make it unfair on the other team so i didnt let the user choose. makes it more fair
-
well i didnt know anyway of dividing all the users into 2 groups.
-
Now just need to get this thread deleted, dont want to many people to steal my idea lol
-
ok it does work, i was doing it wrong, lol, thanks so much for this, great help guys. spent about 2 weeks trying to get this to work, my final option was to seek help here lol, thanks
-
so if i am right it should be like if (isset ($_GET["buy"]) && $_GET["buy"] == "odd") $db->query("SELECT * FROM users WHERE MOD( userid, 2 ) =1"); else $q=$db->query('SELECT * FROM `users` WHERE ( `userid` % 2 = '.( array_key_exists ( 'odd', $_GET ) ? 1 : 0 ).' )'); because if its this it shows evens either way
-
yeah, it sounds like an idea, however, my coding skills are quite limited at the moment, haven't quite got the nak of switch functions yet.
-
figured it out, i just looked at it. $q=$db->query('SELECT `username` FROM `users` WHERE ( `userid` % 2 = '.( array_key_exists ( 'odd', $_GET ) ? 1 : 0 ).' )'); changed that to this $q=$db->query('SELECT * FROM `users` WHERE ( `userid` % 2 = '.( array_key_exists ( 'odd', $_GET ) ? 1 : 0 ).' )'); now how would i go about making it show only odd id's
-
well the page just diplays the users, but nothing else, can't click them or anything, no other information is being taken by the database into the page.
-
well my game runs on all odd ID's are hackers and all even ID's are police. they fight eachother gaining points for there team. hackers vs police, its become quite successfull for me, but users are saying that they would like a page displaying all the users in the opposite team, i think it would be a good thing to have for me theme
-
the idea is its suppose to be like the normal userlist page, but when clicking odd/even in the selection list it displays evens and odds.
-
that kinda works, defo shows users, but all id's and links dont work. just displays username
-
I've tried to edit this page to get it to show only even or odd id's but i ain't doing something right, could i have a little help with this please. ty <?php include "globals.php"; global $db,$ir,$c,$userid,$h; $db->query("UPDATE users SET lastpage='Userlist' WHERE userid=$userid"); $_GET['st'] = abs((int) $_GET['st']); $st=($_GET['st']) ? $_GET['st'] : 0; $by=($_GET['by']) ? $_GET['by'] : 'userid'; $ord=($_GET['ord']) ? $_GET['ord'] : 'ASC'; $cnt=mysql_query("SELECT userid FROM users",$c); $membs=mysql_num_rows($cnt); $pages=(int) ($membs/100)+1; if($membs % 100 == 0) { $pages--; } print "Pages: "; for($i=1;$i <= $pages;$i++) { $stl=($i-1)*100; print "<a href='userlist.php?st=$stl&by=$by&ord=$ord'>$i</a> "; } print "<br /> Order By: <a href='userteam.php?st=$st&by=userid&ord=$ord'>User ID</a> | <a href='userteam.php?st=$st&by=username&ord=$ord'>Username</a> | <a href='userteam.php?st=$st&by=Even&ord=$ord'>Even users</a> | <a href='userteam.php?st=$st&by=Odd&ord=$ord'>Odd Users</a> | <a href='userteam.php?st=$st&by=level&ord=$ord'>Level</a> | <a href='userteam.php?st=$st&by=gymlevel&ord=$ord'>Gym Level</a><br /> <a href='userteam.php?st=$st&by=$by&ord=asc'>Ascending</a> | <a href='userteam.php?st=$st&by=$by&ord=desc'>Descending</a><br /><br /> "; print "<h3>Userlist</h3>"; $q=$db->query = 'SELECT `username` FROM `users` WHERE ( `userid` % 2 = '.( array_key_exists ( 'odd', $_GET ) ? 1 : 0 ).' ))'; $no1=$st+1; $no2=$st+100; print "Showing users $no1 to $no2 by order of $by $ord. <table width=90% cellspacing=1 class='table'> <tr style='background:gray'> <th>ID</th> <th>Links</th> <th>Name</th> <th>Level</th> <th>Gym Level</th> <th>Smoking Level</th> <th>Gender</th> <th>Race</th> <th>Online</th> </tr>"; while($r=$db->fetch_row($q)) { $d=""; if($r['donatordays']) { $r['username'] = "<font color='{$r['colour']}'>{$r['username']}</font>";$d="<img src='donator.gif' alt='Donator: {$r['donatordays']} Days Left' title='Donator: {$r['donatordays']} Days Left' />"; } $name=$r['username']; if($r['user_level']== 2) { $staff="<img src='images/owner.gif' alt='Game Staff' />"; } if($r['user_level']== 3) { $staff="<img src='images/owner.gif' alt='Game Staff' />"; } if($r['user_level']== 4) { $staff="<img src='images/owner.gif' alt='Game Staff' />"; } if($r['user_level']== 5) { $staff="<img src='images/owner.gif' alt='Game Staff' />"; } if($r['user_level']== 1) { $staff=""; } if($r['userid']==1) { $staff="<img src='images/owner.gif' alt='Game Staff' /><img src='images/admin.gif' alt='Game Owner' />"; } if ($r['sidename'] == 0) { $sides="N/A"; } if ($r['sidename'] == 1) { $sides="<img src='hacker.gif' title='Hackers' width='15' height='15'><b> <u><font color='cadetblue'>Hackers</font></u></b>"; } if ($r['sidename'] == 2) { $sides="<img src='police.gif' title='Police' width='15' height='15'><b> <u><font color='red'>Police</font></u></b>"; } print " <tr> <td>{$r['userid']}</td> <td><small>[<a href='viewuser.php?u={$r['userid']}'>View</a>] [<a href='attack.php?ID={$r['userid']}'>Attack</a>] [<a href='mailbox.php?action=compose&ID={$r['userid']}'>Mail</a>]</small></td> <td><a href='viewuser.php?u={$r['userid']}'>{$r['gangPREF']} <font color='{$r['colour']}'> {$r['username']} </font> $d $staff</a></td> <td>{$r['level']}</td> <td>{$r['gymlevel']}</td> <td>{$r['smoking']}</td> <td>{$r['gender']}</td> <td>{$r['race']}</td><td>"; if($r['laston'] >= time()-15*60) { print "<font color=green><b><img src='images/online.png'></b></font>"; } else { print "<font color=red><b><img src='images/offline.png'></b></font>"; } print "</td></tr>"; } print "</table>"; $h->endpage(); ?>
-
oh right, a dumb moment haha, nice work.
-
mccode-v2 Advanced Attack and Inventory Mod--One Click.
peterisgb replied to Joshua's topic in Free Modifications
i know that this mod is a old mod but i noticed one thing that was never mentioned in this whole thread and that is unequip the items. so i edited mine and here it is <?php include "globals.php"; if(!in_array($_GET['type'], array("equip_primary", "equip_secondary", "equip_armor", "equip_boots", "equip_helmet", "equip_breastplate", "equip_ring", "equip_leggings"))) { print "This slot ID is not valid."; $h->endpage(); exit; } if(!$ir[$_GET['type']]) { print "You do not have anything equipped in this slot."; $h->endpage(); exit; } item_add($userid, $ir[$_GET['type']], 1); $db->query("UPDATE users SET {$_GET['type']}=0 WHERE userid={$ir['userid']}"); $names=array( "equip_primary" => "Primary Weapon", "equip_secondary" => "Secondary Weapon", "equip_armor" => "Armor", "equip_boots" => "Boots", "equip_helmet" => "Helmet", "equip_breastplate" => "Breast Plates", "equip_ring" => "Gloves", "equip_leggings" => "Leggings", ); $equip=array( "equip_primary" => "primaryloaned", "equip_secondary" => "secondaryloaned", "equip_armor" => "armorloaned", ); mysql_query("UPDATE users SET {$equip[$_GET['type']]}=0 WHERE userid=$userid",$c); print "The item in your {$names[$_GET['type']]} slot was successfully unequiped."; $h->endpage(); ?> I'm not very good at this but i am surprised to notice not one person ever mentioning removing the items. -
and idea for you gallery, this will be a must see.
-
i was able to copy it perfectly fine with no problems. I've Zipped it for users who can't copy. http://www.vote.infamous-wars.com/download/
-
This is a very good mod. much better than the default page.
-
ty to you both Djkanna, your a star, Sniko, ty for teaching me a little
-
where do i put this, i tried the staff_items page. at the top it show its been credited to userid1 but its doesnt credit it.
-
that easy, thanks very much Sniko, nice work.