SA-MP Forums Archive
Checking inputtext - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Checking inputtext (/showthread.php?tid=588678)



Checking inputtext - Balcan Fox - 11.09.2015

Hello,
I need to know how to check is inputtext[] an online player.
Код:
ShowPlayerDialog(playerid, dialogid, 1, "Title", "Enter ID/username", "ok", "cancel");
And now on OnDialogResponse, how to check is entered text an online player?


Re: Checking inputtext - BleverCastard - 11.09.2015

nevermind.


Re: Checking inputtext - Sellize - 11.09.2015

PHP код:
stock GetPlayerIdFromName(playername[])
{
  for(new 
0<= MAX_PLAYERSi++)
  {
    if(
IsPlayerConnected(i))
    {
      new 
playername2[MAX_PLAYER_NAME];
      
GetPlayerName(iplayername2sizeof(playername2));
      if(
strcmp(playername2playernametruestrlen(playername)) == 0)
      {
        return 
i;
      }
    }
  }
  return 
INVALID_PLAYER_ID;

Not mine.


Re: Checking inputtext - Vince - 11.09.2015

Ugh, simply use sscanf.