Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function onUse(player, item, fromPosition, target, toPosition, isHotkey)
- for i = 1, #aingredients do
- if item.itemid == aingredients[i].id then
- if player:getStorageValue(aingredients[i].storages[1]) ~= 1 then
- if aingredients[i].use == "with" and target == player then
- item:remove(1)
- player:setStorageValue(aingredients[i].storages[1], 1)
- player:say("Kind of chewy...", TALKTYPE_MONSTER_SAY)
- player:sendTextMessage(MESSAGE_INFO_DESCR, "You have discovered the effect " .. aeffects[aingredients[i].effects[1]].fullname .. " from the " .. aingredients[i].name .. "!")
- return true
- elseif aingredients[i].use == "use" then
- item:remove(1)
- player:setStorageValue(aingredients[i].storages[1], 1)
- player:say("Kind of chewy...", TALKTYPE_MONSTER_SAY)
- player:sendTextMessage(MESSAGE_INFO_DESCR, "You have discovered the effect " .. aeffects[aingredients[i].effects[1]].fullname .. " from the " .. aingredients[i].name .. "!")
- return true
- end
- else
- if aingredients[i].use == "with" then
- if target == player then
- player:sendTextMessage(MESSAGE_INFO_DESCR, "You have already discovered the first effect for this item.")
- else
- return false
- end
- else
- player:sendTextMessage(MESSAGE_INFO_DESCR, "You have already discovered the first effect for this item.")
- end
- return true
- end
- end
- end
- return false
- end
Advertisement
Add Comment
Please, Sign In to add comment