• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 1.X+ Can't equip items with script movments

Tubeshop

Member
Joined
Nov 23, 2023
Messages
173
Reaction score
19
when I try to add the onequip script:
<movevent event="Equip" itemid="2656" slot="armor" script="Items.lua"/>
I can't wear the item. I get the message: You cannot dres the object here.

Items.lua:
function onEquip(player, item, slot)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "wear." .. item:getDescription())

end

function onDeEquip(player, item, slot)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "remove.")
end
 
you must return true, otherwise you will be sending nil and nil is a value that is considered false
Lua:
function onEquip(player, item, slot)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "wear." .. item:getDescription())
return true --- <<<< HERE
end

function onDeEquip(player, item, slot)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "remove.")
return true --- <<<< HERE
end
 
thanks so much :) now it work but i have one more problem. I only put the armor on once and I get 3 messages about putting it on. What is it about?
Post automatically merged:

o i got it:
function onEquip(player, item, slot)
local slots = getPlayerSlotItem(player, slot )
if slots.itemid ~= item.itemid then
return true
end
print("TEST")
doPlayerSendTextMessage(player, MESSAGE_STATUS_CONSOLE_ORANGE, "hey")

return true
end
 
Last edited:
Back
Top