View Single Post
MAUGHOLD
Veteran Member
Join Date: Nov 2004
Location: CA USA
Old 01-15-2012 , 14:20   Re: Admin Rank Color Chat with Tags
Reply With Quote #7

I have a plugin for Dayofdefeat that changes the color of the admins name to a light sea foam green, so that everyone sees that an admin is talking. I paid Sylwester to code it for me and he never released it publicly. maybe I should release it.

Here is the source code.

Code:
#include <amxmodx>

#define MAX_PLAYERS 32

new g_team[MAX_PLAYERS+1]
new g_msgid_SayText
new g_msgid_PTeam
new g_said[MAX_PLAYERS+1][128]
new g_alive[MAX_PLAYERS+1]
new g_say_team[MAX_PLAYERS+1]
new g_max_players


public plugin_init(){
    register_plugin("DoD ColorChat", "1.1", "Sylwester")
    g_msgid_SayText = get_user_msgid("SayText")
    g_msgid_PTeam = get_user_msgid("PTeam")
    register_clcmd("say", "handle_say")
    register_clcmd("say_team", "handle_say_team")
    register_message(g_msgid_PTeam, "update_team")
    g_max_players = get_maxplayers()
}


public update_team(msg_id, msg_dest, id)
    g_team[get_msg_arg_int(1)] = get_msg_arg_int(2)


public handle_say_team(id){
    if(!(get_user_flags(id) & ADMIN_KICK))
        return PLUGIN_CONTINUE
    read_args(g_said[id], 127)
    remove_quotes(g_said[id])
    if(g_said[id][0] == '@' || strlen(g_said[id]) <= 0)
        return PLUGIN_HANDLED_MAIN
    new i, len = strlen(g_said[id])-1
    while(g_said[id][i] <= 32)
        if(++i>len)
            return PLUGIN_HANDLED_MAIN
    g_say_team[id] = 1
    g_alive[id] = is_user_alive(id)

    message_begin (MSG_BROADCAST, g_msgid_PTeam)
    write_byte (id)
    write_byte (4)
    message_end ()
    
    set_task(0.1, "delayed_say", id)
    return PLUGIN_HANDLED_MAIN
}


public handle_say(id){
    if(!(get_user_flags(id) & ADMIN_KICK))
        return PLUGIN_CONTINUE
    read_args(g_said[id], 127)
    remove_quotes(g_said[id])
    if(g_said[id][0] == '@' || strlen(g_said[id]) <= 0)
        return PLUGIN_HANDLED_MAIN
    new i, len = strlen(g_said[id])-1
    while(g_said[id][i] <= 32)
        if(++i>len)
            return PLUGIN_HANDLED_MAIN
    g_say_team[id] = 0
    g_alive[id] = is_user_alive(id)

    message_begin (MSG_BROADCAST, g_msgid_PTeam)
    write_byte (id)
    write_byte (4)
    message_end ()
    
    set_task(0.1, "delayed_say", id)
    return PLUGIN_HANDLED_MAIN
}


public delayed_say(id){
    static players[32], pnum, team, msg[128], name[32]
    team = get_user_team(id)
    pnum = 0
    get_user_name(id, name, 31)
    for(new i=1; i<=g_max_players; i++){
        if(i == id){
            players[pnum++] = i
            continue
        }
        if(!is_user_connected(i))
            continue
        if(!g_alive[id] && is_user_alive(i))
            continue
        if(g_say_team[id] && team != get_user_team(i))
            continue
        players[pnum++] = i
    }
    formatex(msg, 127, "%c%s%s%s: %s", 2, g_alive[id]?"":"(DEAD)", g_say_team[id]?"(TEAM)":"", name, g_said[id])

    for(new i=0; i<pnum; i++){
        message_begin (MSG_ONE, g_msgid_SayText, _, players[i])
        write_byte (id)
        write_string (msg)
        message_end ()
    }

    message_begin (MSG_BROADCAST, g_msgid_PTeam)
    write_byte (id)
    write_byte (g_team[id])
    message_end ()
}
Granted this does not differentiate between higher or lower ranked admins. You can try it for cs 1.6 and see if it works.
__________________
{FJ}Justice STEAM_0:0:633975 If anyone needs any help with their server, Just add me to steam friends and I'll help you out.

Last edited by MAUGHOLD; 01-15-2012 at 14:36.
MAUGHOLD is offline