11.02.2020, 16:16
Code:
Well. For start u need to hook old functions too rewrite them.
_giveItem <- giveItem;
_removeItem <- removeItem;
local PItems = {};
for (local i = 0; i < getMaxSlots(); ++i)
{
PItems[i] <- {};
}
function giveItem(pid, instance, amount)
{
/// ** = = = = = = = = = = = ** \\\
instance = instance.tostring();
local item = instance.toupper();
local id = Items.id(item);
/// ** = = = = = = = = = = = ** \\\
if(id != -1)
{
if(PItems[pid].rawin(id))
{
PItems[pid][id] = PItems[pid][id] + amount;
}else{
PItems[pid][id] <- amount;
}
_giveItem(pid, id, amount);
}
}
function removeItem(pid, instance, amount)
{
/// ** = = = = = = = = = = = ** \\\
local item = instance.toupper();
local id = Items.id(item);
/// ** = = = = = = = = = = = ** \\\
if(id != -1)
{
if(PItems[pid].rawin(id))
{
if(PItems[pid][id] > amount)
{
PItems[pid][id] = PItems[pid][id] - amount;
}
else
{
PItems[pid].rawdelete(id);
}
}
_removeItem(pid, id, amount);
}
}
function getPlayerItems(pid)
{
return PItems[pid];
}