Monthly Target: $400 Donations: $44
 11% 

Colored Text Messages


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
feren02
Member
Join Date: Mar 2012
Old 05-11-2012 , 23:43   Colored Text Messages
Reply With Quote #1

Hi,

How can I put colored text messages using the:
1. .INI file but the script/function will come from the .SMA file
2. So that when I put [green] [/green] or [red] [/red] or [blue] [/blue] or [white] [/white] in the .INI file, i will get a colored text chat in-game.

I have a plugin of GHW that enables what I am requesting but I don't know how to incorporate it in my existing plugin I want to have colored text messages.

Here is the sample .INI content that I wish:

PHP Code:
]/eat
exact
don
't show
text
All
[green][o-cP` Battle Arena][/green] %name is eating%text.
don'
t log 
-With the above .INI content, the [o-cP` Battle Arena] should be green in text message in-game.

Here is the:
1. .SMA file = the file where the .ini file is based and gets functions (Where I want to incorporate the colored text messages function)

PHP Code:
/*
*   _______     _      _  __          __
*  | _____/    | |    | | \ \   __   / /
*  | |         | |    | |  | | /  \ | |
*  | |         | |____| |  | |/ __ \| |
*  | |   ___   | ______ |  |   /  \   |
*  | |  |_  |  | |    | |  |  /    \  |
*  | |    | |  | |    | |  | |      | |
*  | |____| |  | |    | |  | |      | |
*  |_______/   |_|    |_|  \_/      \_/
*
*
*
*  Last Edited: 01-05-08
*
*  ============
*   Changelog:
*  ============
*
*  v1.1
*    -Added advertise_len cvar
*
*  v1.0
*    -Initial Release
*
*/

#define VERSION    "1.1"

#include <amxmodx>
#include <amxmisc>

new configfile[200]
new 
logfile[200]

public 
plugin_init()
{
    
register_plugin("GHW Say Commands",VERSION,"GHW_Chronic")
    
register_cvar("say_commands_toggle","1")
    
register_concmd("amx_say_commands_toggle","cmd_toggle",ADMIN_LEVEL_C,"<1/on 0/off> Toggle the custom Say Commands off/on")
    
register_clcmd("say","hook_say")
    
register_clcmd("say_team","hook_say")
    
register_clcmd("client_commands","list_commands")
    new 
configsdir[200]
    
get_configsdir(configsdir,199)
    
format(configfile,199,"%s/say_commands.ini",configsdir)
    
format(logfile,199,"%s/say_commands_log.log",configsdir)
    
register_cvar("advrtise_len","500.0")
}

public 
client_putinserver(id)
{
    if(
get_cvar_num("advrtise_len")>0set_task(get_cvar_float("advrtise_len"),"advertise",id)
}

public 
client_disconnect(id)
{
    
remove_task(id)
}

public 
advertise(id)
{
    if(
get_cvar_num("say_commands_toggle"))
    {
        
client_print(id,print_chat,"[o-cP` Battle Arena] Type client_commands in console to view a list of useful client commands.")
    }
    
set_task(260.6,"advertise",id)
    return 
PLUGIN_HANDLED
}

public 
cmd_toggle(id,level,cid)
{
    if(!
cmd_access(id,level,cid,2))
    {
        return 
PLUGIN_HANDLED
    
}
    new 
arg1[32]
    
read_argv(1,arg1,31)
    if(
get_cvar_num("say_commands_toggle"))
    {
        if(
equali(arg1,"on") || equali(arg1,"1"))
        {
            
console_print(id,"Custom Say Commands Plugin is already toggled on.")
        }
        else
        {
            
console_print(id,"Custom Say Commands Plugin has been toggled off.")
            
set_cvar_num("say_commands_toggle",0)
        }
    }
    else if(!
get_cvar_num("say_commands_toggle"))
    {
        if(
equali(arg1,"on") || equali(arg1,"1"))
        {
            
console_print(id,"Custom Say Commands Plugin has been toggled on.")
            
set_cvar_num("say_commands_toggle",1)
        }
        else
        {
            
console_print(id,"Custom Say Commands Plugin is already toggled off.")
        }
    }
    return 
PLUGIN_HANDLED
}

public 
hook_say(id)
{
    if(!
get_cvar_num("say_commands_toggle") || !file_exists(configfile))
    {
        return 
PLUGIN_CONTINUE
    
}
    for(new 
i=0;i<=file_size(configfile,1) - 1;i++)
    {
        new 
read[32]
        new 
trash
        read_file
(configfile,i,read,31,trash)
        if(
containi(read,"]")==0)
        {
            new 
text[200]
            
read_args(text,199)
            
remove_quotes(text)
            
replace(read,31,"]","")
            new 
read2[32]
            
read_file(configfile,i+1,read2,31,trash)
            new 
bool:continuea=false
            
if(equali(read2,"exact") && containi(text,read)==0)
            {
                
continuea=true
            
}
            if(
equali(read2,"contain") && containi(text,read)!=-1)
            {
                
continuea=true
            
}
            if(
continuea)
            {
                new 
read3[32]
                
read_file(configfile,i+2,read3,31,trash)
                new 
show PLUGIN_CONTINUE
                
if(equali(read3,"don't show"))
                {
                    
show PLUGIN_HANDLED
                
}

                new 
read4[32]
                
read_file(configfile,i+3,read4,31,trash)
                if(
equali(read4,"MOTD"))
                {
                    new 
read5[200]
                    
read_file(configfile,i+4,read5,199,trash)

                    new 
name[32]
                    
get_user_name(id,name,31)
                    new 
hostname[32]
                    
get_cvar_string("hostname",hostname,31)
                    new 
ip[32]
                    
get_user_ip(0,ip,31,0)
                    new 
ping1loss1ping[8], loss[8]
                    
get_user_ping(id,ping1,loss1)                    
                    
format(ping,7,"%d",ping1)
                    
format(loss,7,"%d",loss1)
                    new 
date[32]
                    
format_time(date,31,"%m-%d-%Y",-1)
                    new 
time[32]
                    
format_time(time,31,"%H:%M",-1)
                    new 
map[32]
                    
get_mapname(map,31)
                    new 
frags1 get_user_frags(id)
                    new 
deaths1 get_user_deaths(id)
                    new 
frags[8], deaths[8]
                    
format(frags,7,"%d",frags1)
                    
format(deaths,7,"%d",deaths1)
                    new 
authid[32]
                    
get_user_authid(id,authid,31)
                    new 
team[32]
                    
get_user_team(id,team,31)
                    while(
contain(read5,"%name")!=-1)
                    {
                        
replace(read5,199,"%name",name)
                    }
                    while(
contain(read5,"%hostname")!=-1)
                    {
                        
replace(read5,199,"%hostname",hostname)
                    }
                    while(
contain(read5,"%ip")!=-1)
                    {
                        
replace(read5,199,"%ip",ip)
                    }
                    while(
contain(read5,"%ping")!=-1)
                    {
                        
replace(read5,199,"%ping",ping)
                    }
                    while(
contain(read5,"%loss")!=-1)
                    {
                        
replace(read5,199,"%loss",loss)
                    }
                    while(
contain(read5,"%date")!=-1)
                    {
                        
replace(read5,199,"%date",date)
                    }
                    while(
contain(read5,"%time")!=-1)
                    {
                        
replace(read5,199,"%time",time)
                    }
                    while(
contain(read5,"%map")!=-1)
                    {
                        
replace(read5,199,"%map",map)
                    }
                    while(
contain(read5,"%frags")!=-1)
                    {
                        
replace(read5,199,"%frags",frags)
                    }
                    while(
contain(read5,"%deaths")!=-1)
                    {
                        
replace(read5,199,"%deaths",deaths)
                    }
                    while(
contain(read5,"%authid")!=-1)
                    {
                        
replace(read5,199,"%authid",authid)
                    }
                    while(
contain(read5,"%team")!=-1)
                    {
                        
replace(read5,199,"%team",team)
                    }
                    while(
contain(text,read)!=-1)
                    {
                        
replace(text,199,read,"")
                    }
                    while(
contain(read5,"%text")!=-1)
                    {
                        
replace(read5,199,"%text",text)
                    }

                    if(
containi(read5,"HTTP://")==0)
                    {
                        new 
motdtext[500]
                        
format(motdtext,499,"<iframe src=^"%s^" border=1 width=100%% height=100%%>",read5)
                        
show_motd(id,motdtext,"Say Command MOTD")
                    }
                    else
                    {
                        
show_motd(id,read5,"Say Command MOTD")
                    } 
                    new 
read6[32]
                    
read_file(configfile,i+5,read6,31,trash)
                    if(
equali(read6,"log"))
                    {
                        new 
authida[32]
                        
get_user_authid(id,authida,31)
                        new 
namea[32]
                        
get_user_name(id,namea,31)
                        new 
tolog[300]
                        
format(tolog,299,"%s (%s) : %s",namea,authida,text)
                        
write_file(logfile,"",-1)
                        
write_file(logfile,tolog,-1)
                    }
                    return 
show;
                }
                if(
equali(read4,"text") || equali(read4,"center"))
                {
                    new 
printwhere print_chat
                    
if(equali(read4,"center"))
                    {
                        
printwhere print_center
                    
}
                    new 
read5[32]
                    
read_file(configfile,i+4,read5,31,trash)
                    new 
read6[200]
                    
read_file(configfile,i+5,read6,199,trash)




                    new 
name[32]
                    
get_user_name(id,name,31)
                    new 
hostname[32]
                    
get_cvar_string("hostname",hostname,31)
                    new 
ip[32]
                    
get_user_ip(0,ip,31,0)
                    new 
ping1loss1ping[8], loss[8]
                    
get_user_ping(id,ping1,loss1)
                    
format(ping,7,"%d",ping1)
                    
format(loss,7,"%d",loss1)
                    new 
date[32]
                    
format_time(date,31,"%m-%d-%Y",-1)
                    new 
time[32]
                    
format_time(time,31,"%H:%M",-1)
                    new 
map[32]
                    
get_mapname(map,31)
                    new 
frags1 get_user_frags(id)
                    new 
deaths1 get_user_deaths(id)
                    new 
frags[8], deaths[8]
                    
format(frags,7,"%d",frags1)
                    
format(deaths,7,"%d",deaths1)
                    new 
authid[32]
                    
get_user_authid(id,authid,31)
                    new 
team[32]
                    
get_user_team(id,team,31)
                    while(
contain(read6,"%name")!=-1)
                    {
                        
replace(read6,199,"%name",name)
                    }
                    while(
contain(read6,"%hostname")!=-1)
                    {
                        
replace(read6,199,"%hostname",hostname)
                    }
                    while(
contain(read6,"%ip")!=-1)
                    {
                        
replace(read6,199,"%ip",ip)
                    }
                    while(
contain(read6,"%ping")!=-1)
                    {
                        
replace(read6,199,"%ping",ping)
                    }
                    while(
contain(read6,"%loss")!=-1)
                    {
                        
replace(read6,199,"%loss",loss)
                    }
                    while(
contain(read6,"%date")!=-1)
                    {
                        
replace(read6,199,"%date",date)
                    }
                    while(
contain(read6,"%time")!=-1)
                    {
                        
replace(read6,199,"%time",time)
                    }
                    while(
contain(read6,"%map")!=-1)
                    {
                        
replace(read6,199,"%map",map)
                    }
                    while(
contain(read6,"%frags")!=-1)
                    {
                        
replace(read6,199,"%frags",frags)
                    }
                    while(
contain(read6,"%deaths")!=-1)
                    {
                        
replace(read6,199,"%deaths",deaths)
                    }
                    while(
contain(read6,"%authid")!=-1)
                    {
                        
replace(read6,199,"%authid",authid)
                    }
                    while(
contain(read6,"%team")!=-1)
                    {
                        
replace(read6,199,"%team",team)
                    }

                    while(
contain(text,read)!=-1)
                    {
                        
replace(text,199,read,"")
                    }
                    while(
contain(read6,"%text")!=-1)
                    {
                        
replace(read6,199,"%text",text)
                    }


                    if(
equali(read5,"All"))
                    {
                        
client_print(0,printwhere,"%s",read6)
                    }
                    else if(
equali(read5,"Player"))
                    {
                        
client_print(id,printwhere,"%s",read6)
                    }
                    else
                    {
                        for(new 
i2=1;i2<=32;i2++)
                        {
                            if(
is_user_connected(i2))
                            {
                                new 
team[32]
                                
get_user_team(i2,team,31)
                                if(
containi(team,read5)!=-1)
                                {
                                    
client_print(i2,printwhere,"%s",read6)
                                }
                            }
                        }
                    }
                    new 
read7[32]
                    
read_file(configfile,i+6,read7,31,trash)
                    if(
equali(read7,"log"))
                    {
                        new 
authida[32]
                        
get_user_authid(id,authida,31)
                        new 
namea[32]
                        
get_user_name(id,namea,31)
                        new 
tolog[300]
                        
format(tolog,299,"%s (%s) : %s",namea,authida,text)
                        
write_file(logfile,"",-1)
                        
write_file(logfile,tolog,-1)
                    }
                    return 
show;
                }
                if(
equali(read4,"hud"))
                {
                    new 
read5[200]
                    
read_file(configfile,i+4,read5,199,trash)
                    new 
redgreenblue
                    
if(equali(read5,"White"))
                    {
                        
red=255
                        green
=255
                        blue
=255
                    
}
                    else if(
equali(read5,"Indigo"))
                    {
                        
red=0
                        green
=255
                        blue
=255
                    
}
                    else if(
equali(read5,"Pink"))
                    {
                        
red=255
                        green
=0
                        blue
=128
                    
}
                    else if(
equali(read5,"Orange"))
                    {
                        
red=255
                        green
=128
                        blue
=64
                    
}
                    else if(
equali(read5,"Yellow"))
                    {
                        
red=255
                        green
=255
                    
}
                    else if(
equali(read5,"green"))
                    {
                        
green=255
                    
}
                    else if(
equali(read5,"blue"))
                    {
                        
blue=255
                    
}
                    else
                    {
                        
red=255
                    
}
                    
set_hudmessage(red,green,blue,-1.0,0.32,0,6.0,5.0)
                    new 
read6[32]
                    
read_file(configfile,i+5,read6,31,trash)
                    new 
read7[200]
                    
read_file(configfile,i+6,read7,199,trash)



                    new 
name[32]
                    
get_user_name(id,name,31)
                    new 
hostname[32]
                    
get_cvar_string("hostname",hostname,31)
                    new 
ip[32]
                    
get_user_ip(0,ip,31,0)
                    new 
ping1loss1ping[8], loss[8]
                    
get_user_ping(id,ping1,loss1)
                    
format(ping,7,"%d",ping1)
                    
format(loss,7,"%d",loss1)
                    new 
date[32]
                    
format_time(date,31,"%m-%d-%Y",-1)
                    new 
time[32]
                    
format_time(time,31,"%H:%M",-1)
                    new 
map[32]
                    
get_mapname(map,31)
                    new 
frags1 get_user_frags(id)
                    new 
deaths1 get_user_deaths(id)
                    new 
frags[8], deaths[8]
                    
format(frags,7,"%d",frags1)
                    
format(deaths,7,"%d",deaths1)
                    new 
authid[32]
                    
get_user_authid(id,authid,31)
                    new 
team[32]
                    
get_user_team(id,team,31)
                    while(
contain(read7,"%name")!=-1)
                    {
                        
replace(read7,199,"%name",name)
                    }
                    while(
contain(read7,"%hostname")!=-1)
                    {
                        
replace(read7,199,"%hostname",hostname)
                    }
                    while(
contain(read7,"%ip")!=-1)
                    {
                        
replace(read7,199,"%ip",ip)
                    }
                    while(
contain(read7,"%ping")!=-1)
                    {
                        
replace(read7,199,"%ping",ping)
                    }
                    while(
contain(read7,"%loss")!=-1)
                    {
                        
replace(read7,199,"%loss",loss)
                    }
                    while(
contain(read7,"%date")!=-1)
                    {
                        
replace(read7,199,"%date",date)
                    }
                    while(
contain(read7,"%time")!=-1)
                    {
                        
replace(read7,199,"%time",time)
                    }
                    while(
contain(read7,"%map")!=-1)
                    {
                        
replace(read7,199,"%map",map)
                    }
                    while(
contain(read7,"%frags")!=-1)
                    {
                        
replace(read7,199,"%frags",frags)
                    }
                    while(
contain(read7,"%deaths")!=-1)
                    {
                        
replace(read7,199,"%deaths",deaths)
                    }
                    while(
contain(read7,"%authid")!=-1)
                    {
                        
replace(read7,199,"%authid",authid)
                    }
                    while(
contain(read7,"%team")!=-1)
                    {
                        
replace(read7,199,"%team",team)
                    }
                    while(
contain(text,read)!=-1)
                    {
                        
replace(text,199,read,"")
                    }
                    while(
contain(read7,"%text")!=-1)
                    {
                        
replace(read7,199,"%text",text)
                    }



                    if(
equali(read6,"All"))
                    {
                        
show_hudmessage(0,"%s",read7)
                    }
                    else if(
equali(read6,"Player"))
                    {
                        
show_hudmessage(id,"%s",read7)
                    }
                    else
                    {
                        for(new 
i2=1;i2<=32;i2++)
                        {
                            if(
is_user_connected(i2))
                            {
                                new 
team[32]
                                
get_user_team(i2,team,31)
                                if(
containi(team,read6)!=-1)
                                {
                                    
show_hudmessage(i2,"%s",text)
                                }
                            }
                        }
                    }
                    new 
read8[32]
                    
read_file(configfile,i+7,read8,31,trash)
                    if(
equali(read8,"log"))
                    {
                        new 
authida[32]
                        
get_user_authid(id,authida,31)
                        new 
namea[32]
                        
get_user_name(id,namea,31)
                        new 
tolog[300]
                        
format(tolog,299,"%s (%s) : %s",namea,authida,tolog)
                        
write_file(logfile,"",-1)
                        
write_file(logfile,tolog,-1)
                    }
                    return 
show;
                }
            }
        }
    }
    return 
PLUGIN_CONTINUE
}

public 
list_commands(id)
{
    if(!
get_cvar_num("say_commands_toggle") || !file_exists(configfile))
    {
        
console_print(id,"Say Commands you can do:")
        
console_print(id,"-----|-----")
        
console_print(id,"None.")
        
console_print(id,"-----|-----")
        return 
PLUGIN_HANDLED
    
}
    
console_print(id,"Say Commands you can do:")
    
console_print(id,"-----|-----")
    for(new 
i=0;i<=file_size(configfile,1) - 1;i++)
    {
        new 
read[32]
        new 
trash
        read_file
(configfile,i,read,31,trash)
        if(
containi(read,"]")==0)
        {
            
replace(read,31,"]","")
            new 
read2[32]
            
read_file(configfile,i+1,read2,31,trash)
            if(
equali(read2,"exact"))
            {
                
console_print(id,"%s",read)
            }
        }
    }
    
console_print(id,"-----|-----")
    return 
PLUGIN_HANDLED

Here is the:
2. .INI file = the file where I input the commands I want to have in my server in simple way because it already gets the functions from the .SMA file.

PHP Code:
]/commands
exact
don
't show
motd
addons\amxmodx\configs\commands.txt
don'
t log

]/clanmembers
exact
don
't show
motd
addons\amxmodx\configs\clanmembers.txt
don'
t log

]/hello
exact
don
't show
hud
pink
All
%name says Hi to everyone!
don'
t log

]/bye
exact
don
't show
hud
pink
All
%name says Bye to everyone!
don'
t log

]/eat
exact
don
't show
text
All
[o-cP` Battle Arena] %name is eating%text.
don'
t log

]/drink
exact
don
't show
text
All
[o-cP` Battle Arena] %name is drinking%text.
don'
t log

]/lol
exact
don
't show
text
All
[o-cP` Battle Arena] %name is Laughing Out Loud :D.
don'
t log

]/sad
exact
don
't show
text
All
[o-cP` Battle Arena] %name is Sad T_T.
don'
t log

]/fb
exact
don
't show
text
All
[o-cP` Battle Arena] %name is Facebooking.
don'
t log

]/tweet
exact
don
't show
text
All
[o-cP` Battle Arena] %name is Tweeting.
don'
t log

]/youtube
exact
don
't show
text
All
[o-cP` Battle Arena] %name is watching in Youtube.
don'
t log

]/simsimi
exact
don
't show
text
All
[o-cP` Battle Arena] %name is talking with SimSimi.
don'
t log

]/afk
exact
don
't show
text
All
[o-cP` Battle Arena] %name will be Away From Keyboard.
don'
t log 
Here is the GHW plugin I have that has the function of what I am requesting:

PHP Code:

/*
*   _______     _      _  __          __
*  | _____/    | |    | | \ \   __   / /
*  | |         | |    | |  | | /  \ | |
*  | |         | |____| |  | |/ __ \| |
*  | |   ___   | ______ |  |   /  \   |
*  | |  |_  |  | |    | |  |  /    \  |
*  | |    | |  | |    | |  | |      | |
*  | |____| |  | |    | |  | |      | |
*  |_______/   |_|    |_|  \_/      \_/
*
*
*
*  Last Edited: 06-21-08
*
*  ============
*   Changelog:
*  ============
*
*  v2.1
*    -Bug Fix
*    -Changed String lengths from 128 - 256
*
*  v2.0
*    -Remake
*
*  v1.0
*    -Initial Release
*
*/

#define VERSION    "2.1"

#include <amxmodx>
#include <amxmisc>

#define NUM_MESSAGES    20
#define STRING_LEN    256

static const configfile[] = "addons/amxmodx/configs/messages.ini"
new text_messages[NUM_MESSAGES][STRING_LEN]
new 
hud_messages[NUM_MESSAGES][4][STRING_LEN]
new 
hud_message_colors[NUM_MESSAGES][4][3]
new 
saytext_msgid

new num_hudmessagesnum_textmessagescur_hudmessagecur_textmessage

public plugin_init()
{
    
register_plugin("GHW Auto Message Displayer",VERSION,"GHW_Chronic")

    
register_cvar("advertise_hud_len","60.0")
    
register_cvar("advertise_text_len","15.0")
    
register_cvar("advertise_hud_loc","1")

    
saytext_msgid get_user_msgid("SayText")

    
read_configfile()

    if(
num_hudmessagesset_task(get_cvar_float("advertise_hud_len"),"display_hudmessage",0,"",0,"b")
    if(
num_textmessagesset_task(get_cvar_float("advertise_text_len"),"display_textmessage",0,"",0,"b")
}

public 
read_configfile()
{
    new 
Fsize file_size(configfile,1)
    new 
read[STRING_LEN], trash
    
for(new i=0;i<Fsize;i++)
    {
        
read_file(configfile,i,read,STRING_LEN 1,trash)
        if(
containi(read,"Text")==0)
        {
            
read_file(configfile,i+1,read,STRING_LEN 1,trash)
            
replace_all(read,STRING_LEN 1,"[blue]","^x03")
            
replace_all(read,STRING_LEN 1,"[/blue]","^x01")
            
replace_all(read,STRING_LEN 1,"[red]","^x03")
            
replace_all(read,STRING_LEN 1,"[/red]","^x01")
            
replace_all(read,STRING_LEN 1,"[green]","^x04")
            
replace_all(read,STRING_LEN 1,"[/green]","^x01")
            
replace_all(read,STRING_LEN 1,"[Blue]","^x03")
            
replace_all(read,STRING_LEN 1,"[/Blue]","^x01")
            
replace_all(read,STRING_LEN 1,"[Red]","^x03")
            
replace_all(read,STRING_LEN 1,"[/Red]","^x01")
            
replace_all(read,STRING_LEN 1,"[Green]","^x04")
            
replace_all(read,STRING_LEN 1,"[/Green]","^x01")
            
format(text_messages[num_textmessages],STRING_LEN 1,"^x04^x01%s",read)
            
num_textmessages++
        }
        else if(
containi(read,"Hud")==0)
        {
            
read_file(configfile,i+1,read,STRING_LEN 1,trash)
            new 
0position 0;
            while(
position strlen(read) && i<4)
            {
                while(
contain(read[position]," ")==0position++
                if(
containi(read[position],"[blue]")==0)
                {
                    
format(hud_messages[num_hudmessages][j],STRING_LEN 1,"%s",read[position 6])
                    
position containi(read[position],"[/blue]") + position
                    trash 
containi(hud_messages[num_hudmessages][j],"[/blue]")
                    if(
trash!=-1hud_messages[num_hudmessages][j][trash] = 0
                    
else break;
                    
hud_message_colors[num_hudmessages][j][0] = 0
                    hud_message_colors
[num_hudmessages][j][1] = 0
                    hud_message_colors
[num_hudmessages][j][2] = 255
                
}
                else if(
containi(read[position],"[red]")==0)
                {
                    
format(hud_messages[num_hudmessages][j],STRING_LEN 1,"%s",read[position 5])
                    
position containi(read[position],"[/red]") + position
                    trash 
containi(hud_messages[num_hudmessages][j],"[/red]")
                    if(
trash!=-1hud_messages[num_hudmessages][j][trash] = 0
                    
else break;
                    
hud_message_colors[num_hudmessages][j][0] = 255
                    hud_message_colors
[num_hudmessages][j][1] = 0
                    hud_message_colors
[num_hudmessages][j][2] = 0
                
}
                else if(
containi(read[position],"[green]")==0)
                {
                    
format(hud_messages[num_hudmessages][j],STRING_LEN 1,"%s",read[position 7])
                    
position containi(read[position],"[/green]") + position
                    trash 
containi(hud_messages[num_hudmessages][j],"[/green]")
                    if(
trash!=-1hud_messages[num_hudmessages][j][trash] = 0
                    
else break;
                    
hud_message_colors[num_hudmessages][j][0] = 0
                    hud_message_colors
[num_hudmessages][j][1] = 255
                    hud_message_colors
[num_hudmessages][j][2] = 0
                
}
                else if(
containi(read[position],"[Yellow]")==0)
                {
                    
format(hud_messages[num_hudmessages][j],STRING_LEN 1,"%s",read[position 8])
                    
position containi(read[position],"[/Yellow]") + position
                    trash 
containi(hud_messages[num_hudmessages][j],"[/Yellow]")
                    if(
trash!=-1hud_messages[num_hudmessages][j][trash] = 0
                    
else break;
                    
hud_message_colors[num_hudmessages][j][0] = 255
                    hud_message_colors
[num_hudmessages][j][1] = 255
                    hud_message_colors
[num_hudmessages][j][2] = 0
                
}
                else if(
containi(read[position],"[Orange]")==0)
                {
                    
format(hud_messages[num_hudmessages][j],STRING_LEN 1,"%s",read[position 8])
                    
position containi(read[position],"[/Orange]") + position
                    trash 
containi(hud_messages[num_hudmessages][j],"[/Orange]")
                    if(
trash!=-1hud_messages[num_hudmessages][j][trash] = 0
                    
else break;
                    
hud_message_colors[num_hudmessages][j][0] = 255
                    hud_message_colors
[num_hudmessages][j][1] = 128
                    hud_message_colors
[num_hudmessages][j][2] = 64
                
}
                else if(
containi(read[position],"[Pink]")==0)
                {
                    
format(hud_messages[num_hudmessages][j],STRING_LEN 1,"%s",read[position 6])
                    
position containi(read[position],"[/Pink]") + position
                    trash 
containi(hud_messages[num_hudmessages][j],"[/Pink]")
                    if(
trash!=-1hud_messages[num_hudmessages][j][trash] = 0
                    
else break;
                    
hud_message_colors[num_hudmessages][j][0] = 255
                    hud_message_colors
[num_hudmessages][j][1] = 0
                    hud_message_colors
[num_hudmessages][j][2] = 128
                
}
                else if(
containi(read[position],"[Indigo]")==0)
                {
                    
format(hud_messages[num_hudmessages][j],STRING_LEN 1,"%s",read[position 8])
                    
position containi(read[position],"[/Indigo]") + position
                    trash 
containi(hud_messages[num_hudmessages][j],"[/Indigo]")
                    if(
trash!=-1hud_messages[num_hudmessages][j][trash] = 0
                    
else break;
                    
hud_message_colors[num_hudmessages][j][0] = 0
                    hud_message_colors
[num_hudmessages][j][1] = 255
                    hud_message_colors
[num_hudmessages][j][2] = 255
                
}
                else if(
containi(read[position],"[White]")==0)
                {
                    
format(hud_messages[num_hudmessages][j],STRING_LEN 1,"%s",read[position 8])
                    
position containi(read[position],"[/White]") + position
                    trash 
containi(hud_messages[num_hudmessages][j],"[/White]")
                    if(
trash!=-1hud_messages[num_hudmessages][j][trash] = 0
                    
else break;
                    
hud_message_colors[num_hudmessages][j][0] = 255
                    hud_message_colors
[num_hudmessages][j][1] = 255
                    hud_message_colors
[num_hudmessages][j][2] = 255
                
}
                else if(
                
containi(read[position],"[blue]")==-&&
                
containi(read[position],"[red]")==-&&
                
containi(read[position],"[green]")==-&&
                
containi(read[position],"[Yellow]")==-&&
                
containi(read[position],"[Orange]")==-&&
                
containi(read[position],"[Pink]")==-&&
                
containi(read[position],"[Indigo]")==-&&
                
containi(read[position],"[White]")==-1
                
)
                {
                    
format(hud_messages[num_hudmessages][j],STRING_LEN 1,"%s",read[position])
                    
hud_message_colors[num_hudmessages][j][0] = 255
                    hud_message_colors
[num_hudmessages][j][1] = 255
                    hud_message_colors
[num_hudmessages][j][2] = 255
                    position 
129
                
}
                else
                {
                    
format(hud_messages[num_hudmessages][j],STRING_LEN 1,"%s",read[position])
                    
position containi(read[position],"[") + position
                    trash 
containi(hud_messages[num_hudmessages][j],"[")
                    if(
trash!=-1hud_messages[num_hudmessages][j][trash] = 0
                    
else break;
                    
hud_message_colors[num_hudmessages][j][0] = 255
                    hud_message_colors
[num_hudmessages][j][1] = 0
                    hud_message_colors
[num_hudmessages][j][2] = 0
                
}
                
j++
            }
            
format(hud_messages[num_hudmessages][1],STRING_LEN 1,"^n%s",hud_messages[num_hudmessages][1])
            
format(hud_messages[num_hudmessages][2],STRING_LEN 1,"^n^n%s",hud_messages[num_hudmessages][2])
            
format(hud_messages[num_hudmessages][3],STRING_LEN 1,"^n^n^n%s",hud_messages[num_hudmessages][3])
            
num_hudmessages++
        }
    }
}

public 
display_hudmessage()
{
    new 
Float:loc[2]
    switch(
get_cvar_num("advertise_hud_loc"))
    {
        case 
2
        {
            
loc[0] = -1.0
            loc
[1] = -1.0
        
}
        default:
        {
            
loc[0] = -1.0
            loc
[1] = 0.2
        
}
    }
    
set_hudmessage(hud_message_colors[cur_hudmessage][0][0],hud_message_colors[cur_textmessage][0][1],hud_message_colors[cur_textmessage][0][2],loc[0],loc[1], 06.012.0,0.1,0.2,-1)
    
show_hudmessage(0,hud_messages[cur_hudmessage][0])
    if(
hud_messages[cur_hudmessage][1][2]!=0)
    {
        
set_hudmessage(hud_message_colors[cur_hudmessage][1][0],hud_message_colors[cur_textmessage][1][1],hud_message_colors[cur_textmessage][1][2],loc[0],loc[1], 06.012.0,0.1,0.2,-1)
        
show_hudmessage(0,hud_messages[cur_hudmessage][1])
    }
    if(
hud_messages[cur_hudmessage][2][4]!=0)
    {
        
set_hudmessage(hud_message_colors[cur_hudmessage][2][0],hud_message_colors[cur_textmessage][2][1],hud_message_colors[cur_textmessage][2][2],loc[0],loc[1], 06.012.0,0.1,0.2,-1)
        
show_hudmessage(0,hud_messages[cur_hudmessage][2])
    }
    if(
hud_messages[cur_hudmessage][3][6]!=0)
    {
        
set_hudmessage(hud_message_colors[cur_hudmessage][3][0],hud_message_colors[cur_textmessage][3][1],hud_message_colors[cur_textmessage][3][2],loc[0],loc[1], 06.012.0,0.1,0.2,-1)
        
show_hudmessage(0,hud_messages[cur_hudmessage][3])
    }
    
cur_hudmessage = (cur_hudmessage ) % num_hudmessages
}

public 
display_textmessage()
{
    new 
numplayers[32], player
    get_players
(players,num,"ch")
    for(new 
i=0;i<num;i++)
    {
        
player players[i]

        
message_begin(MSG_ONE,saytext_msgid,{0,0,0},player)
        
write_byte(player)
        
write_string(text_messages[cur_textmessage])
        
message_end()
    }
    
cur_textmessage = (cur_textmessage ) % num_textmessages

THANK YOU IN ADVANCED, LOOKING FORWARD!

Last edited by feren02; 05-11-2012 at 23:48.
feren02 is offline
feren02
Member
Join Date: Mar 2012
Old 05-19-2012 , 03:24   Re: Colored Text Messages
Reply With Quote #2

Can anybody offer assistance to me? Thanks!
feren02 is offline
Old 05-22-2012, 11:19
feren02
This message has been deleted by Exolent[jNr]. Reason: Don't bump until 2 weeks have passed since last post.
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 20:09.


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