Full 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Full team (
/showthread.php?tid=273362)
Full team -
RatHack - 01.08.2011
Hello!
Im looking for, if a Team have 4 players spawned, if someone want to spawn in that team, he cant
Someone know something about this?
Re: Full team -
Kitten - 01.08.2011
Team Balance?
pawn Code:
#define BALANCER 20 // Amount of players in team
public OnGameModeInit() {
for(new i=0; i<MAX_PLAYERS; i++) {
SetTimerEx("Trololo",AmountOfMinToCheckTeamBalance,true,"d", i);
}
return 1;
}
forward Trololo(playerid);
public Trololo(playerid)
{
if(TeamInfo[playerid] > BALANCER) {
SetPlayerTeam(playerid,MYTEAM);
}
if(TeamInfo[playerid] < BALANCER) {
SetPlayerTeam(playerid,MYTEAM2);
}
return 1;
}
Respuesta: Full team -
RatHack - 01.08.2011
No, i mean, if a team for example Army have 5 players spawned, and the 6th want to spawn, he cant.
Re: Full team -
=WoR=Varth - 02.08.2011
pawn Code:
new count;
for(new i;i<MAX_PLAYERS;i++)
{
if(PlayerTeam[i] == 3) count ++;//Of course change this line
}
if(count > 5)
{
//You can freeze player, set their pos to somewhere, and make them spectating other player.
}
else
{
//Spawn player
}
Re: Full team -
Basicz - 02.08.2011
pawn Code:
new
iArmyCounts,
iRobberCounts
;
public OnPlayerSpawn( playerid )
{
if ( GetPlayerTeam( playerid ) == TEAM_ARMY ) iArmyCounts ++;
if ( GetPlayerTeam( playerid ) == TEAM_ROBBERS ) iRobberCounts ++;
return 1;
}
public OnPlayerRequestSpawn( playerid )
{
if ( GetPlayerTeam( playerid ) == TEAM_ARMY )
{
if ( iArmyCounts < iRobberCounts )
return !SendClientMessage( playerid, -1, "Please join robbers team." );
}
if ( GetPlayerTeam( playerid ) == TEAM_ROBBERS )
{
if ( iRobberCounts < iArmyCounts )
return !SendClientMessage( playerid, -1, "Please join army team." );
}
return 1;
}
pawn Code:
return !print( "lol" );
// ==
return print( "lol" ), 0;
// afaik xD
Hope this one works, and helped you.
EDIT: I got what do you meant.
pawn Code:
new
iArmyCounts
;
public OnPlayerSpawn( playerid )
{
if ( GetPlayerTeam( playerid ) == TEAM_ARMY )
iArmyCounts ++;
return 1;
}
public OnPlayerRequestSpawn( playerid )
{
if ( GetPlayerTeam( playerid ) == TEAM_ARMY )
{
if ( iArmyCounts >= 5 )
return !SendClientMessage( playerid, -1, "Team army is full." );
}
return 1;
}