IsTeamFull(TeamID)
{
new Teams[MAX_TEAMS], bool:rt;
for(new i =0; i< MAX_PLAYERS; i++)
{
for(new k = 0; k < MAX_TEAMS; k++)
{
if((GetPlayerTeam(i) == k)
{
Teams[k]++;
}
}
}
for(new i = 0; i< MAX_TEAMS; i++)
{
if(Teams[i] < Teams[TeamID])
{
rt = true;
}
else
{
rt = false;
}
}
return rt;
}
if the team which's ID is passed as parameter is full
IsTeamFull(TeamID)
{
new Teams[MAX_TEAMS],i,k;
for(i =0; i< MAX_PLAYERS; i++)
for(k = 0; k < MAX_TEAMS; k++)
if((GetPlayerTeam(i) == k)
Teams[k]++;
for(i = 0; i< MAX_TEAMS; i++)
if(Teams[i] < Teams[TeamID])
return true;
return false;
}
#define MAX_PLAYERS_IN_TEAM 15
IsTeamFull(TeamID)
{
new Count, bool:rt;
for(new i =0; i< MAX_PLAYERS; i++)
{
if(GetPlayerTeam(i) == TeamID)
{
Count++;
}
}
if(Count == MAX_PLAYERS_IN_TEAM)
{
return true;
}
else return false;
}
IsHightestTeam(TeamID)
{
new id, output = -1, Teams[MAX_TEAMS], bool:rt;
for(new i =0; i< MAX_PLAYERS; i++)
{
for(new k = 0; k < MAX_TEAMS; k++)
{
if(GetPlayerTeam(i) == k)
{
Teams[k]++;
}
}
}
for (new ht; ht != sizeof(Teams); ++ht)
{
if (Teams[ht] > output) output = Teams[ht], id = ht;
}
if(id == TeamID && id != -1)
{
return true;
}
else return false;
}
PHP код:
|
Don't unnecessarily put static key word to every declaration if you actually don't know what it does. Your code wont work as the variable count being a static variable will be stored on data section and will be remembered on each overhead. That means the count variable never be reset.
|
Simple, got some teams, but sometimes they get overloaded, which means some teams have alot of players in it while other a few, so i was trying to make a function to check if the team is "full" (has more players then others?), so i can prevent them from selecting that team.
|
new g_TeamCount[MAX_TEAMS];
++g_TeamCount
IsTeamFull(teamid) { if ( g_TeamCount[teamid] >= MAX_TEAM_MEMBERS ) return true; return false; }