Raised This Month: $ Target: $400
 0% 

ColorChat


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Eviatar Mor
Senior Member
Join Date: Jun 2014
Location: israel
Old 08-14-2014 , 09:56   ColorChat
Reply With Quote #1

Hey,
Someone Can Please Tell me how to use colorchat in code ?

Last edited by Eviatar Mor; 08-14-2014 at 09:57.
Eviatar Mor is offline
skz
Senior Member
Join Date: Jul 2014
Location: Portugal
Old 08-14-2014 , 10:03   Re: ColorChat
Reply With Quote #2

ColorChat (index, COLOR, "Text")

COLOR can be: GREY, RED, BLUE, NORMAL

To use different colors you this to add ^01, ^03 or ^04 before the word you want to collor

^01 - Normal Chat Color
^03 - Color that you choose in COLOR* (if you choose NORMAL, it will appear team collor, like CT = Blue, T = red and Spec = Grey)
^04 - Green
__________________

Last edited by skz; 08-14-2014 at 10:03.
skz is offline
Eviatar Mor
Senior Member
Join Date: Jun 2014
Location: israel
Old 08-14-2014 , 10:30   Re: ColorChat
Reply With Quote #3

Quote:
Originally Posted by skz View Post
ColorChat (index, COLOR, "Text")

COLOR can be: GREY, RED, BLUE, NORMAL

To use different colors you this to add ^01, ^03 or ^04 before the word you want to collor

^01 - Normal Chat Color
^03 - Color that you choose in COLOR* (if you choose NORMAL, it will appear team collor, like CT = Blue, T = red and Spec = Grey)
^04 - Green
i do what u say and look i have errors:
PHP Code:
ColorChat (idRED"^03 %s ^04 U Enabled ^03 Bhop"szName
(I Add The szName)

Last edited by Eviatar Mor; 08-14-2014 at 10:30.
Eviatar Mor is offline
skz
Senior Member
Join Date: Jul 2014
Location: Portugal
Old 08-14-2014 , 10:55   Re: ColorChat
Reply With Quote #4

Quote:
Originally Posted by Eviatar Mor View Post
i do what u say and look i have errors:
PHP Code:
ColorChat (idRED"^03 %s ^04 U Enabled ^03 Bhop"szName
(I Add The szName)
Copy the error that appears on your compiler
__________________
skz is offline
Eviatar Mor
Senior Member
Join Date: Jun 2014
Location: israel
Old 08-14-2014 , 11:13   Re: ColorChat
Reply With Quote #5

Quote:
Originally Posted by skz View Post
Copy the error that appears on your compiler
here is all the mod:
PHP Code:
#include <amxmodx>
#include <engine>

new g_bBhop33 ]
new 
szName33 ]

public 
plugin_init() 
{
    
register_clcmd("say /enablebhop","EnableCommand")
    
register_clcmd("say /disablebhop","DisableCommand")
}

public 
EnableCommand(id)
{
    
g_bBhopid ] = true
    get_user_name
(idszNamecharsmax(szName)) 
    
ColorChat (idRED"^03 %s ^04 U Enabled ^03 Bhop"szName)  
}

public 
DisableCommand(id)
{
    
g_bBhopid ] = false
    get_user_name
(idszNamecharsmax(szName))
    
ColorChat (idRED"^03 %s ^04 U Disabled ^03 Bhop"szName)  

}

//don't put messages here.
public client_PreThink(id)
{
    if(
is_user_alive(id))
    {
        if(
g_bBhop id ] && get_user_flags(id) & ADMIN_IMMUNITY)
        {
            new 
oldbuttons get_user_oldbutton(id);
            
oldbuttons &= ~IN_JUMP;
            
entity_set_int(idEV_INT_oldbuttonsoldbuttons);
        }
    }

and here the errors:
PHP Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c1997-2006 ITB CompuPhaseAMX Mod X Team

Error
Undefined symbol "ColorChat" on line 17
Warning
Expression has no effect on line 17
Warning
Expression has no effect on line 17
Error
Expected token";"but found ")" on line 17
Error
Invalid expressionassumed zero on line 17
Error
Too many error messages on one line on line 17

Compilation aborted
.
4 Errors.
Could not locate output file C:\Users\eviatar\Desktop\BhopForAdmins.amx (compile failed). 
Eviatar Mor is offline
popeye10
Senior Member
Join Date: May 2014
Location: Navi Mumbai (India)
Old 08-14-2014 , 10:07   Re: ColorChat
Reply With Quote #6

Step 1 : Copy the code below and add it to the last of your plugin's source.
PHP Code:
stock client_print_color(idtype, const text[], any:...)
{
 if(
type == print_chat)
 {
  new 
g_iMsgidSayText;
  
g_iMsgidSayText get_user_msgid("SayText");

  new 
szMsg[191], iPlayers[32], iCount 1;
  
vformat(szMsgcharsmax(szMsg), text3);

  
replace_all(szMsgcharsmax(szMsg), "!g","^x04");
  
replace_all(szMsgcharsmax(szMsg), "!n","^x01");
  
replace_all(szMsgcharsmax(szMsg), "!t","^x03");

  if(
id)
   
iPlayers[0] = id;
  else
   
get_players(iPlayersiCount"ch");

  for(new 
iCount i++)
  {
   if(!
is_user_connected(iPlayers[i]))
    continue;
   
   
message_begin(MSG_ONE_UNRELIABLEg_iMsgidSayText_iPlayers[i]);
   
write_byte(iPlayers[i]);
   
write_string(szMsg);
   
message_end();
  }
 }

popeye10 is offline
Eviatar Mor
Senior Member
Join Date: Jun 2014
Location: israel
Old 08-14-2014 , 10:29   Re: ColorChat
Reply With Quote #7

Quote:
Originally Posted by popeye10 View Post
Step 1 : Copy the code below and add it to the last of your plugin's source.
PHP Code:
stock client_print_color(idtype, const text[], any:...)
{
 if(
type == print_chat)
 {
  new 
g_iMsgidSayText;
  
g_iMsgidSayText get_user_msgid("SayText");

  new 
szMsg[191], iPlayers[32], iCount 1;
  
vformat(szMsgcharsmax(szMsg), text3);

  
replace_all(szMsgcharsmax(szMsg), "!g","^x04");
  
replace_all(szMsgcharsmax(szMsg), "!n","^x01");
  
replace_all(szMsgcharsmax(szMsg), "!t","^x03");

  if(
id)
   
iPlayers[0] = id;
  else
   
get_players(iPlayersiCount"ch");

  for(new 
iCount i++)
  {
   if(!
is_user_connected(iPlayers[i]))
    continue;
   
   
message_begin(MSG_ONE_UNRELIABLEg_iMsgidSayText_iPlayers[i]);
   
write_byte(iPlayers[i]);
   
write_string(szMsg);
   
message_end();
  }
 }

Thanks U your mod work...
Eviatar Mor is offline
popeye10
Senior Member
Join Date: May 2014
Location: Navi Mumbai (India)
Old 08-14-2014 , 10:07   Re: ColorChat
Reply With Quote #8

Step 2 :
After you add this code to your plugin you just have to replace all the client_print code.
I'll give an example, use your brain and do the rest with all the code.

Change this -
client_print(id,print_chat,"This is a normal chat message in your plugin")
to
client_print_color(id,print_chat,"!gThis is a !tcolored chat!n message which you edited!")

You can use these codes for color chats -
!g = Green
!n = Normal
!t = Team
popeye10 is offline
PreDominance
Member
Join Date: Jul 2014
Old 08-14-2014 , 10:24   Re: ColorChat
Reply With Quote #9

??? You don't have to add anything. Download the latest dev build of AMXMODX which has client_print_color already included...
PreDominance is offline
popeye10
Senior Member
Join Date: May 2014
Location: Navi Mumbai (India)
Old 08-14-2014 , 10:31   Re: ColorChat
Reply With Quote #10

ur welcome
popeye10 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:10.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode