Raised This Month: $32 Target: $400
 8% 

[color chat]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 12-01-2009 , 10:40   [color chat]
Reply With Quote #1

Hi everyone, I just make another code can show color chat, I test it ,and work well, so I post it and hope some one can point out the bug if there is(are) bug(s), or if you think this code is so bad, please give me some good code than this ! because I don't think this topic and this topic is so good !

Note that: I come here for learning , so don't say anything hurt some one ! you can post your opinion here !

Thx all !!!

PHP Code:
/*
*
* @param  id -- set 0 to all player on server, else to one player who index equal id.
* @param  cid -- get the color index, don't set it equal 0.
* @param  color -- set the color (0 -- don't change; 1 -- Red color; 2 -- Blue color; 3 -- Grey color)
* @param  message -- cons message.
*
*/
public print_color(idcidcolor, const message[], any:...)
{
 new 
msg[192]
 
vformat(msgcharsmax(msg), message5)
 
/*      //if you want to use ML, enable
 replace_all(msg, charsmax(msg), "!g", "^x04")
 replace_all(msg, charsmax(msg), "!n", "^x01")
 replace_all(msg, charsmax(msg), "!t", "^x03")*/
 
new param
 
if (!cid) return
 else 
param cid
 
new team[32]
 
get_user_team(paramteam31)
 switch (
color)
 {
  case 
0msg_teaminfo(paramteam)
  case 
1msg_teaminfo(param"TERRORIST")
  case 
2msg_teaminfo(param"CT")
  case 
3msg_teaminfo(param"SPECTATOR")
 }
 if (
idmsg_saytext(idparammsg)
 else 
msg_saytext(0parammsg)
 if (
color != 0msg_teaminfo(paramteam)
}
msg_saytext(idcidmsg[])
{
 
message_begin(id?MSG_ONE:MSG_ALLget_user_msgid("SayText"), {0,0,0}, id)
 
write_byte(cid)
 
write_string(msg)
 
message_end()
}
msg_teaminfo(idteam[])
{
 
message_begin(MSG_ONEget_user_msgid("TeamInfo"), {0,0,0}, id)
 
write_byte(id)
 
write_string(team)
 
message_end()

color settings:

0 -- Don't change
1 -- Red color
2 -- Blue color
3 -- Grey color
__________________
QQ:116268742

Last edited by K.K.Lv; 12-02-2009 at 00:20.
K.K.Lv is offline
Send a message via MSN to K.K.Lv
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 12-01-2009 , 11:11   Re: [color chat]
Reply With Quote #2

Why did you not add green or current-team-color support?
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Cuchii
BANNED
Join Date: Sep 2009
Location: Cordoba,Argentina
Old 12-01-2009 , 12:00   Re: [color chat]
Reply With Quote #3

Quote:
Originally Posted by K.K.Lv View Post
Hi everyone, I just make another code can show color chat, I test it ,and work well, so I post it and hope some one can point out the bug if there is(are) bug(s), or if you think this code is so bad, please give me some good code than this ! because I don't think this topic and this topic is so good !

Note that: I come here for learning , so don't say anything hurt some one ! you can post your opinion here !

Thx all !!!

PHP Code:
public print_color(idcidcolormessage[])
{
 new 
team[32]
 
get_user_team(cidteam31)
 switch (
color)
 {
  case 
0msg_teaminfo(cidteam)
  case 
1msg_teaminfo(cid"TERRORIST")
  case 
2msg_teaminfo(cid"CT")
  case 
3msg_teaminfo(cid"SPECTATOR")
 }
 if (
idmsg_saytext(idcidmessage)
 else 
msg_saytext(0cidmessage)
 if (
color != 0msg_teaminfo(cidteam)
}
msg_saytext(idcidmsg[])
{
 
message_begin(id?MSG_ONE:MSG_ALLget_user_msgid("SayText"), {0,0,0}, id)
 
write_byte(cid)
 
write_string(msg)
 
message_end()
}
msg_teaminfo(idteam[])
{
 
message_begin(MSG_ONEget_user_msgid("TeamInfo"), {0,0,0}, id)
 
write_byte(id)
 
write_string(team)
 
message_end()

color settings:

0 -- Don't change
1 -- Red color
2 -- Blue color
3 -- Grey color
PHP Code:
stock ChatColor(const id, const input[], any:...)
{
    new 
count 1players[32]
    static 
msg[191]
    
vformat(msg190input3)
    
    
replace_all(msg190"!g""^4"// Green Color
    
replace_all(msg190"!y""^1"// Default Color
    
replace_all(msg190"!team""^3"// Team Color
    
replace_all(msg190"!team2""^0"// Team2 Color
    
    
if (idplayers[0] = id; else get_players(playerscount"ch")
    {
        for (new 
0counti++)
        {
            if (
is_user_connected(players[i]))
            {
                
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i])
                
write_byte(players[i]);
                
write_string(msg);
                
message_end();
            }
        }
    }

This was done by kiske...

I just brought it to this thread
Cuchii is offline
Send a message via MSN to Cuchii
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 12-02-2009 , 00:02   Re: [color chat]
Reply With Quote #4

@Exolent[jNr]
needn't add green and teamcolor,
try this
PHP Code:
print_color(idid0"^x04green ^x01normal ^x03teamcolor"
will show "green normal teamcolor or teamcolor or teamcolor "

@Cuchii
I ask you a question,
can you send a grey(red or blue) color for all player ?
I have seen your code, I think the answer is not !

and thx all !
the code has updated !

PHP Code:
print_color(idcidcolor, const msg[], any:...) 
__________________
QQ:116268742

Last edited by K.K.Lv; 12-02-2009 at 00:07.
K.K.Lv is offline
Send a message via MSN to K.K.Lv
matsi
Thinkosaur
Join Date: Sep 2006
Old 12-02-2009 , 10:46   Re: [color chat]
Reply With Quote #5

Quote:
Originally Posted by Cuchii View Post
PHP Code:
stock ChatColor(const id, const input[], any:...)
{
    new 
count 1players[32]
    static 
msg[191]
    
vformat(msg190input3)
    
    
replace_all(msg190"!g""^4"// Green Color
    
replace_all(msg190"!y""^1"// Default Color
    
replace_all(msg190"!team""^3"// Team Color
    
replace_all(msg190"!team2""^0"// Team2 Color
    
    
if (idplayers[0] = id; else get_players(playerscount"ch")
    {
        for (new 
0counti++)
        {
            if (
is_user_connected(players[i]))
            {
                
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i])
                
write_byte(players[i]);
                
write_string(msg);
                
message_end();
            }
        }
    }

This was done by kiske...

I just brought it to this thread
Firs time i saw that stock was in this post.
matsi is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 12-02-2009 , 23:43   Re: [color chat]
Reply With Quote #6

Quote:
Originally Posted by K.K.Lv View Post
@Exolent[jNr]
needn't add green and teamcolor,
try this
PHP Code:
print_color(idid0"^x04green ^x01normal ^x03teamcolor"
will show "green normal teamcolor or teamcolor or teamcolor "

@Cuchii
I ask you a question,
can you send a grey(red or blue) color for all player ?
I have seen your code, I think the answer is not !

and thx all !
the code has updated !

PHP Code:
print_color(idcidcolor, const msg[], any:...) 
Kiske didn't created that stock, he only posted it.
__________________
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^
vivek
BANNED
Join Date: Dec 2009
Old 12-18-2009 , 12:51   Re: [color chat]
Reply With Quote #7

for grey color wht should i do
vivek is offline
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 12-18-2009 , 22:15   Re: [color chat]
Reply With Quote #8

@vivek
PHP Code:
print_color(idid3"^x03grey" 

will print grey
__________________
QQ:116268742
K.K.Lv is offline
Send a message via MSN to K.K.Lv
worldspawn
Senior Member
Join Date: Aug 2009
Location: Russia, Yekaterinburg
Old 12-19-2009 , 05:05   Re: [color chat]
Reply With Quote #9

can you add green color?
and default of course

Last edited by worldspawn; 12-19-2009 at 05:25.
worldspawn is offline
Send a message via ICQ to worldspawn Send a message via Skype™ to worldspawn
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-19-2009 , 09:03   Re: [color chat]
Reply With Quote #10

Read the first post.
__________________
Arkshine 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 09:53.


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