Player Search
#1

Hello, I have a question, how can a player search system only on certain characters of the name.
Ex: My name on server is TestPlayer and i use command only certain characters /command player, but on server is
two players with name Test1Player and Test2Player when I use the /command player, I get a message on server is two player with this characters. I use sscanf.
Image: http://s27.postimg.org/dd0lgtxkz/sa_mp_075.png, I use /id Mihai and show my all player with containing those characters.
When the number of players is less than 10 to show a message like: http://s10.postimg.org/nu9u1jpqh/sa_mp_075.png
Reply
#2

PHP код:
CMD:command(playeridparams[])
{
    new 
name[MAX_PLAYER_NAME], bool:checkstring[128];
    if(
sscanf(params"s[24]"name)) return SendClientMessage(playerid0"Usage: /command [name]");
    for(new 
i=0;i<MAX_PLAYERS;i++)
    {
         if(
IsPlayerConnected(i))
         {
              new 
pName[MAX_PLAYER_NAME];
              
GetPlayerName(ipNamesizeof(pName));
              if(!
strcmp(namepNametrue))
              {
                   
check=true;
                   
format(stringsizeof(string), "ID:%d, Name:%s."ipName);
                   
SendClientMessage(playerid0string);
              }
         }
    }
    if(!
check) return SendClientMessage(playerid0"There are no players playing with this name.");
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)