How to know how match player joined the mission?
#1

I have a mission command. I want to know after 30 seconds how match players has joined the mission.

pawn Код:
dcmd_join(playerid, params[])
{
   SendClientMessage(playerid, Color, "You joined the mission " Get or die"");
   SetTimerEx("SpawnInMission",30000,0,"d",playerid);
   return 1;
}

public SpawnInMission()
{
  //How players joined the mission.
  //My other stuff that i dont want to show.
}
Reply
#2

pawn Код:
new MissionPlayers;

public SpawnInMission ( playerid )
{
    MissionPlayers++;
}
Reply
#3

Quote:
Originally Posted by ZamaXor
Посмотреть сообщение
I have a mission command. I want to know after 30 seconds how match players has joined the mission.

pawn Код:
dcmd_join(playerid, params[])
{
   SendClientMessage(playerid, Color, "You joined the mission " Get or die"");
   SetTimerEx("SpawnInMission",30000,0,"d",playerid);
   return 1;
}

public SpawnInMission()
{
  //How players joined the mission.
  //My other stuff that i dont want to show.
}
EDIT: Retardedwolf posted it.
Reply
#4

Quote:
Originally Posted by Kitten
Посмотреть сообщение
i could not understand u much but i think this is what u mean

pawn Код:
public SpawnInMission()
{
        new name[MAX_PLAYER_NAME], string[100];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "[MISSION] %s has gone to /mission", name );
        SendClientMessageToAll(your color, string);
        return 1;
}
No i mean something like that

pawn Код:
public SpawnInMission()
{
        new name[MAX_PLAYER_NAME], string[100];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "Mission started. Player in mission (GET THE NUMBER OF PLAYERS THAT JOINED THE MISSION)",name );
        SendClientMessageToAll(your color, string);
        return 1;
}
Reply
#5

Quote:
Originally Posted by ZamaXor
Посмотреть сообщение
No i mean something like that

pawn Код:
public SpawnInMission()
{
        new name[MAX_PLAYER_NAME], string[100];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "Mission started. Player in mission (GET THE NUMBER OF PLAYERS THAT JOINED THE MMISSION)", name );
        SendClientMessageToAll(your color, string);
        return 1;
}
Oh. SO is that what u needed?

EDIT: if u are not using name just use SendClientMessage(playerid,color,"Mission Started. Player in mission");
Reply
#6

Quote:
Originally Posted by Kitten
Посмотреть сообщение
Oh. SO is that what u needed?
I don't know how to do it. example "Mission has Started: Players (HOW MANY PLAYERS HAS JOINED THE MISSION)"

example "Mission has Started: Players (10)"
Reply
#7

use retardedwolf code

pawn Код:
new MissionPlayers;

public SpawnInMission ( playerid )
{
    MissionPlayers++;
    format(string, sizeof(string), "Mission started. Player in mission (%d)", MissionPlayers );
        SendClientMessageToAll(your color, string);
}
im not sure
Reply
#8

Example:

Put this under your command which the players use to join the mission:
pawn Код:
SetPVarInt(playerid, "missionJoined", true);
Put this where they leave the mission:
pawn Код:
SetPVarInt(playerid, "missionJoined", false);
This at the end of the script:
pawn Код:
stock TotalPlayersJoined()
{
    new
            i,
            totalPlayers
    ;
    for( ; i != MAX_PLAYERS; ++i)
    {
            if(IsPlayerConnected(i) && !IsPlayerNPC(i) && GetPVarInt(i, "missionJoined"))
            {
                    ++totalPlayers;
            }
    }
    return totalPlayers;
}
Then use it for example like this:
pawn Код:
format(string, sizeof(string), "Total players in the mission: %d", TotalPlayersJoined());
Reply
#9

Quote:
Originally Posted by RyDeR`
Посмотреть сообщение
Example:

Put this under your command which the players use to join the mission:
pawn Код:
SetPVarInt(playerid, "missionJoined", true);
Put this where they leave the mission:
pawn Код:
SetPVarInt(playerid, "missionJoined", false);
This at the end of the script:
pawn Код:
stock TotalPlayersJoined()
{
    new
            i,
            totalPlayers
    ;
    for( ; i != MAX_PLAYERS; ++i)
    {
            if(IsPlayerConnected(i) && !IsPlayerNPC(i) && GetPVarInt(playerid, "missionJoined"))
            {
                    ++totalPlayers;
            }
    }
    return totalPlayers;
}
Then use it for example like this:
pawn Код:
format(string, sizeof(string), "Total players in the mission: %d", TotalPlayersJoined());
pawn Код:
GetPVarInt(playerid, "missionJoined"))// This should not be player id but "i"
How to do so if atleast 3 players won't join the mission it will be canceled?
Reply
#10

wrong post
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)