搜索
查看: 2452|回复: 2

把adminchat的say @@禁止掉怎么改?

[复制链接]
发表于 2008-2-19 11:24:18 | 显示全部楼层 |阅读模式 来自 中国–广东–深圳–南山区
大家新年好!!:D :D :D
把adminchat的say @@禁止掉怎么改?
屏幕中间显示聊天信息有点难看~~
会的麻烦指教下;)
[PHP]#include <amxmodx>
#include <amxmisc>

new g_msgChannel

#define MAX_CLR 10

new g_Colors[MAX_CLR][] = {"COL_WHITE", "COL_RED", "COL_GREEN", "COL_BLUE", "COL_YELLOW", "COL_MAGENTA", "COL_CYAN", "COL_ORANGE", "COL_OCEAN", "COL_MAROON"}
new g_Values[MAX_CLR][] = {{255, 255, 255}, {255, 0, 0}, {0, 255, 0}, {0, 0, 255}, {255, 255, 0}, {255, 0, 255}, {0, 255, 255}, {227, 96, 8}, {45, 89, 116}, {103, 44, 38}}
new Float:g_Pos[4][] = {{0.0, 0.0}, {0.05, 0.55}, {-1.0, 0.2}, {-1.0, 0.7}}

public plugin_init()
{
        register_plugin("Admin Chat", AMXX_VERSION_STR, "AMXX Dev Team")
        register_dictionary("adminchat.txt")
        register_dictionary("common.txt")
        register_clcmd("say", "cmdSayChat", ADMIN_CHAT, "@[@|@|@][w|r|g|b|y|m|c]<text> - displays hud message")
        register_clcmd("say_team", "cmdSayAdmin", 0, "@<text> - displays message to admins")
        register_concmd("amx_say", "cmdSay", ADMIN_CHAT, "<message> - sends message to all players")
        register_concmd("amx_chat", "cmdChat", ADMIN_CHAT, "<message> - sends message to admins")
        register_concmd("amx_psay", "cmdPsay", ADMIN_CHAT, "<name or #userid> <message> - sends private message")
        register_concmd("amx_tsay", "cmdTsay", ADMIN_CHAT, "<color> <message> - sends left side hud message to all players")
        register_concmd("amx_csay", "cmdTsay", ADMIN_CHAT, "<color> <message> - sends center hud message to all players")
}

public cmdSayChat(id)
{
        if (!access(id, ADMIN_CHAT))
        {
                return PLUGIN_CONTINUE
        }
       
        new said[6], i = 0
        read_argv(1, said, 5)
       
        while (said == '@')
        {
                i++
        }
       
        if (!i || i > 3)
        {
                return PLUGIN_CONTINUE
        }
       
        new msg[192], a = -1
        read_args(msg, 191)
        remove_quotes(msg)
       
        switch (said)
        {
                case 'w': a = 0
                case 'r': a = 1
                case 'g': a = 2
                case 'b': a = 3
                case 'y': a = 4
                case 'm': a = 5
                case 'c': a = 6
                case 'o': a = 7
        }
       
        new message[192]
        if(a==-1)
        {
                copy(message,191,msg)
                a = 0
        }else{
                copy(message,191,msg[i+1])
        }
       
        trim(message)
        new name[32], authid[32], userid
       
        get_user_authid(id, authid, 31)
        get_user_name(id, name, 31)
        userid = get_user_userid(id)
       
        log_amx("Chat: ^"%s<%d><%s><>^" tsay ^"%s^"", name, userid, authid, message)
        log_message("^"%s<%d><%s><>^" triggered ^"amx_tsay^" (text ^"%s^") (color ^"%L^")", name, userid, authid, message, "en", g_Colors[a])
       
        if (++g_msgChannel > 6 || g_msgChannel < 3)
        {
                g_msgChannel = 3
        }
       
        new Float:verpos = g_Pos[1] + float(g_msgChannel) / 35.0
       
        set_hudmessage(g_Values[a][0], g_Values[a][1], g_Values[a][2], g_Pos[0], verpos, 0, 6.0, 6.0, 0.5, 0.15, -1)

        if (get_cvar_num("amx_show_activity") == 2)
        {
                show_hudmessage(0, "%s :  %s", name, message)
                client_print(0, print_notify, "%s :  %s", name, message)
        } else {
                show_hudmessage(0, "%s", message)
                client_print(0, print_notify, "%s", message)
        }

        return PLUGIN_HANDLED
}

public cmdSayAdmin(id)
{
        new said[2]
        read_argv(1, said, 1)
       
        if (said[0] != '@')
                return PLUGIN_CONTINUE
       
        new message[192], name[32], authid[32], userid
        new players[32], inum
       
        read_args(message, 191)
        remove_quotes(message)
        get_user_authid(id, authid, 31)
        get_user_name(id, name, 31)
        userid = get_user_userid(id)
       
        log_amx("Chat: ^"%s<%d><%s><>^" chat ^"%s^"", name, userid, authid, message[1])
        log_message("^"%s<%d><%s><>^" triggered ^"amx_chat^" (text ^"%s^")", name, userid, authid, message[1])
       
        if (is_user_admin(id))
                format(message, 191, "(%L) %s :  %s", id, "ADMIN", name, message[1])
        else
                format(message, 191, "(%L) %s :  %s", id, "PLAYER", name, message[1])

        get_players(players, inum)
       
        for (new i = 0; i < inum; ++i)
        {
                // dont print the message to the client that used the cmd if he has ADMIN_CHAT to avoid double printing
                if (players != id && get_user_flags(players) & ADMIN_CHAT)
                        client_print(players, print_chat, "%s", message)
        }
       
        client_print(id, print_chat, "%s", message)
       
        return PLUGIN_HANDLED
}

public cmdChat(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)
       
        log_amx("Chat: ^"%s<%d><%s><>^" chat ^"%s^"", name, userid, authid, message)
        log_message("^"%s<%d><%s><>^" triggered ^"amx_chat^" (text ^"%s^")", name, userid, authid, message)
       
        format(message, 191, "(ADMINS) %s :   %s", name, message)
        console_print(id, "%s", message)
       
        for (new i = 0; i < inum; ++i)
        {
                if (access(players, ADMIN_CHAT))
                        client_print(players, print_chat, "%s", message)
        }
       
        return PLUGIN_HANDLED
}

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

        new message[192], name[32], 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)
        client_print(0, print_chat, "%L", LANG_PLAYER, "PRINT_ALL", name, message)
        console_print(id, "%L", LANG_PLAYER, "PRINT_ALL", name, message)
       
        log_amx("Chat: ^"%s<%d><%s><>^" say ^"%s^"", name, userid, authid, message)
        log_message("^"%s<%d><%s><>^" triggered ^"amx_say^" (text ^"%s^")", name, userid, authid, message)
       
        return PLUGIN_HANDLED
}

public cmdPsay(id, level, cid)
{
        if (!cmd_access(id, level, cid, 3))
                return PLUGIN_HANDLED
       
        new name[32]
        read_argv(1, name, 31)
        new priv = cmd_target(id, name, 0)

        if (!priv)
                return PLUGIN_HANDLED
       
        new length = strlen(name) + 1
        new message[192], name2[32], authid[32], authid2[32], userid, userid2
       
        get_user_authid(id, authid, 31)
        get_user_name(id, name2, 31)
        userid = get_user_userid(id)
        read_args(message, 191)
       
        if (message[0] == '"' && message[length] == '"') // HLSW fix
        {
                message[0] = ' '
                message[length] = ' '
                length += 2
        }
       
        remove_quotes(message[length])
        get_user_name(priv, name, 31)
       
        if (id && id != priv)
                client_print(id, print_chat, "(%s) %s :   %s", name, name2, message[length])
       
        client_print(priv, print_chat, "(%s) %s :   %s", name, name2, message[length])
        console_print(id, "(%s) %s :   %s", name, name2, message[length])
        get_user_authid(priv, authid2, 31)
        userid2 = get_user_userid(priv)
       
        log_amx("Chat: ^"%s<%d><%s><>^" psay ^"%s<%d><%s><>^" ^"%s^"", name2, userid, authid, name, userid2, authid2, message[length])
        log_message("^"%s<%d><%s><>^" triggered ^"amx_psay^" against ^"%s<%d><%s><>^" (text ^"%s^")", name2, userid, authid, name, userid2, authid2, message[length])
       
        return PLUGIN_HANDLED
}

public cmdTsay(id, level, cid)
{
        if (!cmd_access(id, level, cid, 3))
                return PLUGIN_HANDLED
       
        new cmd[16], color[16], color2[16], message[192], name[32], authid[32], userid = 0
       
        read_argv(0, cmd, 15)
        new bool:tsay = (tolower(cmd[4]) == 't')
       
        read_args(message, 191)
        remove_quotes(message)
        parse(message, color, 15)
       
        new found = 0, a = 0
        new lang[3], langnum = get_langsnum()

        for (new i = 0; i < MAX_CLR; ++i)
        {
                for (new j = 0; j < langnum; j++)
                {
                        get_lang(j, lang)
                        format(color2, 15, "%L", lang, g_Colors)
                       
                        if (equali(color, color2))
                        {
                                a = i
                                found = 1
                                break
                        }
                }
                if (found == 1)
                        break
        }
       
        new length = found ? (strlen(color) + 1) : 0
       
        if (++g_msgChannel > 6 || g_msgChannel < 3)
                g_msgChannel = 3

        new Float:verpos = (tsay ? 0.55 : 0.1) + float(g_msgChannel) / 35.0
       
        get_user_authid(id, authid, 31)
        get_user_name(id, name, 31)
        userid = get_user_userid(id)
        set_hudmessage(g_Values[a][0], g_Values[a][1], g_Values[a][2], tsay ? 0.05 : -1.0, verpos, 0, 6.0, 6.0, 0.5, 0.15, -1)

        if (get_cvar_num("amx_show_activity") == 2)
        {
                show_hudmessage(0, "%s :   %s", name, message[length])
                client_print(0, print_notify, "%s :   %s", name, message[length])
                console_print(id, "%s :   %s", name, message[length])
        } else {
                show_hudmessage(0, "%s", message[length])
                client_print(0, print_notify, "%s", message[length])
                console_print(id, "%s", message[length])
        }

        log_amx("Chat: ^"%s<%d><%s><>^" %s ^"%s^"", name, userid, authid, cmd[4], message[length])
        log_message("^"%s<%d><%s><>^" triggered ^"%s^" (text ^"%s^") (color ^"%s^")", name, userid, authid, cmd, message[length], color2)

        return PLUGIN_HANDLED
}
[/PHP]
发表于 2008-2-19 12:14:47 | 显示全部楼层 来自 中国–福建–漳州

回复: 把adminchat的say @@禁止掉怎么改?

new Float:g_Pos[4][] = {{0.0, 0.0}, {0.05, 0.55}, {-1.0, 0.2}, {-1.0, 0.7}}

上面这一行是用于定义位置的,你把{-1.0, 0.2},修改一下就行了。
回复

使用道具 举报

 楼主| 发表于 2008-2-19 14:47:48 | 显示全部楼层 来自 中国–广东–深圳–南山区

回复: 把adminchat的say @@禁止掉怎么改?

:D
非常感谢!!!!
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表