Command: /id [player name or part of name]
#7

Try this:
pawn Код:
CMD:id(playerid, params[])
{
    new name[MAX_PLAYER_NAME], string[1024];
    if(sscanf(params, "s[24]", name)) return SendClientMessage(playerid, GREY, "Usage: /id [player name/part of name]");  
    new count = 0;
    new playername[MAX_PLAYER_NAME];
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            GetPlayerName(i, playername, MAX_PLAYER_NAME);
            if(strfind(playername, name, true) != -1)
            {
                if(count == 0)
                {
                    format(string,sizeof(string),"%s - ID %d",playername, i);
                    count++;
                    continue;
                }
                count++;
                format(string,sizeof(string),"%s\n%s - ID %d",string, playername, i);
            }
        }
    }
    if(count == 0) return SendClientMessage(playerid, WHITE, "No players were found.");
    SendClientMessage(playerid, WHITE, string);
    return 1;
}
Reply


Messages In This Thread
Command: /id [player name or part of name] - by JoelR - 31.12.2012, 10:58
Re: Command: /id [player name or part of name] - by JaKe Elite - 31.12.2012, 11:01
Re: Command: /id [player name or part of name] - by JoelR - 31.12.2012, 11:01
Re: Command: /id [player name or part of name] - by JaKe Elite - 31.12.2012, 11:03
Re: Command: /id [player name or part of name] - by Aldo. - 31.12.2012, 11:05
Re: Command: /id [player name or part of name] - by Konstantinos - 31.12.2012, 11:06
Re: Command: /id [player name or part of name] - by Threshold - 31.12.2012, 11:14
Re: Command: /id [player name or part of name] - by Vince - 31.12.2012, 11:19

Forum Jump:


Users browsing this thread: 1 Guest(s)