• 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!

make items unmoveable on lua for tfs 1.3?

Marko999x

999x era
Premium User
Joined
Dec 14, 2017
Messages
2,906
Solutions
82
Reaction score
2,015
Location
Germany
cant find anything at all so im asking you guys for help
is it possible to make items unmoveable in lua and without any special actionid?
 
Solution
Those ones will apply to all items with X-id but you can add item position so it only apply if items are on this position.
Lua:
    if item:getId() == xxxx and fromPosition.x == xxxx and fromPosition.y == xx and fromPosition.z == xxxx then
        self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
        return false
    end
Those ones will apply to all items with X-id but you can add item position so it only apply if items are on this position.
Lua:
    if item:getId() == xxxx and fromPosition.x == xxxx and fromPosition.y == xx and fromPosition.z == xxxx then
        self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
        return false
    end
 
Solution
Just for your knowledge, if I remove the item: getId () == xxxx, all items in the area will be unmoveable ? I didn't know that shape.
Post automatically merged:

Those ones will apply to all items with X-id but you can add item position so it only apply if items are on this position.
Lua:
    if item:getId() == xxxx and fromPosition.x == xxxx and fromPosition.y == xx and fromPosition.z == xxxx then
        self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
        return false
    end
 
yes, almost everything is possible by changing the Player:eek:nMoveItem function:

Lua:
if item:getId() == 1234 then
    return false
end
Those ones will apply to all items with X-id but you can add item position so it only apply if items are on this position.
Lua:
    if item:getId() == xxxx and fromPosition.x == xxxx and fromPosition.y == xx and fromPosition.z == xxxx then
        self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
        return false
    end

Doesnt work
 
Doesnt work
How did you add it? It works, I use it on my server on many locations already.
Check if you enabled your onMoveItem like @up mentioned.
and also you'll have to add it above return true so it should look like this
Lua:
function Player:onMoveItem(item, count, fromPosition, toPosition, fromCylinder, toCylinder)
   if item:getId() == xxxx and fromPosition.x == xxxx and fromPosition.y == xx and fromPosition.z == xxxx then
        self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
        return false
    end
    return true
end
 
If the item is tradeable you should add check into it too.
I came here to mention this.

'useWith' is also something you need to deal with, if the item has it.

Character 'usewith' from 2+ sqm, source auto walks and picks item into inventory, and now the character has an immovable item they can't get rid of.

I'm uncertain if this is still an issue, as I haven't tested it, but it was a major pain in my butt in 0.3.7 lmao
 
@AngeLOT If you already solved your thread mark it as solved and/or mark the solution which fits you best as Best Answer, You have like 2 other threads left opened where we don't know if they are solved yet or unsolved or you still gonna request more help there.
11. Marking "Best Answer"
- Once your problem is resolved, please MARK SOLUTION AS "BEST ANSWER".
 
@AngeLOT If you already solved your thread mark it as solved and/or mark the solution which fits you best as Best Answer, You have like 2 other threads left opened where we don't know if they are solved yet or unsolved or you still gonna request more help there.
My fault sorry
Btw
Can you link me on these two unsolved threads pls
 
Sure, I had them saved.
 
Back
Top