How do I getplayerID and sendClinetMessage with it
#1

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

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
Reply
#3

Thanks bro
Reply
#4

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);
}
Reply
#5

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

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

No need for a command or a textdraw.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)