Dear fellows, I would like to find a method into adding a tag next to the player's name and it's text (onPlayerChat( player, text )). However, I'm unable to add it next to the player.Name with either Message or ClientMessageToAll. How would I be able to add a tag like for ex. [Math Lover] player.Name?
I believe this is what you're looking for:
function onPlayerChat( player, text )
{
Message( "[#CC0000][TAG] [$FF]" + player.Name + ": " + text );
return 0; // You must return 0 for the server to not use the regular text
}
Yeah Use Xmairs Code or Get an Idea From DNUS Script
Quote from: Xmair on Aug 18, 2017, 04:21 AMI believe this is what you're looking for:
function onPlayerChat( player, text )
{
Message( "[#CC0000][TAG] [$FF]" + player.Name + ": " + text );
return 0; // You must return 0 for the server to not use the regular text
}
Question: Is this another method of color coding?
[$FF]
Quote from: DarkRaZoR^ on Aug 18, 2017, 02:41 PMQuote from: Xmair on Aug 18, 2017, 04:21 AMI believe this is what you're looking for:
function onPlayerChat( player, text )
{
Message( "[#CC0000][TAG] [$FF]" + player.Name + ": " + text );
return 0; // You must return 0 for the server to not use the regular text
}
Question: Is this another method of color coding?
[$FF]
[$FF] = original colour
For example:
ClientMessageToAll( "[#FF0000]Test [$FF]Test", 255, 255, 0 );
You'll notice the yellow colour is applied when I used [$FF]
Quote from: Xmair on Aug 18, 2017, 02:45 PMQuote from: DarkRaZoR^ on Aug 18, 2017, 02:41 PMQuote from: Xmair on Aug 18, 2017, 04:21 AMI believe this is what you're looking for:
function onPlayerChat( player, text )
{
Message( "[#CC0000][TAG] [$FF]" + player.Name + ": " + text );
return 0; // You must return 0 for the server to not use the regular text
}
Question: Is this another method of color coding?
[$FF]
[$FF] = original colour
For example:
ClientMessageToAll( "[#FF0000]Test [$FF]Test", 255, 255, 0 );
You'll notice the yellow colour is applied when I used [$FF]
Thank you for answering my question. I'll make an EDIT on this reply if your code worked.
Edit: This code isn't working for the reason maybe due to the mute system functionality.
Quote from: DarkRaZoR^ on Aug 18, 2017, 07:02 PMEdit: This code isn't working for the reason maybe due to the mute system functionality.
Post your onPlayerChat
Quote from: Xmair on Aug 19, 2017, 04:32 AMQuote from: DarkRaZoR^ on Aug 18, 2017, 07:02 PMEdit: This code isn't working for the reason maybe due to the mute system functionality.
Post your onPlayerChat
function onPlayerChat( player, text )
{
if ( IsMuted[ player.ID ] == true )
{
MessagePlayer("[#FF0000]Error: You had been muted.", player );
return 0;
}
local MUTE_DIVIDE = 1000;
if ( ( time() - antiSpamTime[ player.ID ] ) <= LIMIT_REP_TIME )
{
antiSpamWarnings[ player.ID ]++;
if ( antiSpamWarnings[ player.ID ] >= LIMIT_REP_SPAM )
{
if( !IsMuted[ player.ID ] )
{
IsMuted[ player.ID ] = true;
Message(format( "[#2aff00][Info][#FF0000] Auto-Muted: %s | Reason: spamming the chat. Duration: %d seconds ", player.Name,MUTE_TIME/MUTE_DIVIDE) );
NewTimer( "autounmute", MUTE_TIME.tointeger(),1, player.ID );
}
}
}
else
{
antiSpamWarnings[ player.ID ] = 0;
}
antiSpamTime[ player.ID ] = time();
if( IsMuted[ player.ID ] )
{
return 0;
MessagePlayer( "[#FF0000]Error: You have been muted.", player );
}
else return 1;
Message( "[#CC0000][User] [$FF]" + player.Name + ": " + text );
return 0; // You must return 0 for the server to not use the regular text
}
dafuq did I just see?
function onPlayerChat( player, text )
{
if ( IsMuted[ player.ID ] == true )
{
MessagePlayer("[#FF0000]Error: You have been muted.", player );
return 0;
}
local MUTE_DIVIDE = 1000;
if ( ( time() - antiSpamTime[ player.ID ] ) <= LIMIT_REP_TIME )
{
antiSpamWarnings[ player.ID ]++;
if ( antiSpamWarnings[ player.ID ] >= LIMIT_REP_SPAM )
{
if( !IsMuted[ player.ID ] )
{
IsMuted[ player.ID ] = true;
Message(format( "[#2aff00][Info][#FF0000] Auto-Muted: %s | Reason: spamming the chat. Duration: %d seconds ", player.Name,MUTE_TIME/MUTE_DIVIDE) );
NewTimer( "autounmute", MUTE_TIME.tointeger(),1, player.ID );
}
}
}
else
{
antiSpamWarnings[ player.ID ] = 0;
}
antiSpamTime[ player.ID ] = time();
Message( "[#CC0000][User] [$FF]" + player.Name + ": " + text );
return 0; // You must return 0 for the server to not use the regular text
}