command get id of player help
#7

pawn Код:
CMD:getid(playerid, params[])
{
    new name[24];
    if(sscanf(params, "s[24]", name)) return SendClientMessage(playerid, 0xFF0000FF, "Usage: /getid [name/id]");
    new Count = 0;
    new fstr[150];
    for(new i = 0; i < MAX_PLAYERS; i++) //foreach would be the better option...
    {
        if(IsPlayerConnected(i))
        {
            new playersname[24];
            GetPlayerName(i, playersname, 24);
            if(strfind(name, playersname, true) != -1)
            {
                format(fstr, sizeof(fstr), "%s (ID: %i)", playersname, i);
                SendClientMessage(playerid, 0xFFFF00FF, fstr);
                Count++;
                continue;
            }
        }
    }
    if(Count == 0) return SendClientMessage(playerid, 0xFF0000FF, "There were no matches found.");
    format(fstr, sizeof(fstr), "There was a total of %i potential matches found.", Count);
    SendClientMessage(playerid, 0x00FF00FF, fstr);
    return 1;
}
Hopefully this works for you, I haven't really used it before.
Reply


Messages In This Thread
command get id of player help - by NewbieScripter - 09.03.2013, 20:44
Re: command get id of player help - by DaRk_RaiN - 09.03.2013, 20:50
Re: command get id of player help - by NewbieScripter - 09.03.2013, 20:51
Re: command get id of player help - by DaRk_RaiN - 09.03.2013, 20:54
Re: command get id of player help - by mineralo - 09.03.2013, 21:00
Re: command get id of player help - by Hoda - 09.03.2013, 21:24
Re: command get id of player help - by Threshold - 09.03.2013, 23:26
AW: command get id of player help - by morocco - 09.03.2013, 23:44
Respuesta: command get id of player help - by JustBored - 09.03.2013, 23:53

Forum Jump:


Users browsing this thread: 5 Guest(s)