JuniorMelo Posted February 5, 2017 Posted February 5, 2017 You can count how many players are in a radar area ?
Bananovy Posted February 5, 2017 Posted February 5, 2017 You can make own simple function which will count players when they will enter the area.
Syntrax# Posted February 5, 2017 Posted February 5, 2017 Or just get streamed elements and count how many players there are
JuniorMelo Posted February 5, 2017 Author Posted February 5, 2017 (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 February 5, 2017 by JuniorMelo
bebo1king Posted February 5, 2017 Posted February 5, 2017 (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 February 5, 2017 by bebo1king Complete text
JuniorMelo Posted February 5, 2017 Author Posted February 5, 2017 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now