How can I count how many members do I have in a Team? And how can I save this number and load it every time?
I tried something but this is not efficient.I use GetPlayerTeam for getting the player's Team.
PHP код:
new SouthBoysM;
new YakooM;
new TheTriadsM;
new MafiaM;
new VagosM;
new CopsM;
//OnPlayerConnect
INI_ParseFile( "Teams/TeamLimits.ini", "LoadTeamLimits", false, true, true, false );
//OnPlayerConnect
SaveTeamLimits();
function LoadTeamLimits(name[], value[])
{
if(!strcmp(name, "SouthBoysMembers", true)) { SouthBoysM = strval(value); }
if(!strcmp(name, "YakooMembers", true)) { YakooM = strval(value); }
if(!strcmp(name, "TheTriadsMembers", true)) { TheTriadsM = strval(value); }
if(!strcmp(name, "MafiaMembers", true)) { MafiaM = strval(value); }
if(!strcmp(name, "VagosMembers", true)) { VagosM = strval(value); }
if(!strcmp(name, "CopsMembers", true)) { CopsM = strval(value); }
return 0;
}
forward SaveTeamLimits();
public SaveTeamLimits()
{
new INI:File = INI_Open("Teams/TeamLimits.ini");
INI_WriteInt(File, "SouthBoysMembers", SouthBoysM);
INI_WriteInt(File, "YakooMembers", YakooM);
INI_WriteInt(File, "TheTriadsMembers", TheTriadsM);
INI_WriteInt(File, "MafiaMembers", MafiaM);
INI_WriteInt(File, "VagosMembers", VagosM);
INI_WriteInt(File, "CopsMembers", CopsM);
INI_Close(File);
return 1;
}
When I join the team I ++ the variable. Example: Cops++;
I don't know how to count but you can create variables teamcop,teamvagos ....