15.12.2010, 20:17
Quote:
**How to say "No blue players online" when no blue players is online?**
|
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case(DIALOG_LOGIN_BLUE):
if(!response) { /* user cancelled */ } else
{
if(strcmp(inputtext, BLUE_PASSWORD, false, strlen(BLUE_PASSWORD)) == 0 && strlen(inputtext) > 0)
{
new names[MAX_PLAYER_NAME], string[44], bool:flag = false; // <--- ADDED flag VARIABLE HERE
for(new i=0; i<MAX_PLAYERS; i++)
{
if(GetPlayerColor(i) == 0x00137FAA) //0x00137FFAA = Blue color
{
if(!flag)
{
SendClientMessageToAll(0xDEEE20FF, "|_List of blue players_|");
flag = true;
}
GetPlayerName(i, names, sizeof(names));
format(string, sizeof(string), "%s(%d)",names ,playerid);
SendClientMessage(playerid, 0x7F0037AA, string);
}
}
if(!flag)
{
SendClientMessageToAll(0xDEEE20FF, "There are no players on the blue team.");
}
} else {
SendClientMessage(playerid, 0xDEEE20FF, "Incorrect password.");
}
return 1;
}
default:{printf("DEBUG: Undefined dialogid.");}
}
return 0;
}