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

Lua If player is standing on safe tile.

Depends on tfs version....

"if getTileInfo(pos).protection"
I use tfs 1.1, but nvm i fixed i will post the code in seconds.

Code:
function Player.isSafeTile(self)
if not self then return false end
return Tile(self:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE)
end
 
Last edited by a moderator:
or
Code:
function Player:isSafeTile()
    if not self then 
        return false 
    end
    return Tile(self:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE)
end
 
I think it would be better to check the position if it is safe instead.


Code:
function Position.isSafe(self)
    return Tile(self):hasFlag(TILESTATE_PROTECTIONZONE)
end

How to use:
Code:
player:getPosition():isSafe()
 
I think it would be better to check the position if it is safe instead.


Code:
function Position.isSafe(self)
    return Tile(self):hasFlag(TILESTATE_PROTECTIONZONE)
end

How to use:
Code:
player:getPosition():isSafe()
yeah, not much difference from one i made. i just said give the whole player, but you gave it position only.
Same idea. Thanks anyway.
 
Back
Top