| vato loco [GE-S] |
11-20-2010 20:08 |
Re: need help with color chat
try this
PHP Code:
enum color { normal = 1, // clients scr_concolor cvar color green, // green Color team, // red, grey, blue grey, // grey red, // red blue, // blue }
new TeamName[][] = { "", "TERRORIST", "CT", "SPECTATOR" }
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) // Add your code here... }
ColorChat(const id, color:type, const input[], any:...) { new count = 1, players[32], Team, ColorChange static msg[256] switch(type) { case normal: msg[0] = 0x01 case green: msg[0] = 0x04 default: msg[0] = 0x03 } vformat(msg[1], 255, input, 4) msg[192] = '^0' replace_all(msg, 191, "!g", "^x04") // Green Color replace_all(msg, 191, "!y", "^x01") // Default Color replace_all(msg, 191, "!t", "^x03") // Team Color if (id) players[0] = id else get_players(players, count, "ch") for (new i = 0; i < count; i++) { Team = get_user_team(players[i]) ColorChange = ColorSelection(players[i], type) if(is_user_connected(players[i])) { message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]) write_byte(players[i]) write_string(msg) message_end() } if(ColorChange) Team_Info(players[i], TeamName[Team]) } }
Team_Info(id, Team[]) { message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("TeamInfo"), _, id) write_byte(id) write_string(Team) message_end() return 1 }
ColorSelection(id, color:Type) { switch(Type) { case red: return Team_Info(id, TeamName[1]) case blue: return Team_Info(id, TeamName[2]) case grey: return Team_Info(id, TeamName[0]) } return 0 }
|