Mateus Robeerto
Excellent OT User
When I click on the item, however the wings are not added to the player. See the script.
Lua:
local config = {
storage = 5359236,
effect = CONST_ME_FIREWORK_RED,
text1 = "You have gained your new wings!",
text2 = "You already have these wings!",
wingId = 1
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if player:getStorageValue(config.storage) < 1 then
if player:getStorageValue(config.storage) == -1 then
player:addWings(config.wingId)
player:sendTextMessage(MESSAGE_INFO_DESCR, config.text1)
player:setStorageValue(config.storage, 1)
player:getPosition():sendMagicEffect(config.effect)
item:remove(1)
else
player:sendTextMessage(MESSAGE_INFO_DESCR, config.text2)
end
else
player:sendTextMessage(MESSAGE_INFO_DESCR, "You have already used this item.")
end
return true
end
XML:
<wing id="1" clientid="1655" name="Wing" speed="20" />