How to count and show all players online in a DM zone.
#7

Your code is wrong. You must have a variable to verify in which game the player is.

Example:

PHP код:
enum
{
    
Game_None,
    
Game_LV,
    
Game_BS
};
new 
    
PlayerCount[2],
    
InDM[MAX_PLAYERS];  
CMD:lobby(playeridparams[])
{
    if(
InDM[playerid] == Game_None) return  SendClientMessage(playeridCOLOR_LIGHTBLUE"You are not inside any DM area.");
    
    switch(
InDM[playerid])
    {
        case 
Game_LVCountInDM[0] -= 1;
        case 
Game_BSCountInDM[1] -= 1;
    }
    
    
SpawnUser(playerid);
    
InDM[playerid] = Game_None;
    
SendClientMessage(playeridCOLOR_LIGHTBLUE"You have returned to the lobby.");
    return 
1;

And when you enter a game it would be something like this:

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch(
dialogid)
    {
        case 
DIALOG_DM:
        {
            if(
response)
            {
                switch(
listitem)
                {
                    case 
0:
                    {
                        
CountInDM[0] += 1;
                        
//code
                    
}
                    case 
1:
                    {
                        
CountInDM[1] += 1;
                        
//code
                    
}
                }
            }
            return 
1;
        }
    }
    return 
1;

Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)