Hello, I have a problem, I would like to get wings after using the item, I am using a script
I get an error in the console i have tfs 1.3
Lua:
local config1 = {
[9020] = {wingId = 1, name = "WING NAME"},
}
local wings_on_click = Action()
function wings_on_click.onUse(player, item, fromPosition, target, toPosition, isHotkey)
local wings = config1[item.itemid]
if not wings then
return true
end
if not player:hasWing(wings.wingId) then
player:addWings(wings.wingId)
player:getPosition():sendMagicEffect(31)
player:say("You have gained: "..wings.name..".", TALKTYPE_MONSTER_SAY)
item:remove(1)
else
player:sendTextMessage(19, "You already have this wing.")
end
return true
end
for k,_ in pairs(config1) do
wings_on_click:id(k)
end
wings_on_click:register()
I get an error in the console i have tfs 1.3
Code:
Lua Script Error: [Scripts Interface]
C:\Users\xxxx\OneDrive\Pulpit\forgottenserver\data\scripts\wings.lua:callback
...g\OneDrive\Pulpit\forgottenserver\data\scripts\wings.lua:15: attempt to call method 'hasWing' (a nil value)
stack traceback:
[C]: in function 'hasWing'
...g\OneDrive\Pulpit\forgottenserver\data\scripts\wings.lua:15: in function <...g\OneDrive\Pulpit\forgottenserver\data\scripts\wings.lua:6>