AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   add colors (https://forums.alliedmods.net/showthread.php?t=316872)

I AM NOOB 06-15-2019 01:40

add colors
 
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 ()
   }
}




thEsp 06-15-2019 04:00

Re: add colors
 
To what? Post the full source.

I AM NOOB 06-15-2019 04:48

Re: add colors
 
Quote:

Originally Posted by thEsp (Post 2655589)
To what? Post the full source.

edited

thEsp 06-15-2019 05:05

Re: add colors
 
You cannot add colors to StatusText. If you are aiming at someone, text will take his team color. Else, text will be yellow.


All times are GMT -4. The time now is 17:24.

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