Dialog Input player name?
#1

Hi.
Anyone know how to make a dialog input where you input a player's name in the dialog and if the player found?
Reply
#2

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");
}
Reply
#3

I will check and update, thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)