SA-MP Forums Archive
How do I getplayerID and sendClinetMessage with it - 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: How do I getplayerID and sendClinetMessage with it (/showthread.php?tid=554986)



How do I getplayerID and sendClinetMessage with it - Flokx - 06.01.2015

How do I get player ID and when player use /myid it will send him a message with his ID?


Re: How do I getplayerID and sendClinetMessage with it - ABKPot - 06.01.2015

This should work:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/myid", true)) //Did the player type '/myid', if so continue...
    {
        new str[17]; //Create a string array to store the message with the variable.
        format(str, sizeof(str), "Your ID is %d", playerid); //Store the text and variable (playerid) in the string.
        return SendClientMessage(playerid, 0xFFFFFFFF, str); //Send the player the message.
    }
    return 1;
}
https://sampwiki.blast.hk/wiki/OnPlayerCommandText


Re: How do I getplayerID and sendClinetMessage with it - Flokx - 06.01.2015

Thanks bro


Re: How do I getplayerID and sendClinetMessage with it - VishvaJeet - 06.01.2015

pawn Код:
new str[24];
format(str,24,"Your ID: %d", playerid);
TextDrawSetString(<Your Text Draw>, str);
Example:
pawn Код:
new Text:Ping[MAX_PLAYERS];

public OnGameModeInt()
{
   for(new i=0; i<MAX_PLAYERS; i++)
   {
       Ping[i] = TextDrawCreate(Xpos, Ypos, " ");
       TextDrawFont(Ping[i], 2);
        .............
        .............
       TextDrawAlignment(Ping[i], 1); // 1= left, 2=center, 3=right
    }
}

public OnPlayerConnect(playerid);
{
    ForTextDrawShowPlayer(playerid, Ping[playerid]);
    new str[24];
    format(str,24,"Your ID: %d", playerid);
    TextDrawSetString(Ping[playerid], str);
}



Re: How do I getplayerID and sendClinetMessage with it - Flokx - 06.01.2015

Man, you got my back. Thanks a lot. I lost my mind and edited my post. Thanks again


Re: How do I getplayerID and sendClinetMessage with it - PowerPC603 - 06.01.2015

You can also press TAB in-game and see everyone's ID, including your own.

No need for a command or a textdraw.