SA-MP Forums Archive
Player ID during chat (+Rep) - 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: Player ID during chat (+Rep) (/showthread.php?tid=331776)



Player ID during chat (+Rep) - Crazyboobs - 05.04.2012

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


Re: Player ID during chat (+Rep) - BlackBank - 05.04.2012

Код:
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)
}



Re: Player ID during chat (+Rep) - Kindred - 05.04.2012

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.


Re: Player ID during chat (+Rep) - [HiC]TheKiller - 05.04.2012

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.


Re: Player ID during chat (+Rep) - Crazyboobs - 05.04.2012

Ok ty guys for the help +rep


Re: Player ID during chat (+Rep) - Vince - 05.04.2012

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


Re: Player ID during chat (+Rep) - BlackBank - 05.04.2012

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...


Re: Player ID during chat (+Rep) - Crazyboobs - 05.04.2012

Ok ty again