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

Check amount of players in 2 areas [Help]

LucasFerraz

Systems Analyst
Joined
Jun 10, 2010
Messages
2,857
Reaction score
96
Location
Brazil
I need a simply script.
1. Check amount of players in Area 1 and Area 2.
2. If amount of players of Area 1 == Area 2 then Teleport Area 1(players) to X position and Area 2(players) to Y position.
3. If amount of players isn't == then try again in 1 minute and send a message to players in both areas.

Can someone help me?
 
How can I compare this?
if area 1 have same count of players of area 2 then
teleport
else
message
LUA:
local t = {
	pos = {
		areaA = {
			fromPosition = {x="100", y="100", z="7"},
			toPosition = {x="100", y="100", z="7"}
		},
		areaB = {
			fromPosition = {x="100", y="100", z="7"},
			toPosition = {x="100", y="100", z="7"}
			}
	},
	playersA = 0,
	playersB = 0
	}
function onSay(cid, param, words)
for _, pid in ipairs(getPlayersOnline()) then
	if isInRange(getThingPos(pid), t.pos.areaA.fromPosition, t.pos.areaA.toPosition) then
			t.playersA = t.playersA+1
		elseif isInRange(getThingPos(pid), t.pos.areaB.fromPosition, t.pos.areaB.toPosition) then
			t.playersB = t.playersB+1
	end
end
if t.playersA == t.playersB then
		bla bla
else
bla blabla bla
return TRUE
end
 
Last edited:
Back
Top