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

Lua Teleport players in area

Status
Not open for further replies.

VirrageS

←•†ĿuĀ && ©¤¤•→
Joined
May 30, 2010
Messages
984
Reaction score
63
Location
Poland
Hello

I want to have script which will teleport (to 'x' place) players (from all floors) which are standing in area and without 'x' storage.

Here is an example:

Code:
[LIST]
[*]buildingfromx = 583
[*]buildingtox = 586
[*]buildingfromy = 675
[*]buildingtoy = 677
[*]buildingfromz = 1
[*]buildingtoz = 15
[/LIST]

And when players are standing in this area will be teleported to 'x' place.

I don't know that I explaing it well :(. But I think that we understand me :thumbup:.

Thanks in advance ^_^
 
Last edited:
This should work :p but may have many loops.
LUA:
local posss = {x=583,y=675,z=1}   -- teleported place
local storage = 2939
local players = {}
for _,cid in ipairs(getPlayersOnline()) do
	for i = 1,15 do
        local frompos,topos = {x=583,y=675,z=i},{x=586,y=677,z=i}
        if isInRange(getThingPos(cid),frompos,topos) then
			table.insert(players,cid)
		end
	end
end
if #players > 0 then
	for _,pid in ipairs(players) do
		if getPlayerStorageValue(pid,storage) < 1 then
			doTeleportThing(pid,posss,false)
		end
	end
else
	doBroadcastMessage("No players was found there.")
end
 
Last edited:
Status
Not open for further replies.
Back
Top