boionfire81 Posted May 20, 2016 Share Posted May 20, 2016 Does anyone know how to create "packages" so that when opened you get 6x an item, or even multiple items? Quote Link to comment Share on other sites More sharing options...
TheMasterGeneral Posted May 20, 2016 Share Posted May 20, 2016 Yeah! Its quite easy actually. I'm assuming MCCV2, correct? //Assuming MCCV2 $gid = 12; //Item ID to test for. $amounttogive = 6; //Amount of item to give $itemtogive = 1; //Item to give //Check for item id. Make sure to set it in the config area above. $query=$db->query("SELECT `inv_itemid` FROM `inventory` where `inv_itemid` = {$gid} && `inv_userid` = {$userid}"); $i=$db->fetch_row($query); if(!$i['inv_itemid'] == $gid) { print "Item required not found in your inventory. If you think this is incorrect, message an admin."; $h->endpage(); } else { //item_add(user,item,amount); //All parameters are int. item_add($userid,$itemtogive,$amounttogive); //item_remove(user,item,amount); //All parameters are int. item_remove($userid,$gid,1); } Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted May 20, 2016 Author Share Posted May 20, 2016 Yes it is v2. I'm assuming that would go in itemuse.php? If there is more than 1 say "box of goodies" to open. i.e. box of sweets, box of bullets, etc, etc. How would the script be written then? Quote Link to comment Share on other sites More sharing options...
TheMasterGeneral Posted May 20, 2016 Share Posted May 20, 2016 I've personally made a different page for my own custom item use. Here's how I did it with multiple consumer donator packs. if (!isset($_GET['redeem'])) { $_GET['redeem'] = ''; } switch ($_GET['redeem']) { case 'pack1': pack_1(); break; case 'pack2': pack_2(); break; default: dollar_pack_home(); break; } function dollar_pack_home() { die("404"); } function pack_1() { $packid=136; //Item ID $packmoney=50000; //How much money does the user receive? $packddays=30; //Donator days received $packcrystals=50; //Crystals received. $packiq=50; //IQ received global $db, $userid; $query=$db->query("SELECT `inv_itemid` FROM `inventory` where `inv_itemid` = $packid && `inv_userid` = $userid"); $i=$db->fetch_row($query); if(!$i['inv_itemid'] == $packid) { //No pack } else { //etc } } function pack_2() { //Same code above, just tweaked differently. } And on inventory.php; if ($i['itmid'] == $Item) { echo " [<a href='#'>Link</a>]"; } I'm sure there's cleaner ways to do it. Meh. Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted May 20, 2016 Author Share Posted May 20, 2016 ok, so it would link the inventory item id to a get id which would equal the pack id in the code above? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.