Nao ta indo , usando isso mas nao vai
function getItemCap(itemid, quant) -- function by MatheusMkalo
return getItemInfo(itemid).weight*(quant or 1)
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
local configs = {
[800] = {itemid = 2496, quantperslot = 10, cost = 5, backpackid = 2002},
[801] = {itemid = 2503, quantperslot = 50, cost = 2, backpackid = 2003},
[802] = {itemid = 2504, quantperslot = 10, cost = 5, backpackid = 2002},
[803] = {itemid = 9931, quantperslot = 50, cost = 2, backpackid = 2003},
[804] = {itemid = 2493, quantperslot = 50, cost = 2, backpackid = 2003},
[805] = {itemid = 8877, quantperslot = 50, cost = 2, backpackid = 2003},
[806] = {itemid = 2495, quantperslot = 10, cost = 5, backpackid = 2002},
[808] = {itemid = 9932, quantperslot = 50, cost = 2, backpackid = 2003},
[809] = {itemid = 9778, quantperslot = 50, cost = 2, backpackid = 2003},
[810] = {itemid = 8878, quantperslot = 50, cost = 2, backpackid = 2003},
[811] = {itemid = 7896, quantperslot = 50, cost = 2, backpackid = 2003},
[812] = {itemid = 2640, quantperslot = 10, cost = 5, backpackid = 2002},
[813] = {itemid = 8858, quantperslot = 50, cost = 2, backpackid = 2003},
[814] = {itemid = 7958, quantperslot = 50, cost = 2, backpackid = 2003},
[815] = {itemid = 8918, quantperslot = 50, cost = 2, backpackid = 2003},
[816] = {itemid = 2390, quantperslot = 10, cost = 5, backpackid = 2002},
[817] = {itemid = 8304, quantperslot = 10, cost = 5, backpackid = 2002},
[818] = {itemid = 2352, quantperslot = 50, cost = 2, backpackid = 2003},
[819] = {itemid = 2195, quantperslot = 50, cost = 2, backpackid = 2003},
[820] = {itemid = 8853, quantperslot = 50, cost = 2, backpackid = 2003},
[821] = {itemid = 8926, quantperslot = 50, cost = 2, backpackid = 2003},
{
local coinid = 6527 -- Use o id da gold coin (2148) se voce quizer usar o sistema de dinheiro mesmo. (Caso o itemid for 2148 o cost sera de gps ou seja 30 = 30 gps)
if configs[item.actionid] then
if getPlayerFreeCap(cid) >= math.ceil((getItemCap(configs[item.actionid].itemid, configs[item.actionid].quantperslot)*20)+getItemCap(configs[item.actionid].backpackid)) then
if coinid ~= 2148 and getPlayerItemCount(cid, coinid) >= configs[item.actionid].cost or doPlayerRemoveMoney(cid, configs[item.actionid].cost) then
local backpack = doPlayerAddItem(cid, configs[item.actionid].backpackid)
for i = 1, 20 do
doAddContainerItem(backpack, configs[item.actionid].itemid, configs[item.actionid].quantperslot)
end
doPlayerRemoveItem(cid, coinid == 2148 and 0000 or coinid, configs[item.actionid].cost)
else
return doPlayerSendCancel(cid, ("You need " .. configs[item.actionid].cost) .. (coinid == 2148 and " gold coins" or (" " .. getItemPluralNameById(coinid):lower())) .. " to buy this item.")
end
else
return doPlayerSendCancel(cid, "You need " .. math.ceil((getItemCap(configs[item.actionid].itemid, configs[item.actionid].quantperslot)*20)+getItemCap(configs[item.actionid].backpackid)) .. " cap for buy that.")
end
end
return TRUE
end