Raised This Month: $ Target: $400
 0% 

Add color to the chat plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
VenomMix
Member
Join Date: Nov 2018
Old 04-06-2019 , 02:02   Re: Add color to the chat plugin
Reply With Quote #1

HTML Code:
#include <amxmodx>
#include <amxmisc>
#include <ColorChat>

new g_msgChannel

#define MAX_CLR 10

new amx_show_activity;
new g_AdminChatFlag = ADMIN_CHAT;

public plugin_init()
{
    new admin_chat_id

    register_dictionary("adminchat.txt")
    admin_chat_id = register_concmd("say", "cmdSayAdmin")
    amx_show_activity = get_cvar_pointer("amx_show_activity");
    
    if (amx_show_activity == 0)
    {
        amx_show_activity = register_cvar("amx_show_activity", "2");
    }

    new str[1]
    get_concmd(admin_chat_id, str, 0, g_AdminChatFlag, str, 0, -1)
}

public cmdSayAdmin(id, level, cid)
{
    if (!cmd_access(id, level, cid, 2))
        return PLUGIN_HANDLED

    new message[192], name[32], players[32], inum, authid[32], userid
    
    read_args(message, 191)
    remove_quotes(message)
    get_user_authid(id, authid, 31)
    get_user_name(id, name, 31)
    userid = get_user_userid(id)
    get_players(players, inum)
    
    if (is_user_admin(id))
	ColorChat(0, GREEN, "* ADMINS * %s :   %s", name, message);
    else    
	ColorChat(0, GREEN, "* PLAYER * %s :   %s", name, message);
    
    get_players(players, inum)
        
    console_print(id, "%s", message)
    
    for (new i = 0; i < inum; ++i)
    {
        if (access(players[i], g_AdminChatFlag))
            client_print(players[i], print_chat, "%s", message)
    }
    
    return PLUGIN_HANDLED
}
If you have a ghost chat or chat plugin, disable it, otherwise it will not work properly.
VenomMix is offline
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 10:56.


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