02.08.2014, 21:40
(
Последний раз редактировалось Zume; 02.08.2014 в 21:56.
Причина: Add response.
)
Quote:
I want that it opens a menu (ShowPlayerDialog) with options, if i select an option for example Police it shows me the members online: [number] and under the names
|
pawn Код:
#define ONLINE_FACTS 3246
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case ONLINE_FACTS:
{
if(response)
{
new string[16], name[24], count;
switch(listitem)
{
case 0:
{
foreach(Player, i)
{
if(PlayerInfo[i][Faction] == listitem+1 /*or FACTIONID */ && IsPlayerConnected(i)) count++;
}
format(string, sizeof(string), "---- %d members actives. ----", count);
SendClientMessage(playerid, -1, string);
foreach(Player,i)
{
if(PlayerInfo[i][Faction] == listitem+1 /*or FACTIONID */ && IsPlayerConnected(i))
{
GetPlayerName(i, name, 24), format(string, sizeof(string), "%d. %s", i, name);
if(strlen(string) > 0) SendClientMessage(playerid, -1, string);
}
}
}
//
}
}
}
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/fazioni", cmdtext, true, 10) == 0)
{
ShowPlayerDialog(playerid, ONLINE_FACTS, DIALOG_STYLE_LIST, "Online members of factions", "Polices\n", "See", "Back");
return 1;
}
return 0;
}