Need 2 players to start match
#1

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?
Reply
#2

Make a Variable So It Detects the Player's amount
Reply
#3

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;
}
Reply


Forum Jump:


Users browsing this thread: