function onStepIn(cid, item, position, fromPosition)
if getTilePzInfo(fromPosition) == true and getTilePzInfo(position) == false then
doPlayerSendTextMessage(cid, 22, "You are not in pz zone!")
else if getTilePzInfo(fromPosition) == false and getTilePzInfo(position) == true then
doPlayerSendTextMessage(cid, 22, "Welcome in pz!")
end
end
return true
end
<movevent type="StepIn" actionid="7000" event="script" value="script.lua"/>
function getPlayersfromArea(a, b)
local c = {}
for x = a.x, b.x do
for y = a.y, b.y do
for z = a.z, b.z do
local d = getTopCreature({x=x, y=y, z=z}).uid
if d ~= 0 and isPlayer(d) then
table.insert(c, d)
end
end
end
end
return c
end
local config = {
area = {
frompos = {x = 3041, y = 2986, z =9},
topos = {x = 3052, y = 2991, z=9}
}
}
function onThink(interval, lastExecution, thinkInterval)
if #getPlayersfromArea(config.area.frompos, config.area.topos) < 1 then
local players = getPlayersfromArea(config.area.frompos, config.area.topos)
for _, player in ipairs(players) do
-- here you enter what you want to get working with all players which are inside specified area (you must set area frompos, topos above in config)
-- what should be done for players inside the area
end
end
return true
end
If multiple players are on 1 position, this won't grab them all. (ladder/stairs, for example.)LUA:function getPlayersfromArea(a, b) local c = {} for x = a.x, b.x do for y = a.y, b.y do for z = a.z, b.z do local d = getTopCreature({x=x, y=y, z=z}).uid if d ~= 0 and isPlayer(d) then table.insert(c, d) end end end end return c end local config = { area = { frompos = {x = 3041, y = 2986, z =9}, topos = {x = 3052, y = 2991, z=9} } } function onThink(interval, lastExecution, thinkInterval) if #getPlayersfromArea(config.area.frompos, config.area.topos) < 1 then local players = getPlayersfromArea(config.area.frompos, config.area.topos) for _, player in ipairs(players) do -- here you enter what you want to get working with all players which are inside specified area (you must set area frompos, topos above in config) -- what should be done for players inside the area end end return true end
in creaturescripts event onThink
and inside script put your codes (what should happens when players are inside specific area)
and remember to change frompos (left top corner of area) and topos(right down corner of area)