CipsoftStinks
www.relicaria.com
Hello otland
well researching on this forum i found a solution to a trouble related to teleport players to temple if they're over an unwalkable item
the scripts works good the problem its that if the player its on PZ ZONE the script teleport the player to its temple even when it only should work on unwalkable items like table etc
and i don't see anything related to Pz in the code
can anyone tell me where the error is?or how to solve this via source code?
lib/funtions.lua
creaturescripts.lua
creaturescripts.xml
login.lua
tpplayers.lua
please help
well researching on this forum i found a solution to a trouble related to teleport players to temple if they're over an unwalkable item
the scripts works good the problem its that if the player its on PZ ZONE the script teleport the player to its temple even when it only should work on unwalkable items like table etc
and i don't see anything related to Pz in the code
can anyone tell me where the error is?or how to solve this via source code?
lib/funtions.lua
Code:
function isPathable(pos)
if getTileThingByPos(pos).itemid ~= 0 then
local tile = getThingfromPos(pos).uid
if hasProperty(tile, CONST_PROP_BLOCKSOLID) then
return false
end
return true
end
return false
end
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)
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
Code:
<event type="death" name="demonOakDeath" event="script" value="demonOakDeath.lua"/>
<event type="attack" name="demonOakAttack" event="script" value="demonOakAttack.lua"/>
<event type="login" name="TpPlayers" event="script" value="tpplayers.lua"/>
login.lua
Code:
registerCreatureEvent(cid, "KillingInTheNameOf")
registerCreatureEvent(cid, "TpPlayers")
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)
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
please help