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

add colors


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
I AM NOOB
Junior Member
Join Date: May 2019
Location: NEPAL BOARDER
Old 06-15-2019 , 01:40   add colors
Reply With Quote #1

how can i add color to the text below
like :- red, green , team color etc to this
PHP Code:
 formatex sMessagecharsmax sMessage ), "[HP: %i] [AP: %i]"get_user_health id ), get_user_armor id ) ) 
full source

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
 
#define FREQ_TASK 0.5
#define TASK_INFORMER 3956
 
new g_msgStatusTextg_msgStatusValue
 
public plugin_init ()
{
   
register_plugin "Player Status""1.0""Player Status" )
 
   
register_event "StatusValue""ev_ShowStatus""be""1=2""2!0" )
   
register_event "StatusValue""ev_HideStatus""be""1=1""2=0" )
 
   
RegisterHam Ham_Spawn"player""fw_PlayerSpawn_Post")
   
RegisterHam Ham_Killed"player""fw_PlayerKilled" )
 
   
g_msgStatusValue get_user_msgid "StatusValue" )
   
g_msgStatusText get_user_msgid "StatusText" )
}
 
public 
client_disconnect id )
{
   
remove_task id+TASK_INFORMER )
}
 
public 
fw_PlayerSpawn_Post id )
{
   if ( !
is_user_alive id ) || is_user_bot id ) )
      return
 
   
remove_task id+TASK_INFORMER )
   
set_task FREQ_TASK"ShowPlayerInfo"id+TASK_INFORMER, .flags "b" )
}
 
public 
fw_PlayerKilled victim )
{
   if ( 
is_user_bot victim ) )
      return
 
   
remove_task victim+TASK_INFORMER )
}
 
public 
ShowPlayerInfo id )
{
   
id -= TASK_INFORMER
 
   
static sMessage[191]
   
formatex sMessagecharsmax sMessage ), "[HP: %i] [AP: %i]"get_user_health id ), get_user_armor id ) )
 
   
message_begin MSG_ONE_UNRELIABLEg_msgStatusText, .player id )
   
write_byte )
   
write_string sMessage )
   
message_end ()
}
 
public 
ev_HideStatus id )
{
   if ( !
is_user_bot id ) && is_user_connected id ) )
   {
      
message_begin MSG_ONE_UNRELIABLEg_msgStatusText, .player id )
      
write_byte )
      
write_string "" )
      
message_end ()
 
      
remove_task id+TASK_INFORMER )
      
ShowPlayerInfo id+TASK_INFORMER )
      
set_task FREQ_TASK"ShowPlayerInfo"id+TASK_INFORMER, .flags "b" )
   }
}
 
public 
ev_ShowStatus id )
{
   if ( !
is_user_bot id ) && is_user_connected id ) ) 
   {
      
remove_task id+TASK_INFORMER )
 
      new 
iTarget read_data )
      new 
sMessage[191]
 
      if ( 
cs_get_user_team id ) == cs_get_user_team iTarget ) )
         
formatex sMessagecharsmax sMessage ), "NAME: %%p2 -hp: %i%%  -money¸: %i$"get_user_health iTarget ), cs_get_user_money iTarget ) )
      else
         
formatex sMessagecharsmax sMessage ), "^7Враг: %%p2" )
 
      
message_begin MSG_ONE_UNRELIABLEg_msgStatusText, .player id )
      
write_byte )
      
write_string sMessage )
      
message_end ()
          
      
message_begin MSG_ONE_UNRELIABLEg_msgStatusValue, .player id )
      
write_byte )
      
write_short iTarget )
      
message_end ()
   }
}


__________________
"Never think yourself as successfull ror DON because "
DON stands for DONKEY OF NATION

GIVE RESPECT = TAKE RESPECT

ONLY SIGNATURE , NO PERSONAL

Last edited by I AM NOOB; 06-15-2019 at 04:47.
I AM NOOB is offline
thEsp
BANNED
Join Date: Aug 2017
Old 06-15-2019 , 04:00   Re: add colors
Reply With Quote #2

To what? Post the full source.
thEsp is offline
I AM NOOB
Junior Member
Join Date: May 2019
Location: NEPAL BOARDER
Old 06-15-2019 , 04:48   Re: add colors
Reply With Quote #3

Quote:
Originally Posted by thEsp View Post
To what? Post the full source.
edited
__________________
"Never think yourself as successfull ror DON because "
DON stands for DONKEY OF NATION

GIVE RESPECT = TAKE RESPECT

ONLY SIGNATURE , NO PERSONAL
I AM NOOB is offline
thEsp
BANNED
Join Date: Aug 2017
Old 06-15-2019 , 05:05   Re: add colors
Reply With Quote #4

You cannot add colors to StatusText. If you are aiming at someone, text will take his team color. Else, text will be yellow.
thEsp 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 19:16.


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