id part of name
#1

Hello i have create this for find player ID but all work good but have one problem on player id dont find it good so here is script
pawn Код:
dcmd_id(playerid, params[])
{
    if(!strlen(params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /id <part of name>");
    new players, Names[MAX_PLAYER_NAME];
    for(new i=0; i <= MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            GetPlayerName(i, Names, MAX_PLAYER_NAME);
            new len = strlen(Names);
            new bool:searched=false;
            for(new pos=0; pos <= len; pos++)
            {
                if(searched != true)
                {
                    if(strfind(Names,params,true) == pos)
                    {
                        players++;
                        SendClientMessage(playerid, 0xE89B5BBB, "Players found:");
                        format(string,sizeof(string),"> %s (ID:%d)",Names,playerid);
                        SendClientMessage(playerid, COLOR_WHITE ,string);
                        searched = true;
                    }
                }
            }
        }
    }
    if(players == 0)
    SendClientMessage(playerid, 0xFF0000FF, "Player not found.");
    return 1;
}
Thank you
Reply
#2

< Removed >
Reply
#3

Maybe this isnt the issue, but this line

pawn Код:
if(strfind(Names,params,true) == pos)
should be

pawn Код:
if(!strfind(Names,params,true))
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)