[HELP]How to made
#4

Quote:
Originally Posted by K0P
Посмотреть сообщение
Make a global array variable:

Код:
new InDM[MAX_PLAYERS];
Set its value to 1 when the player joins the deathmatch

Код:
new InDM[playerid] = 1;
Set its value to 0 when the player leaves the deathmatch

Код:
new InDM[playerid] = 0;
Also set its value to 0 when the layer disconnects so it wont effect the other players who join the server

Код:
new InDM[playerid] = 0;
Now make a loop and count the players in deathmatch

Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
    if(IsPlayerConnected(i))
    {
        if(InDM[i] == 1)
        {
            count++;
        }
    
    }
}
Example command:

Код:
CMD:playersindm(playerid, params[])
{
    new count;
    new string[50];

    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(InDM[i] == 1)
            {
                count++;
            }   
        }
    }

    format(string, sizeof(string), "There are %d players in deathmatch", count);
    SendClientMessage(playerid, 0xFFFFFFFF, string);
    return 1;
}
I want this but without CMDlayersindm i wanna like when player enter in dm it say Hunud has joined in sniper dm - Total players: 1.
Reply


Messages In This Thread
[HELP]How to made - by Hunud - 23.07.2016, 18:27
Re: [HELP]How to made - by K0P - 23.07.2016, 18:47
Re: [HELP]How to made - by Kaliber - 23.07.2016, 18:48
Re: [HELP]How to made - by Hunud - 23.07.2016, 18:58
Re: [HELP]How to made - by FuNkYTheGreat - 23.07.2016, 19:04
Re: [HELP]How to made - by Stinged - 23.07.2016, 19:07

Forum Jump:


Users browsing this thread: 1 Guest(s)