30.11.2016, 12:55
Good morning guys, Today I made a command that shows the total number of players connected in teams, and each time the command is entered the number is added.
Example: Team 1 is with 2 players online when you enter the command it seems that the team is with 2 players online, plus if you enter the command again the result get 3 players and so on.
Example: Team 1 is with 2 players online when you enter the command it seems that the team is with 2 players online, plus if you enter the command again the result get 3 players and so on.
Code:
dcmd_totalteams(playerid, params[]) { #pragma unused params GetteamPlayers(); new String[500]; format(String, sizeof(String), "{FFFFFF}Players team 1:%d\n\ {FFFFFF}Players team 2: %d", Totalteam1, Totalteam2); ShowPlayerDialog(playerid, 96251, DIALOG_STYLE_MSGBOX, "Total Players dos teams", String, "Ok", ""); return 1; } stock GetteamPlayers() { for(new i, g = GetMaxPlayers(); i < g; i++) { if(IsPlayerConnected(i)) { if(Player[i][pteam1] == 1) { Totalteam1++; return 1; } if(Player[i][pteam2] == 1) { Totalteam2++; return 1; } } } return 1; }