T
Tibia Demon
Guest
i want to check when player trying to move any sqm fromposition toposition area if they have storage then allow move but if they dont have storage then return true. this is the storages [43040] -- [43342] every storage allow to access it's position range tiles only
or i need to add actionid to all tiles fromposition toposition?
it is 10 storage and 10 places i dont need to make 10 scripts so i try tables but idk how to fix it.
Lua:
local AccessStep = MoveEvent()
AccessStep:type("stepin")
local GoAccess = {
[43040] = {accesstilefromPosition = {x = 2010, y = 789, z = 8}, accesstiletoPosition = {x = 2020, y = 789, z = 8}},
[43342] = {accesstilefromPosition = {x = 2215, y = 631, z = 7}, accesstiletoPosition = {x = 2230, y = 631, z = 7}},
}
function AccessStep.onStepIn(player, item, position, fromPosition)
local AccessStep = GoAccess[getStorageValue()]
if not player or player:isInGhostMode() then
return true
end
if position:isInRange(GoAccess.accesstilefromPosition, GoAccess.accesstiletoPosition) then
if not player:getStorageValue(AccessStep) == 1 then
player:getPosition():sendMagicEffect(CONST_ME_POFF)
player:teleportTo(fromPosition)
player:sendCancelMessage("You cant access this area.")
return true
end
return true
end
end
AccessStep:register()
it is 10 storage and 10 places i dont need to make 10 scripts so i try tables but idk how to fix it.
Last edited by a moderator: