Raised This Month: $51 Target: $400
 12% 

How to add colors to format function


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
yuvim86
Member
Join Date: Jan 2018
Old 01-12-2018 , 12:47   How to add colors to format function
Reply With Quote #1

I have a code , but i dont know how to add green color to texts like Killer etc in format function
PHP Code:
formatsBufferMAX_BUFFER_LENGTH,
                       
"Killed by %s with %s @ %0.0fm (%dhp, %dap) >>"t_sNamet_sWpn,
                       
distance(g_izUserAttackerDistance[id]),
                       
g_izKilled[id][KILLED_KILLER_HEALTH], g_izKilled[id][KILLED_KILLER_ARMOUR] ); 
yuvim86 is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 01-12-2018 , 13:04   Re: How to add colors to format function
Reply With Quote #2

Using client_color_print(), you can add ^1Default ^3Team ^4Green.
__________________
Relaxing is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-12-2018 , 14:13   Re: How to add colors to format function
Reply With Quote #3

The color is activated when sent through a function that supports it, like client_print_color in AMXX 1.8.3. format only creates the message - you can add colors in it, but you must send it through a function that supports them.
__________________

Last edited by OciXCrom; 01-12-2018 at 14:14.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
yuvim86
Member
Join Date: Jan 2018
Old 01-13-2018 , 11:35   Re: How to add colors to format function
Reply With Quote #4

Quote:
Originally Posted by OciXCrom View Post
The color is activated when sent through a function that supports it, like client_print_color in AMXX 1.8.3. format only creates the message - you can add colors in it, but you must send it through a function that supports them.
Can you convert that code in client_color_print().im noob and biginner
PHP Code:
formatsBufferMAX_BUFFER_LENGTH
                       
"Killed by %s with %s @ %0.0fm (%dhp, %dap) >>"t_sNamet_sWpn
                       
distance(g_izUserAttackerDistance[id]), 
                       
g_izKilled[id][KILLED_KILLER_HEALTH], g_izKilled[id][KILLED_KILLER_ARMOUR] ); 
Also i tried somehow converting
PHP Code:
client_print_color(id,id,"^4Killed by %s with %s @ %0.0fm (%dhp, %dap) >>", t_sName, t_sWpn,
distance(g_izUserAttackerDistance[id]),
g_izKilled[id][KILLED_KILLER_HEALTH], g_izKilled[id][KILLED_KILLER_ARMOUR] );

when compiled i get error saying
statsx (1).sma(905) : warning 217: loose indentation
statsx (1).sma(905) : error 017: undefined symbol "client_print_color"

Last edited by yuvim86; 01-13-2018 at 12:09.
yuvim86 is offline
yuvim86
Member
Join Date: Jan 2018
Old 01-13-2018 , 11:36   Re: How to add colors to format function
Reply With Quote #5

Quote:
Originally Posted by Relaxing View Post
Using client_color_print(), you can add ^1Default ^3Team ^4Green.
Can you convert that code in client_color_print().im noob and biginner
PHP Code:
formatsBufferMAX_BUFFER_LENGTH
                       
"Killed by %s with %s @ %0.0fm (%dhp, %dap) >>"t_sNamet_sWpn
                       
distance(g_izUserAttackerDistance[id]), 
                       
g_izKilled[id][KILLED_KILLER_HEALTH], g_izKilled[id][KILLED_KILLER_ARMOUR] ); 
yuvim86 is offline
yuvim86
Member
Join Date: Jan 2018
Old 01-13-2018 , 12:08   Re: How to add colors to format function
Reply With Quote #6

Quote:
Originally Posted by yuvim86 View Post
Can you convert that code in client_color_print().im noob and biginner
PHP Code:
formatsBufferMAX_BUFFER_LENGTH
                       
"Killed by %s with %s @ %0.0fm (%dhp, %dap) >>"t_sNamet_sWpn
                       
distance(g_izUserAttackerDistance[id]), 
                       
g_izKilled[id][KILLED_KILLER_HEALTH], g_izKilled[id][KILLED_KILLER_ARMOUR] ); 
Also i tried somehow converting
PHP Code:
client_print_color(id,id,"^4Killed by %s with %s @ %0.0fm (%dhp, %dap) >>"t_sNamet_sWpn,
                       
distance(g_izUserAttackerDistance[id]),
                       
g_izKilled[id][KILLED_KILLER_HEALTH], g_izKilled[id][KILLED_KILLER_ARMOUR] ); 
when compiled i get error saying
statsx (1).sma(905) : warning 217: loose indentation
statsx (1).sma(905) : error 017: undefined symbol "client_print_color"
yuvim86 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-13-2018 , 12:48   Re: How to add colors to format function
Reply With Quote #7

The function is only available in AMXX 1.8.3. Try my colorchat stock - https://forums.alliedmods.net/showthread.php?t=295046
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
yuvim86
Member
Join Date: Jan 2018
Old 01-14-2018 , 03:43   Re: How to add colors to format function
Reply With Quote #8

Quote:
Originally Posted by OciXCrom View Post
The function is only available in AMXX 1.8.3. Try my colorchat stock - https://forums.alliedmods.net/showthread.php?t=295046
comchat worked. Thanks
yuvim86 is offline
Reply



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 14:07.


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