SA-MP Forums Archive
[HELP] Adding ID's INTO CHAT!! PLEASE HELP - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Adding ID's INTO CHAT!! PLEASE HELP (/showthread.php?tid=131222)



[HELP] Adding ID's INTO CHAT!! PLEASE HELP - will_92 - 02.03.2010

How could i add the player's id into the chat?? So that it appears [id][player]:Text <----But stays with their teamcolor


Re: [HELP] Adding ID's INTO CHAT!! PLEASE HELP - Gamer_Z - 02.03.2010

same easy as to get ot the hell ;P
pawn Код:
public OnPlayerText(playerid,text[]){
        new String[256];
        format(String, 256, "(%d): %s", playerid, text);
        SendPlayerMessageToAll(playerid,String);
        return 0;// return 0 !!!! otherwise you get a double chat message
}



Re: [HELP] Adding ID's INTO CHAT!! PLEASE HELP - will_92 - 02.03.2010

is there a way to get it coloured?


Re: [HELP] Adding ID's INTO CHAT!! PLEASE HELP - will_92 - 02.03.2010

like how would i make it be able to set their team colours with it?


Re: [HELP] Adding ID's INTO CHAT!! PLEASE HELP - [HiC]TheKiller - 02.03.2010

What's wrong with http://forum.sa-mp.com/index.php?top...8596#msg928596 ?


Re: [HELP] Adding ID's INTO CHAT!! PLEASE HELP - ev0lution - 02.03.2010

Quote:
Originally Posted by [HiC
He wants the ID as part of the name, so it's coloured.

You can change their name under OnPlayerText**, use SendPlayerMessageToAll to send their text from their new name, change their name back, return 0 for the original text.

** Check if their name is over 15 characters, make sure it's not. The highest player ID is is 499, "[499]" is 5 characters, and the maximum name is 20 characters. You wouldn't be able to change it if their ID was 100-499 and they had a name longer than 15 characters.


Re: [HELP] Adding ID's INTO CHAT!! PLEASE HELP - Gozerr - 02.03.2010

pawn Код:
public OnPlayerText(playerid, text[])
{
new str[160];
new name[32];
GetPlayerName(playerid, name, sizeof(name));
format(str, sizeof(str), "%s(%d): %s", name, playerid, text);
SendClientMessageToAll(0xFFFFFFAA, str); // Replace the 0xFFFFFFAA (White) with some team color checking
return 0;
}



Re: [HELP] Adding ID's INTO CHAT!! PLEASE HELP - Gamer_Z - 02.03.2010

Quote:
Originally Posted by Gozerr
pawn Код:
public OnPlayerText(playerid, text[])
{
new str[160];
new name[32];
GetPlayerName(playerid, name, sizeof(name));
format(str, sizeof(str), "%s(%d): %s", name, playerid, text);
SendClientMessageToAll(0xFFFFFFAA, str); // Replace the 0xFFFFFFAA (White) with some team color checking
return 0;
}
the playername will also be white, but if it is what he wants.. ok ;p

Quote:
Originally Posted by [HiC
TheKiller ]
pawn Код:
public OnPlayerText(playerid, text[])
{
  new str[9];
  format(str, 9, "(%d) ", playerid);
  strins(text, str, 0);  
  return 1;
}
1234 posts :P.
ye also a good method..