Need 2 players to start match - 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)
+--- Thread: Need 2 players to start match (
/showthread.php?tid=316274)
Need 2 players to start match -
COD - 06.02.2012
I'm currently making a Capture the flag mode
but i have no idea how to start this off for example spawning a will notify you, you need at-least 2 players to start the match how would i do that?
Re: Need 2 players to start match -
RockStar™ - 06.02.2012
Make a Variable So It Detects the Player's amount
Re: Need 2 players to start match -
Cameltoe - 06.02.2012
pawn Код:
#DEFINE TEAM_BLUE 1
#DEFINE TEAM_RED 2
new PlayerTeam[MAX_PLAYERS] = -1;
new RedTeam = 0;
new BlueTeam = 0;
new CTFStarted = 0;
forward CTFTimer();
command(joinctf, playerid, params[])
{
if(PlayerTeam[playerid] != -1) return SendClientMessage(playerid, 0x0, "You already joined ctf!");
if(ReadTeam > BlueTeam)
{
BlueTeam++;
PlayerTeam[playerid] = TEAM_BLUE;
SendClientMessage(playerid, 0x0, "Go Blue team!");
}
else
{
RedTeam++;
PlayerTeam[playerid] = TEAM_RED;
SendClientMessage(playerid, 0x0, "Go Red team!");
}
CTFTimer();
}
public CTFTimer()
{
if(BlueTeam > 0 && RedTeam > 0 && CTFStarted == 0)
{
for(new i; i > MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i)) continue;
SendClientMessage(playerid, 0x0, "CTF is starting, get ready!");
}
}
}
public OnGameModeInit()
{
SetTimer("CTFTimer", 5000, true);
return 1;
}