SA-MP Forums Archive
Find ID - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Find ID (/showthread.php?tid=481522)



Find ID - keller012 - 16.12.2013

Good night.
I have a doubt. I wonder if you have any function for me to find the ID of the player by his nickname.
If someone can help I would be grateful.


Respuesta: Find ID - Cerealguy - 16.12.2013

pawn Код:
CMD:getid(playerid, params[])
{
    new str[1000], targetid, Name[MAX_PLAYER_NAME];
    if(sscanf(params, "u", targetid))
    {
        return 1;
    }
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]{FFFFFF} Player not connected");
    {
        GetPlayerName(targetid, Name1, sizeof(Name1));
        format(str, sizeof(str), "%s ID is: %d", Name1, targetid, str2);
        SendClientMessage(playerid, FF0066, str);
    }
    return 1;
}
test player name is Cerealguy and you type /getid Cereal or complete name, you recive message Cerealguy ID is: 1