Re: [FREE] DPS TO ITEMS V1 [MCCODES] [uPDATED]
For V2:
Run SQL:
INSERT into itemtypes VALUES ('100', 'Donator Packs');
(I used 100 for item id, but you can change that to whatever you'd like.)
In Inventory.php, find
if($i['effect1_on'] || $i['effect2_on'] || $i['effect3_on']) {
print " [[url='itemuse.php?ID={$i[']Use[/url]]";
}
Add Below:
if($i['itmtype'] == '100') {
print " [[url='itemuse.php?ID={$i[']Use[/url]]";
}
The above makes it so you don't need to edit the inventory.php each and every time you add a new donator pack.
In itemuse.php, find
if(!$r['effect1_on'] && !$r['effect2_on'] && !$r['effect3_on'])
{
die("Sorry, this item cannot be used as it has no effect.");
}
and replace with:
if($r['itmname'] == 'Pack 1')
{
$db->query("UPDATE users SET donatordays=donatordays+30 WHERE userid=$userid");
$db->query("UPDATE users SET crystals=crystals+100 WHERE userid=$userid");
$db->query("UPDATE users SET money=money+1500 WHERE userid=$userid");
$db->query("UPDATE userstats SET iq=iq+30 WHERE userid=$userid");
}
else
{
if(!$r['effect1_on'] && !$r['effect2_on'] && !$r['effect3_on'])
{
die("Sorry, this item cannot be used as it has no effect.");
}
}
For all other donator packs, just add (each time):
[code]if($r['itmname'] == 'Pack Name')
{
$db->query("UPDATE users SET donatordays=donatordays+30 WHERE userid=$userid");
$db->query("UPDATE users SET crystals=crystals+100 WHERE userid=$userid");
$db->query("UPDATE users SET money=money+1500 WHERE userid=$userid");
$db->query("UPDATE userstats SET iq=iq+30 WHERE userid=$userid");
}
Finally, open ipn_donator.php, find
if($pack==1)
{
$db->query("UPDATE users u LEFT JOIN userstats us ON u.userid=us.userid SET u.crystals=u.crystals+100,u.donatordays=u.donatordays+30 WHERE u.userid={$for}");
$d=30;
$t="";
}
and change it to:
if($pack==1)
{
$db->query("INSERT INTO inventory VALUES('','1000',{$for},'1')");
}
NOTE: To add new packs, under ipn_donator.php, you can use the same code as above, but change if to else if.
This is working without issue on my site, including crediting of the donator pack after being bought. You'll also need to change your donator.php if you add or change any of the values from the normal packs.[/code]