• 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+ No use object help

Solution
Keep in mind, players can still take the item by using Browse Field and moving the item from there if you use that method.

What I would do is add an actionId to the item and then add something like this into data/scripts:
Lua:
local actionId = 13366

local blockMove = EventCallback
blockMove.onMoveItem = function(self, item, count, fromPosition, toPosition, fromCylinder, toCylinder)
    if item.actionid == actionId then
        return RETURNVALUE_NOTPOSSIBLE
    end
    return RETURNVALUE_NOERROR
end

blockMove:register()
--------------------------------------------------------
local blockTrade = EventCallback
function blockTrade.onTradeRequest(player, target, item)
    if item.actionid == actionId then...
Use this by applying it to your chosen item. In rme.
oNQULQK.png
 
Keep in mind, players can still take the item by using Browse Field and moving the item from there if you use that method.

What I would do is add an actionId to the item and then add something like this into data/scripts:
Lua:
local actionId = 13366

local blockMove = EventCallback
blockMove.onMoveItem = function(self, item, count, fromPosition, toPosition, fromCylinder, toCylinder)
    if item.actionid == actionId then
        return RETURNVALUE_NOTPOSSIBLE
    end
    return RETURNVALUE_NOERROR
end

blockMove:register()
--------------------------------------------------------
local blockTrade = EventCallback
function blockTrade.onTradeRequest(player, target, item)
    if item.actionid == actionId then
        player:sendCancelMessage("You can not trade this item.")
        return false
    end
    return true
end

blockTrade:register()
Remember to enable onTradeRequest in data/events/events.xml by changing enabled="0" to enabled="1".

And this will only hinder the player from moving or attempting to trade the item, I can't think of other ways to take the item right now, but they will still be able to use the items, and use with etc...
 
Solution
Keep in mind, players can still take the item by using Browse Field and moving the item from there if you use that method.

What I would do is add an actionId to the item and then add something like this into data/scripts:
Lua:
local actionId = 13366

local blockMove = EventCallback
blockMove.onMoveItem = function(self, item, count, fromPosition, toPosition, fromCylinder, toCylinder)
    if item.actionid == actionId then
        return RETURNVALUE_NOTPOSSIBLE
    end
    return RETURNVALUE_NOERROR
end

blockMove:register()
--------------------------------------------------------
local blockTrade = EventCallback
function blockTrade.onTradeRequest(player, target, item)
    if item.actionid == actionId then
        player:sendCancelMessage("You can not trade this item.")
        return false
    end
    return true
end

blockTrade:register()
Remember to enable onTradeRequest in data/events/events.xml by changing enabled="0" to enabled="1".

And this will only hinder the player from moving or attempting to trade the item, I can't think of other ways to take the item right now, but they will still be able to use the items, and use with etc...
You are helping me out once again, thank you
 
Back
Top