local annihilatorReward = {1990, 2400, 2431, 2494}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.uid <= 1000 or item.uid > 22700 then
return false
end
local itemType = ItemType(item.itemid)
local itemWeight = itemType:getWeight()
local playerCap = player:getFreeCapacity()
if isInArray(annihilatorReward, item.uid) then
if player:getStorageValue(30015) == -1 then
if playerCap >= itemWeight then
if item.uid == 1990 then
player:addItem(1990, 1):addItem(2326, 1)
else
player:addItem(item.uid, 1)
end
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. '.')
player:setStorageValue(30015, 1)
else
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. ' weighing ' .. itemWeight .. ' oz it\'s too heavy.')
end
else
player:sendTextMessage(MESSAGE_INFO_DESCR, "It is empty.")
end
elseif player:getStorageValue(item.uid) == -1 then
if playerCap >= itemWeight then
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. '.')
player:addItem(item.uid, 1)
player:setStorageValue(item.uid, 1)
else
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. ' weighing ' .. itemWeight .. ' oz it\'s too heavy.')
end
else
player:sendTextMessage(MESSAGE_INFO_DESCR, "It is empty.")
end
return true
end
<action itemid="1740" script="quests/quests.lua" />
<action fromid="1747" toid="1749" script="quests/quests.lua" />
Code:local annihilatorReward = {1990, 2400, 2431, 2494} function onUse(player, item, fromPosition, target, toPosition, isHotkey) if item.uid <= 1000 or item.uid > 22700 then return false end local itemType = ItemType(item.itemid) local itemWeight = itemType:getWeight() local playerCap = player:getFreeCapacity() if isInArray(annihilatorReward, item.uid) then if player:getStorageValue(30015) == -1 then if playerCap >= itemWeight then if item.uid == 1990 then player:addItem(1990, 1):addItem(2326, 1) else player:addItem(item.uid, 1) end player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. '.') player:setStorageValue(30015, 1) else player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. ' weighing ' .. itemWeight .. ' oz it\'s too heavy.') end else player:sendTextMessage(MESSAGE_INFO_DESCR, "It is empty.") end elseif player:getStorageValue(item.uid) == -1 then if playerCap >= itemWeight then player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. '.') player:addItem(item.uid, 1) player:setStorageValue(item.uid, 1) else player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. ' weighing ' .. itemWeight .. ' oz it\'s too heavy.') end else player:sendTextMessage(MESSAGE_INFO_DESCR, "It is empty.") end return true end
actions.xml
Code:<action itemid="1740" script="quests/quests.lua" /> <action fromid="1747" toid="1749" script="quests/quests.lua" />
hey silver, i think this guys isn't gonna to buy or learn how to make.I have a little script too, if you want talk about it send a PM ... (for sale, cheap)
man you can just setStorage with function onKill and make a action script, if the player have the storage then give him a reward '-' is easy..Ye but I got some bugs like others in this post I was looking one more little code or like obujos chest (take random when kill boss)