20.06.2013, 10:56
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case D_FINDPLAYER:
{
if(strlen(inputtext) == 0) return ShowExampleDialog(playerid,"Error: No input!");
new name[MAX_PLAYER_NAME+1], string[MAX_PLAYER_NAME+1*20];
string = "";
for(new players = 0; players < MAX_PLAYERS; players++)
{
if(!IsPlayerConnected(players)) continue;
GetPlayerName(players, name, sizeof(name));
if(strfind(name, input, true) != -1)
{
strcat(string, name);
strcat(string, "\n");
}
}
if(strlen(string) == 0) string = "No players were found";
else
{
ShowExampleDialog(playerid,string);
}
}
}
return 0;
}
stock ShowExampleDialog(playerid,input[])
{
new string[100];
string = "Enter a player's name / part of it";
if(strlen(input) > 0)
{
strcat(string, "\n");
strcat(string, input);
}
ShowPlayerDialog(playerid, D_FINDPLAYER, DIALOG_STYLE_INPUT, "Search for players", string, "Search", "Close");
}