any way to get players id form the part of name
#5

pawn Код:
CMD:getid(playerid,params[]) {
    if(isnull(params)) return SendClientMessage(playerid,blue,"Correct Usage: /getid [part of nick]");
    new found, string[128], playername[MAX_PLAYER_NAME];
    format(string,sizeof(string),"Searched for: \"%s\" ",params);
    SendClientMessage(playerid,blue,string);
    for(new i=0; i <= MAX_PLAYERS; i++){
        if(IsPlayerConnected(i)){
            GetPlayerName(i, playername, MAX_PLAYER_NAME);
            new namelen = strlen(playername);
            new bool:searched=false;
            for(new pos=0; pos <= namelen; pos++){
                if(searched != true){
                    if(strfind(playername,params,true) == pos){
                        found++;
                        format(string,sizeof(string),"%d. %s (ID %d)",found,playername,i);
                        SendClientMessage(playerid, green ,string);
                        searched = true;}}}}}
    if(found == 0) SendClientMessage(playerid, lightblue, "No players have this in their nick");
    return 1;}
the cmd the I got made maybe it will work for you
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)