• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua check town of player tfs 1.2

gohamvsgoku

Member
Joined
Aug 21, 2017
Messages
151
Reaction score
9
I'm looking for a command that checks the player's hometown

Pseudocode

if player have town id = 1
setplayerstorage (100,1)
teleportPlayerto{x = 104, y = 923, z = 7}
 
Solution
You can use these functions:
LUA:
local town = player:getTown() -- returns a userdata
town:getId()
town:getName()
town:getTemplePosition()

local town = Town(1) -- can get town based on id or name returns a userdata
player:setTown(town)
So to answer your question player:getTown() is what you need but it may be useful for you to know the others as well.
You can use these functions:
LUA:
local town = player:getTown() -- returns a userdata
town:getId()
town:getName()
town:getTemplePosition()

local town = Town(1) -- can get town based on id or name returns a userdata
player:setTown(town)
So to answer your question player:getTown() is what you need but it may be useful for you to know the others as well.
 
Solution
Back
Top