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

Colored StatusText?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hzqst
Senior Member
Join Date: Jul 2008
Old 06-19-2010 , 08:49   Colored StatusText?
Reply With Quote #1

I tried vformat (code from zombieplague colored saytext) but not work
Also tried code from kzarg, no colored statustext message seen there
Sorry my bad English
hzqst is offline
vato loco [GE-S]
Veteran Member
Join Date: Oct 2006
Location: Germany
Old 06-20-2010 , 06:58   Re: Colored StatusText?
Reply With Quote #2

take a look on the code of
xPaw's
Aim Info + Country by xPaw

or this by Sylwester

PHP Code:
#include <amxmodx>
#include <fakemeta>

#define UPDATE_INTERVAL 0.5
#define TID_TIMER 26642

new g_max_players
new g_timer_entid
new Float:g_t_time
new g_HSO

new pc_enabled
new pc_team_color
new pc_details

new g_target[33]
new 
g_name[33][32]
new 
g_weap_name[32][32] = {"""p228""""scout""HE",
"xm1014""c4""mac10""aug""SG""elite",
"fiveseven""ump45""sg550""galil""famas""usp""glock",
"awp""mp5""m249""m3""m4a1""tmp",
"g3sg1""FB""deagle""sg552""ak47",
"knife""p90"""}
new 
g_hp[33]
new 
g_ap[33]
new 
g_weapon[33]
new 
g_team[33]

public 
plugin_init(){
    
register_plugin("Target Info on HUD""1.1""Sylwester")

    
register_message(get_user_msgid("StatusValue"), "update_target")
    
register_message(get_user_msgid("Health"), "update_hp")
    
register_message(get_user_msgid("Battery"), "update_ap")
    
register_message(get_user_msgid("CurWeapon"), "update_weapon")
    
register_event("TeamInfo""join_team","a")

    
pc_enabled register_cvar("ti_enabled""1"//0 - plugin disabled //1 - plugin enabled
    
pc_team_color register_cvar("ti_team_color""1"//0-same color for all teams//1-team color
    
pc_details register_cvar("ti_details""2"//0-only name//1-show details//2-teammates details

    
g_max_players get_maxplayers()
    
g_HSO CreateHudSyncObj()
    
create_timer()
}


public 
update_weapon(msg_idmsg_destid){
    if(
get_msg_arg_int(1))
        
g_weapon[id] = get_msg_arg_int(2)
}


public 
update_hp(msg_idmsg_destid){
    
g_hp[id] = get_user_health(id)
}


public 
update_ap(msg_idmsg_destid){
    
g_ap[id] = get_user_armor(id)
}


public 
update_target(msg_idmsg_destid){
    if(
get_msg_arg_int(1) == 2)
        
g_target[id] = get_msg_arg_int(2)
}


public 
client_connect(id){
    
g_target[id] = 0
    g_team
[id] = 0
    get_user_name
(idg_name[id], 31)
}


public 
client_infochanged(id){ //update name
    
get_user_info(id"name"g_name[id], 31)
}


public 
join_team(){
    static 
idteam[2]
    
id read_data(1)
    
read_data(2team1)
    switch(
team[0]){
        case 
'C'g_team[id] = 2
        
case 'T'g_team[id] = 1
        
default : g_team[id] = 0
    
}
}


public 
create_timer(){
    
g_timer_entid engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString,"info_target"))

    if(
pev_valid(g_timer_entid)){
        
set_pev(g_timer_entidpev_classname"ti_timer")
        
global_get(glb_timeg_t_time)
        
set_pev(g_timer_entidpev_nextthinkg_t_time UPDATE_INTERVAL)
        
register_forward(FM_Think"fwd_Think")
    }else{
        
log_amx("Warning: Failed to create timer entity, using task instead.")
        
set_task(UPDATE_INTERVAL"timer_cycle"TID_TIMER""0"b")
    }
}


public 
fwd_Think(Ent){
    if(
Ent != g_timer_entid)
        return 
FMRES_IGNORED
    g_t_time 
+= UPDATE_INTERVAL
    set_pev
(Entpev_nextthinkg_t_time)
    
timer_cycle()
    return 
FMRES_IGNORED
}


public 
plugin_unpause(){
    if(
pev_valid(g_timer_entid)){
        
global_get(glb_timeg_t_time)
        
g_t_time += UPDATE_INTERVAL
        set_pev
(g_timer_entidpev_nextthinkg_t_time)
    }
}


public 
timer_cycle(){
    static 
idcache[512], tarposdetailsteam_color
    
if(get_pcvar_num(pc_enabled) == 0)
        return
    
details get_pcvar_num(pc_details)
    
team_color get_pcvar_num(pc_team_color)
    for(
id 1id<=g_max_playersid++){
        if(!
is_user_alive(id) || g_target[id] == 0)
            continue
        
tar g_target[id]
        if(
team_color == 0){
            
set_hudmessage(25015050, -1.00.531_UPDATE_INTERVAL-0.10.10.1, -1)
        }else{
            switch(
g_team[tar]){
                case 
1set_hudmessage(2553030, -1.00.531_UPDATE_INTERVAL-0.10.10.1, -1)
                case 
2set_hudmessage(3030255, -1.00.531_UPDATE_INTERVAL-0.10.10.1, -1)
                default: 
set_hudmessage(150150150, -1.00.531_UPDATE_INTERVAL-0.10.10.1, -1)
            }
        }

        
pos formatex(cache511"%s"g_name[tar])
        if(
details == || (details == && g_team[id] == g_team[tar]))
            
pos += formatex(cache[pos], 511-pos" -- %d HP / %d AP / %s"g_hp[tar], g_ap[tar], g_weap_name[g_weapon[tar]])
        
ShowSyncHudMsg(idg_HSOcache)
    }


Attached Thumbnails
Click image for larger version

Name:	ss.PNG
Views:	270
Size:	75.2 KB
ID:	68047   Click image for larger version

Name:	ss2.PNG
Views:	381
Size:	92.8 KB
ID:	68048  
__________________

Last edited by vato loco [GE-S]; 06-20-2010 at 07:17.
vato loco [GE-S] is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 06-20-2010 , 07:27   Re: Colored StatusText?
Reply With Quote #3

He wants StatusText, not HUD message.
__________________
hleV is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 06-20-2010 , 12:47   Re: Colored StatusText?
Reply With Quote #4

In the comments of my Player Look plugin, you can read more about StatusText and StatusValue.

tl;dr: you can only have colors in StatusText if you have a player's name in there as well (it will be that player's designated team color: red,blue,gray)
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 06-20-2010 , 12:58   Re: Colored StatusText?
Reply With Quote #5

Oh, i have a question about this... is possible to show COLORED StatusText without aiming a player? i tried but didn't work... but maybe is there any other method... (or with orpheu?)
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
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 10:24.


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