Custom Tags in OnPlayerChat

Started by D4rkR420R, Aug 18, 2017, 01:42 AM

Previous topic - Next topic

D4rkR420R

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?

Xmair

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

}

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

W3aPoN^

Yeah Use Xmairs Code or Get an Idea From DNUS Script

D4rkR420R

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]

Xmair

Quote from: DarkRaZoR^ on Aug 18, 2017, 02:41 PM
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]
[$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]

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

D4rkR420R

Quote from: Xmair on Aug 18, 2017, 02:45 PM
Quote from: DarkRaZoR^ on Aug 18, 2017, 02:41 PM
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]
[$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.

D4rkR420R

Edit: This code isn't working for the reason maybe due to the mute system functionality.

Xmair

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

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

D4rkR420R

Quote from: Xmair on Aug 19, 2017, 04:32 AM
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

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
}

KAKAN

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
}
oh no

D4rkR420R