Jump to content

count player in radar area


JuniorMelo

Recommended Posts

Posted

You can count how many players are in a radar area ?

........... \__ ▄▂_

.........[█|||███████]▄▄▄▄▄▄▄▄▄▃▂

..__▂▄▅█████████▅▄▃▂

I███████████████████]

...◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤

░░░███████ ]▄▄▄▄▄▄▄▄

▂▄▅████████▅▄▃▂

I███████████████████]

◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤

Posted (edited)
local areanumber = getElementData (source,"areanumber")

for i,k in ipairs (getElementsByType ( "radararea" )) do
	local number = getElementData ( k, "areanumber" )
	if ( number == areanumber ) then
		for i, v in ipairs(getElementsByType ( "player" )) do
			outputChatBox ( ''..i..'', thePlayer, 255, 255, 255, true )
		end
	end
end

such that ?

Edited by JuniorMelo

........... \__ ▄▂_

.........[█|||███████]▄▄▄▄▄▄▄▄▄▃▂

..__▂▄▅█████████▅▄▃▂

I███████████████████]

...◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤

░░░███████ ]▄▄▄▄▄▄▄▄

▂▄▅████████▅▄▃▂

I███████████████████]

◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤

Posted (edited)
function (ZoneElement)
	if ZoneElement and getElementType(ZoneElement) == "Collision shape" then
		local Count = 0
		for i , v in pairs (getElementsByType("player") ) do
			if isElementWithinColShape(v,ZoneElement) then
				Count = Count + 1
			end
		end
		return Count
	end
end

I didn't test it but i think it will run well

Edited by bebo1king
Complete text

Skype :bebo.ahmad34

My channel on youtupe :

https://www.youtube.com/channel/UCOXfmMopyyBL5NBeO0RS04g/videos

Posted
local areanumber = getElementData (source,"areanumber")
local ganginfo = getgangInfo(getPlayergang(hitElement))
local gangname = ganginfo['gangname']
local dbName = "VOLT_3" .. gangname .. "_members2"
local players = executeSQLQuery("SELECT * FROM ?", dbName)
maxPlayers = 2
for i,k in ipairs (getElementsByType ( "radararea" )) do
	local number = getElementData ( k, "areanumber" )
	if ( number == areanumber ) then
		for t, k in ipairs(players) do
     		 if tonumber(t) <= tonumber(maxPlayers) then outputChatBox ( '#ff4444[ERROR]#ffffff It is necessary ' .. maxPlayers ..'',thePlayer, 255, 255, 255, true ); return end
		end
	end
end

I'm trying to do this, But I'm not sure if it will work properly.

 

(It takes a number of players within the area to initiate an attack on the area)

 

 

Sorry for my English, I'm brazilian :D

 

 

........... \__ ▄▂_

.........[█|||███████]▄▄▄▄▄▄▄▄▄▃▂

..__▂▄▅█████████▅▄▃▂

I███████████████████]

...◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤

░░░███████ ]▄▄▄▄▄▄▄▄

▂▄▅████████▅▄▃▂

I███████████████████]

◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...