Player ID during chat (+Rep)
#1

How can i make if a player chat the his id will be there at last his name

for eg: Crazyboobs [24]: Text

Please help
Reply
#2

Код:
public OnPlayerText(playerid, text[])
{
	new 
		string[128],
		PlayerName[MAX_PLAYER_NAME];
	GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
	format(string, sizeof(string), "%s[%d]: {FFFFFF}%s", PlayerName, playerid, text);
	SendClientMessageToAll(GetPlayerColor(playerid), string)
}
Reply
#3

pawn Код:
public OnPlayerText(playerid, text[])
{
    new pname[24], string[128];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string, sizeof(string), "%s [i]: %s", pname, playerid, text);
    SendClientMessageToAll(COLOR_WHITE, string);
    return 0;
}
You can simply create a string, and make it so it gets the player name. Then, it creates the string with the text and the ID of the playerid (hence forth the playerid section where it shows the id)

Not sure if it works, but it may. Hope I explained it clearly, and if not, feel free to reply saying what you didn't understand or what you need explained more clearer.
Reply
#4

pawn Код:
public OnPlayerText(playerid, text[])
{
    new name[24], string[150];
    GetPlayerName(playerid, name, 24);
    format(string, sizeof(string), "%s [%d]: %s", name, playerid, text);
    SendClientMessageToAll(-1, string);
    return 0;
}
Then just add your colours in the string.
Reply
#5

Ok ty guys for the help +rep
Reply
#6

Everyone always seems to forget about: https://sampwiki.blast.hk/wiki/SendPlayerMessageToAll
No need to fetch the name with this.
Reply
#7

Quote:
Originally Posted by Vince
Посмотреть сообщение
Everyone always seems to forget about: https://sampwiki.blast.hk/wiki/SendPlayerMessageToAll
No need to fetch the name with this.
If you want it before the ':' then is SendClientMessageToAll the only option...
Reply
#8

Ok ty again
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)