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

C++ Can anyone tell me which is the code related to TP player to temple [OTHIRE]

CipsoftStinks

www.relicaria.com
Joined
Oct 1, 2016
Messages
946
Solutions
3
Reaction score
138
Location
Argentina
Hello otland

Can anyone tell me which is the code related to TP player to temple if the player its standing on unwalkable tile? [OTHIRE]

i need to add this function to OTX2 sources, because this distribution lack of this function, so players can't make teleport players in depot etc etc and other things


maybe @Peonso?


i have this functios but its a bit buggy . Because it works but if the player its o pz tiles he get teleported to its town temple :S
maybe someone can fix this?
Code:
function isPathable(pos)
     pos.stackpos = 0
     local tile = getThingfromPos(pos).uid
     if tile > 0 then
       return not hasProperty(tile, CONST_PROP_BLOCKSOLID)
     end
     return false
end

local function isWalkable(cid, pos) -- DOES NOT WORK WITH ACCESS 3+
   local closest = getClosestFreeTile(cid, pos)
   return type(closest) == "table" and doComparePositions(closest, pos)
end
function onLogin(cid)
   local position = getThingPos(cid)
   if isPathable(position) == false or isWalkable(cid, position) == false then
       doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
   end
   return true
end
 
Back
Top