function onUse(cid, item, fromPos, item2, toPos)
local _ = {
[1] = {aid = 8000, item = 2427},
[2] = {aid = 8001, item = 2466},
[3] = {aid = 8002, item = 2171},
[4] = {aid = 8003, item = 2520},
}
-- Reservando os storages a partir de 202049 até o 202049 + número de baús nessa action
for i = 1, #_ do
_.storage = 202049 + i
end
for i, valor in ipairs(_) do
if item.actionid == valor.aid then
if getPlayerFreeCap(cid) >= getItemWeightById(valor.item, 1) then
if getPlayerStorageValue(cid, valor.storage) == -1 then
if doPlayerAddItem(cid, valor.item, 1, false) then
doPlayerSendTextMessage(cid, 22, 'You have found a '..getItemNameById(valor.item)..'.')
setPlayerStorageValue(cid, valor.storage, 1)
else
doPlayerSendTextMessage(cid, 22, 'You have found a '..getItemNameById(valor.item)..', but you need a free slot.')
end
else
doPlayerSendTextMessage(cid, 22, 'It is empty.')
end
else
doPlayerSendTextMessage(cid, 22, 'You have found a '..getItemNameById(valor.item)..'. It weighs '..getItemWeightById(valor.item, 1)..'.00 and it is too heavy.')
end
break
end
end
return true
end





info
Grupo: Campones
Registrado: 10/06/13
Posts: 62
Reputação: +2
Fiz tudo certinho do jeito q ele falou, mas meu script de quest n funciona, qnd eu dou use no bau da isso:
[Error - Action Interface]
data/actions/scripts/quests.lua:onUse
Description:
data/actions/scripts/quests.lua:16: attempt to call global 'getPlayerWeightById' <a nil value>
stack traceback:
data/actions/scripts/quests.lua:16: in function <data/actions/scripts/quests.lua:1>
uso a rev 3884, 8.60
script: