max players in team -
gereter - 20.12.2010
Hello community,
I' m searching for long time now something with teams.
I have 4 teams but I don't want a team balance I want something like 2 players max in this team 10 in the others if there is less than 10 players in it you can join it or if it's 10 players so full, you can't (you click spawn but nothing happen).
(If someone can reminding me how to post code thanks (: )
Thanks for helping
Re: max players in team -
blackwave - 20.12.2010
Ok, first create a global variable (on the GM/FS top [depends what your using] )
And on the command / class selection, which redirects player for the team, add (DEPENDS WHAT YOUR USING) :
Also add the condition on the samewhere:
pawn Код:
if(count > 2) return GameTextForPlayer(playerid,"~r~There are already 2 people on this team",5000,5);
Re: max players in team -
gereter - 20.12.2010
how to post code ?
I want show you mine
Re: max players in team -
WillyP - 20.12.2010
Quote:
Originally Posted by gereter
how to post code ?
I want show you mine
|
[pawn] [ /pawn]
Without the spaces.
Re: max players in team -
gereter - 20.12.2010
OK thank you so here it is :
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
if(count > 2) return GameTextForPlayer(playerid,"~r~There are already 2 people on this team",5000,5);
if(gTeam[playerid] == BODYGUARD)
{
count++;
}
return 1;
}
Is it here?
I want do 2 max only for bodyguard ...
Re: max players in team -
WillyP - 20.12.2010
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
if(gTeam[playerid] == BODYGUARD)
{
count++;
if(count > 2) return GameTextForPlayer(playerid,"~r~There are already 2 people on this team",5000,5);
}
return 1;
}
Try that.
Re: max players in team -
gereter - 20.12.2010
I did and i have one warning:
pta.pwn(970) : warning 219: local variable "count" shadows a variable at a preceding level
Re: max players in team -
blackwave - 20.12.2010
Delete the:
On the top. It means the simbol is already defined, but the second one isn't in use. So, delete that
Re: max players in team -
WillyP - 20.12.2010
Quote:
Originally Posted by blackwave
Delete the:
On the top. It means the simbol is already defined, but the second one isn't in use. So, delete that
|
Why did you add that in?
It's not needed because it will always start from 0 unless you make it start at a different number.
Re: max players in team -
gereter - 20.12.2010
pta.pwn(257) : error 017: undefined symbol "count"
pta.pwn(257) : warning 215: expression has no effect
pta.pwn(25
: error 017: undefined symbol "count"
xD was better before