SA-MP Forums Archive
Team - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Team (/showthread.php?tid=385274)



Team - SumX - 15.10.2012

Hello!
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"falsetruetruefalse );
//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++;


AW: Team - BiosMarcel - 15.10.2012

I don't know how to count but you can create variables teamcop,teamvagos ....

and if a play joins one of the teams
PHP код:
teamcop ++; 
if a player leaves
PHP код:
teamcop--; 



Re: Team - SumX - 15.10.2012

I did this.