[HELP]How to block a player becoming grove if groves full - 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: [HELP]How to block a player becoming grove if groves full (
/showthread.php?tid=107685)
[HELP]How to block a player becoming grove if groves full -
Pawno_Master - 10.11.2009
Hello,
I have a GangWar server
And most of the time the people are all ther same gang
so more than half are aztecs
and other ones ar other gangs
now i want to make a limit that not more than 4 guys can enter a gang
i am using gTeam[MAX_PLAYERS]
So if somebody can explain me how to do this Thanks
Re: [HELP]How to block a player becoming grove if groves full -
Pawno_Master - 11.11.2009
Omg plzz people i know one of you knows and i really need this
Re: [HELP]How to block a player becoming grove if groves full -
Gergo1352 - 11.11.2009
Код:
new Player;
new GroveMembers = 0;
for(Player = 0; Player < GetMaxPlayers(); Player++)
{
if(IsPlayerConnected(Player) && gTeam[Player] == TEAM_GROVE)
{
GroveMembers++;
}
}
if(GroveMembers > 4)
{
SendClientMessage(playerid, 0xFFFFFFFF, "Grove is full!");
return 1;
}
Re: [HELP]How to block a player becoming grove if groves full -
bigcomfycouch - 11.11.2009
Код:
static gTeam[MAX_PLAYERS];
new GrovePeople;
#define GROVE 1
public OnPlayerRequestClass(playerid, classid)
{
if(gTeam[playerid] == GROVE) GrovePeople--;
if(classid == changethistoagrovestreetskin)
{
if(GrovePeople > 3)
{
SendClientMessage(playerid, COLOR_RED, "You cannot join this team because it is too full.");
return 0;
}
else
{
GrovePeople++;
gTeam[playerid] = GROVE;
return 1;
}
}
return 1;
}
it's not the most efficient code, not even sure if it works
Re: [HELP]How to block a player becoming grove if groves full -
Daren_Jacobson - 11.11.2009
why do people put gTeam as a global static? seems un-needed and bad if you actually are using multiple files (this doesn't mean includes, this means another .pwn that you tell the compiler to compile at the same time).
Re: [HELP]How to block a player becoming grove if groves full -
aspire5630 - 11.11.2009
Does this work?
Please get back to me :P