In the admin, you can select the item what will be get on use, with the amount of the item.
<?php
/**********************************************************************************
* SMFShop item - Por LG (Raider-8) *
* Pack de Items *
**********************************************************************************/
if (!defined('SMF'))
die('Hack DETECTED');
class item_pack_items extends itemTemplate
{
function getItemDetails()
{
$this->authorName = 'Raider-8';
$this->authorWeb = '';
$this->authorEmail = 'raider-8@live.com';
$this->name = 'Package of [ITEMS]';
$this->desc = '¡Get X amount of ITEMS!';
$this->price = 0;
$this->require_input = false;
$this->can_use_item = true;
$this->addInput_editable = true;
}
function getAddInput()
{
global $item_info, $smcFunc, $db_prefix;
if(empty($item_info[2])) {
$val = 5;
} else {
$val = $item_info[2];
}
if(!empty($item_info[1])) {
$elector = '<b>[ITEM CAN NOT BE EDITED AFTER CREATED]</b>';
} else {
$elector = '
<select name="info1">';
$results = $smcFunc['db_query']('', "
SELECT *
FROM {db_prefix}shop_items");
while ($row = $smcFunc['db_fetch_assoc']($results))
$elector .= '
<option value="' . $row['id'] . '">' . $row['name'] . '</option>';
$elector .= '
</select>';
}
return 'Item what will contains the package (DO NOT EDITABLE AFTER CREATED): '.$elector.'
<br />
Amount: <input type="text" name="info2" value="'.$val.'"/>
<br />
<hr><center><b>Raider-8 ITEM</b></center>';
}
function onUse()
{
global $context, $db_prefix, $ID_MEMBER, $item_info, $smcFunc;
$cantidad=$item_info[2];
for ($i = 0; $i < $cantidad; $i += 1) {
$sql = $smcFunc['db_query']('', "INSERT INTO {db_prefix}shop_inventory (ownerid,itemid) VALUES ('".$context['user']['id']."','".$item_info[1]."')");
}
return 'Now, you got the '.$cantidad.' items.';
}
}
?>
Excuse me fot the english and the traduction, but i'm spanish.