06.01.2015, 01:10
How do I get player ID and when player use /myid it will send him a message with his ID?
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;
}
new str[24];
format(str,24,"Your ID: %d", playerid);
TextDrawSetString(<Your Text Draw>, str);
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);
}