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

PHP код:
new 
    
PlayerCount[2],
    
bool:InDM[MAX_PLAYERS];  
CMD:dm(playeridparams[]) 
{
    if(
InDM[playerid]) return SendClientMessage(playeridCOLOR_LIGHTBLUE"You are already in a DM arena, do /lobby first."); 
    
    new 
str[350];
    
format(str350"{11799C}ID\t{11799C}Name\t{11799C}Players Online\n{9C9C9C}0\t{9C9C9C}Las Venturas Police Department\t%d players here\n{9C9C9C}1\t{9C9C9C}Big Smoke's Crack Factory\t%d players here"PlayerCount[0], PlayerCount[1]);
    
Dialog_Show(playeridDIALOG_DMDIALOG_STYLE_TABLIST_HEADERS"DM Arenas List"str"Enter""Close");
    return 
1

PHP код:
PlayerCount[0//players in the sand id 0
PlayerCount[1//players in the sand id 1 
Now when a player enters one of the arenas:

PHP код:
PlayerCount[0] += 1//when the player enters the arena "0"
PlayerCount[1] += 1//when the player enters the arena "1" 
Now when a player leaves one of the arenas:

PHP код:
PlayerCount[0] -= 1//when the player leaves the arena "0"
PlayerCount[1] -= 1; /when the player leaves the arena "1" 
If you are going to put more sands you must increase the variable "PlayerCount [2]"
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)