Let's player to spawn -
SwisherSweet - 06.07.2013
so under OnPlayerRequestClass i have this(this is really frustrating me out!!!)(it's a team balancer)
Код:
if(EUROPE > USA && GetPlayerTeam(playerid) == EUROPE)
{
GameTextForPlayer(playerid, "~r~Team Full!~n~~w~Choose Another Team!", 3000, 5);
return 0;
}
else if(USA > EUROPE && GetPlayerTeam(playerid) == USA)
{
GameTextForPlayer(playerid, "~r~Team Full!~n~~w~Choose Another Team!", 3000, 5);
return 0;
}
if(RUSSIA > CHINA && GetPlayerTeam(playerid) == RUSSIA)
{
GameTextForPlayer(playerid, "~r~Team Full!~n~~w~Choose Another Team!", 3000, 5);
return 0;
}
else if(CHINA > RUSSIA && GetPlayerTeam(playerid) == CHINA)
{
GameTextForPlayer(playerid, "~r~Team Full!~n~~w~Choose Another Team!", 3000, 5);
return 0;
}
TextDrawShowForPlayer(playerid, title);
return 1;
}
now i also have this as a stock
Код:
stock GetPlayersInTeamFromMaxPlayers(teamid)
{
new playercount = 0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(GetPlayerState(i) == PLAYER_STATE_NONE) continue;
if(GetPlayerTeam(i) != teamid) continue;
playercount++;
}
return playercount;
}
HOW DO I MAKE THIS WORK

!!!!
Re: Let's player to spawn -
Niko_boy - 06.07.2013
so USA , CHINA and all are increasing when u put a playr in a team?
as in USA++; ?
Re: Let's player to spawn -
park4bmx - 06.07.2013
Lets say ur MAX_PLAYERS in a team are
10
pawn Код:
stock GetTeamPlayers(teamid)
{
new count;
for(new i=0; i<MAX_PLAYERS;)
{
if(i = teamid) count++;
if(count >= 10) return 10;
}
return count;
}
And just check it for each team
Re: Let's player to spawn -
SwisherSweet - 06.07.2013
park4bmx, can you please explain to me because im kinda frustraited from this script it's been making me pretty mad today,
So basically that script detects if there are 10 people in a team and then OnPlayerspawn i need to do something? or on playerrequestclass?
edit:
so what i should do is
if(GetTeamPlayers(playerid) == EUROPE);
{
//code here
/return 1;
}
like this
Re: Let's player to spawn -
SwisherSweet - 06.07.2013
ok so i have 4 team
Europe
Usa
Russia
China
how whould i make it so if urope has 1 player then player must chose 3 other team
if europe = 1 player
usa = 1 player then player must chose russia or china
if europe = 1 player
if usa = 1 player
if russia = 1 player
then player must chose china
now
europe = 1
usa = 1
russia = 1
chian = 1 now player can select which ever team he want's and then when team get 2 it's un select able untill all teams have 2
Re: Let's player to spawn -
ReVo_ - 06.07.2013
Код:
new TeamPlayers [MAX_TEAMS];
Код:
new low_team, min_players = MAX_PLAYERS;
for (new i = 0; i < MAX_TEAMS; i ++) if (TeamPlayers[i] < min_players) min_players = TeamPlayers[i], low_team = i;
if (team_choosen_by_the_user != low_team)
{
GameTextForPlayer ( ... , "Team full! Choose another team" , ... );
return 0;
}
TeamPlayers [ team_choosen_by_the_user ] ++;
this bug if every team have same players num (can choose just last team) wait until i think a fix.
Re: Let's player to spawn -
SwisherSweet - 06.07.2013
Thank u im waiting
Re: Let's player to spawn -
ReVo_ - 06.07.2013
Код:
#define MAX_TEAMS 5
new
TeamPlayers [MAX_TEAMS];
enum {
TEAM_A,
TEAM_B,
TEAM_C,
TEAM_D,
TEAM_E
}
OnPlayerRequestSpawn
new WhereYouStoredYourClassid = 5;
new classid = WhereYouStoredYourClassid;
if
(
TeamPlayers [TEAM_A] == TeamPlayers [TEAM_B] &&
TeamPlayers [TEAM_A] == TeamPlayers [TEAM_C] &&
TeamPlayers [TEAM_A] == TeamPlayers [TEAM_D] &&
TeamPlayers [TEAM_A] == TeamPlayers [TEAM_E] &&
TeamPlayers [TEAM_B] == TeamPlayers [TEAM_C] &&
TeamPlayers [TEAM_B] == TeamPlayers [TEAM_D] &&
TeamPlayers [TEAM_B] == TeamPlayers [TEAM_E] &&
TeamPlayers [TEAM_C] == TeamPlayers [TEAM_D] &&
TeamPlayers [TEAM_C] == TeamPlayers [TEAM_E]
)
{
TeamPlayers [classid] ++;
return 1;
}
new
min_players,
team;
for (new i = 0; i < MAX_TEAMS; i ++) {
if (TeamPlayers [i] < min_players) {
min_players = TeamPlayers [i];
team = i;
}
}
if (classid != team)
{
return 0;
}
TeamPlayers [classid] ++;
Maybe something like this
Re: Let's player to spawn -
SwisherSweet - 06.07.2013
I'l test it tomorrow thanks
Re: Let's player to spawn -
SwisherSweet - 06.07.2013
what is this supposed to mean?
WhereYouStoredYourClassid