Count Players in Map
#1

Hello,

I have a define :-
pawn Код:
if(DerbyStartedMap1 == 0)
{
      //styufff
      DerbyStartedMap1 = 1;
}
I Want something that i could get like the Last player in that Map.
He/she should get a Message :- You have won the derby.

If anyone can make this, I Will appreciate it.
Thanks.
Reply
#2

When will the players leave the map? Upon death? Or when?

Create a new global variable;

PHP код:
new PlayersInDerby 0
playervariable:

PHP код:
InDerby[MAX_PLAYERS]; 
When they write the command or any other way to join the derby:

PHP код:
PlayersInDerby ++; 
InDerby[playerid] = 1;

When they leave;

InDerby[playerid] = 0;
PHP код:
PlayersInDerby --; 
PHP код:
if(PlayersInDerby == 1
{
        foreach(
Playeri)
    {
               if(
IsPlayerConnected(i))
          {
                     if(
InDerby[i] == 1)
                     {
                             
format(stringsizeof(string), "Player ID %d has won the derby!"i);
                             
SendClientMessageToAll(0xFFFFFFFstring);
                     }
              }
         }

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)