open.mp forum
[Pawn] Getting online players of specific team - Printable Version

+- open.mp forum (https://forum.open.mp)
+-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
+--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
+--- Thread: [Pawn] Getting online players of specific team (/showthread.php?tid=1893)



Getting online players of specific team - Turk54721 - 2021-04-17

Hello, how can I get online players of specific team?


RE: Getting online players of specific team - Radical - 2021-04-17

Code:
GetOnlinePlayersFromTeam(teamid) { ? ? new count; ? ? foreach(new i : Player) { ? ? ? ? if (GetPlayerTeam(i) == teamid) count; ? ? } ? ? return count; } // new count =?GetOnlinePlayersFromTeam(5);



RE: Getting online players of specific team - DandoRYx - 2021-04-17

Code:
for(new player = 0, pool = GetPlayerPoolSize(); player <= pool; player) // cycle through all players { if(GetPlayerTeam(player) == YOUR_TEAM) // if the player has the right team { // do whatever you want } }