exanime
I´m learning Lua
I have this chest system, all chest in one but no work on my TFS 1.0 Help me please
No have error in console, however, I did a chest with uid but This chest open and I do not get nothing :C
help me please!
No have error in console, however, I did a chest with uid but This chest open and I do not get nothing :C
help me please!
Code:
local t = {
[6001] = {8001,"magic sword",2400,1},
[6002] = {8001,"demon armor",2494,1},
[6003] = {8001,"stonecutter axe",2431,1},
[6004] = {8001,"annihilation bear",2326,1},
[6005] = {8002,"emerald sword",8930,1},
[6006] = {8002,"obsidian truncheon",8928,1},
[6007] = {8002,"hellforged axe",8924,1},
[6008] = {8002,"royal crossbow",8851,1},
[6009] = {8002,"warsinger bow",8854,1},
[6010] = {8002,"spellbook of dark mysteries",8918,1},
[6011] = {8002,"master archers armor",8888,1},
[6012] = {8002,"fireborn giant armor",8881,1},
[6013] = {8002,"robe of the underworld",8890,1},
[6014] = {8003,"demon legs",2495,1},
[6015] = {8003,"rainbow shield",8905,1},
[6016] = {8003,"spellbook of dark mysteries",8918,1},
[6017] = {8003,"royal crossbow",8851,1},
[6018] = {8004,"royal crossbow",8851,1}
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local v = t[item.uid]
if player:getStorageValue(cid,v[1]) == -1 and player:getFreeCapacity(cid) >= (itemType:getWeight(v[3])) then
player:setStorageValue(cid,v[1],1)
player:addItem(cid,v[3], v[4])
player:sendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a " .. v[2] .. "!")
elseif player:getStorageValue(cid,v[1]) == 1 then
player:sendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty")
elseif player:getFreeCapacity(cid) < (itemType:getWeight(v[3])) then
player:sendTextMessage(cid,MESSAGE_INFO_DESCR, "You need " .. itemType:getWeight(v[3]) .. " capacity in order to get the item")
end
return TRUE
end
Code:
<action uniqueid="6001-6017" script="Customquest/all.lua"/>