function onUse(cid, item, fromPosition, itemEx, toPosition)
local config = {
item1 = 55,
item1name = "Sword",
item2 = 55,
item2name = "club",
item3 = 55,
item3name = "axe",
questStorage = 55446
}
if item.actionid == 4100 then
if getPlayerStorageValue(cid, config.questStorage) == -1 then
doPlayerAddItem(cid, config.item1, 1)
doPlayerSendTextMessage(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
doPlayerSendTextMessage(cid, 22, "You have found a "..config.item1name..".")
setPlayerStorageValue(cid, config.questStorage, 1)
else
doPlayerSendTextMessage(cid, 22, "The chest is empty.")
end
elseif item.actionid == 4200 then
if getPlayerStorageValue(cid, config.questStorage) == -1 then
doPlayerAddItem(cid, config.item2, 1)
doPlayerSendTextMessage(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
doPlayerSendTextMessage(cid, 22, "You have found a "..config.item2name..".")
setPlayerStorageValue(cid, config.questStorage, 1)
else
doPlayerSendTextMessage(cid, 22, "The chest is empty.")
end
elseif item.actionid == 4300 then
if getPlayerStorageValue(cid, config.questStorage) == -1 then
doPlayerAddItem(cid, config.item3, 1)
doPlayerSendTextMessage(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
doPlayerSendTextMessage(cid, 22, "You have found a "..config.item2name..".")
setPlayerStorageValue(cid, config.questStorage, 1)
else
doPlayerSendTextMessage(cid, 22, "The chest is empty.")
end
end
return TRUE
end
<action actionid="4100" event="script" value="script.lua"/>
<action actionid="4200" event="script" value="script.lua"/>
<action actionid="4300" event="script" value="script.lua"/>
function onUse(cid, item, fromPosition, itemEx, toPosition)
local config = {
[4100] = {
item = 55,
questStorage = 55444
},
[4100] = {
item = 55,
questStorage = 55445
},
[4100] = {
item = 55,
questStorage = 55446
}
}
local accion = config[item.actionid]
if accion then
if getPlayerStorageValue(cid, accion.questStorage) == -1 then
doPlayerAddItem(cid, accion.item1, 1)
doPlayerSendTextMessage(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
doPlayerSendTextMessage(cid, 22, "You have found a "..getItemNameById(accion.item) ..".")
setPlayerStorageValue(cid, accion.questStorage, 1)
else
doPlayerSendTextMessage(cid, 22, "The chest is empty.")
end
end
return TRUE
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
local config = {
items = {item1, item2, item3},
storages = {50000, 50001, 50002}
}
if item.actionid == 4000 and getPlayerLevel(cid) == 35 or getPlayerLevel(cid) == 50 or getPlayerLevel(cid) == 75 then
if getPlayerStorageValue(cid, config.storages) == -1 then
if(config.level == 35) then
doPlayerAdditem(cid,config.items[0])
doPlayerSendTextMessage(cid, 22, "You have found a" getItemIdByName(config.items[0] ".")
doPlayerSendTextMessage(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
setPlayerStorageValue(cid, config.storages[0])
elseif(config.level == 50) then
doPlayerSendTextMessage(cid, 22, "You have found a" getItemIdByName(config.items[1] ".")
doPlayerSendTextMessage(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
doPlayerAdditem(cid,config.items[1])
setPlayerStorageValue(cid, config.storages[1])
elseif(config.level == 75) then
doPlayerAdditem(cid,config.items[2])
doPlayerSendTextMessage(cid, 22, "You have found a" getItemIdByName(config.items[2] ".")
doPlayerSendTextMessage(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
setPlayerStorageValue(cid, config.storages[2])
else
doPlayerSendCancel(cid, "You have already this quest")
else
doPlayerSendCancel(cid, "You havent the requiered level")
end
return TRUE
end
end
really bad tabbed and where is it "config.level" :B
and getPlayerLevel(cid) == 35 or getPlayerLevel(cid) == 50 or getPlayerLevel(cid) == 75 then