AdminChat

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
19
Реакции
-27
Обратите внимание, если вы хотите заключить сделку с этим пользователем, он заблокирован
как сделать чтобы писал в HUD после ~
как в оригинале ADMINCHAT после @

C++:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define NAME        "AdminChat"
#define VERSION        "1.0"
#define AUTHOR        "Alexander.3"

#define TEAM_TAG_CT    "Counter-Terrorist"
#define TEAM_TAG_T    "Terrorist"
#define TEAM_TAG_DEAD    "DEAD"

new Text
new g_status_sync

new msg[6][191]
new names[6][32]
new txt

new team_be

public plugin_init()
{
    register_plugin(NAME, VERSION, AUTHOR)

    register_cvar("Alexander.3", "AdminChat", FCVAR_SERVER|FCVAR_SPONLY)
    register_cvar("AdminChat", VERSION, FCVAR_SERVER|FCVAR_SPONLY)
   
    register_clcmd("say", "hook_say")
    register_clcmd("say_team", "hook_teamsay")
   
    Text = get_user_msgid ("SayText")
    register_message (Text, "delete_msg")
    g_status_sync = CreateHudSyncObj()
}

public delete_msg(msgId, msgDest, receiver)
{
    return PLUGIN_HANDLED
}

public hook_say(id)
{
    new strText[191]
    new messeg[191]
   
    new name[32]
    new message[192]
    new messager[191]
   
    get_user_name(id, name, 31)
    read_args(message, 191)
    remove_quotes(message)
   
    if(is_user_admin(id))
    {
        switch(txt)
        {
            case 0:
            {
                get_user_name(id, names[1], 31)
                read_args(msg[1], 191)
                remove_quotes(msg[1])
                format(strText, 191, "%s: %s", names[1], msg[1])
                txt++
            }
            case 1:    // ¬торое сообщение админа
            {
                get_user_name(id, names[2], 31)
                read_args(msg[2], 191)
                remove_quotes(msg[2])
                format(strText, 191, "%s: %s^n%s: %s", names[1], msg[1], names[2], msg[2])
                txt++
            }
            case 2:
            {
                get_user_name(id, names[3], 31)
                read_args(msg[3], 191)
                remove_quotes(msg[3])
                format(strText, 191, "%s: %s^n%s: %s^n%s: %s", names[1], msg[1], names[2], msg[2], names[3], msg[3])
                txt++
            }
            case 3:
            {
                get_user_name(id, names[4], 31)
                read_args(msg[4], 191)
                remove_quotes(msg[4])
                format(strText, 191, "%s: %s^n%s: %s^n%s: %s^n%s: %s", names[1], msg[1], names[2], msg[2], names[3], msg[3], names[4], msg[4])
                txt++
            }
            case 4:
            {
                get_user_name(id, names[5], 31)
                read_args(msg[5], 191)
                remove_quotes(msg[5])
                format(strText, 191, "%s: %s^n%s: %s^n%s: %s^n%s: %s^n%s: %s", names[1], msg[1], names[2], msg[2], names[3], msg[3], names[4], msg[4], names[5], msg[5])
                txt++
            }
            case 5:
            {
                msg[1] = msg[2]
                names[1] = names[2]
                msg[2] = msg[3]
                names[2] = names[3]
                msg[3] = msg[4]
                names[3] = names[4]
                msg[4] = msg[5]
                names[4] = names[5]

                get_user_name(id, names[5], 31)
                read_args(msg[5], 191)
                remove_quotes(msg[5])
                format(strText, 191, "%s: %s^n%s: %s^n%s: %s^n%s: %s^n%s: %s", names[1], msg[1], names[2], msg[2], names[3], msg[3], names[4], msg[4], names[5], msg[5])
            }
        }
           
        set_hudmessage(255, 255, 255, 0.05, 0.65, 0, 1.0, 120.0, 0.1, 0.01, -1)  
        format(messeg, 900, "%s", strText)
        ShowSyncHudMsg(0, g_status_sync, "%s", messeg)
    }
    else
    {
        if(is_user_alive(id))
        {
            format(messager, 191, "!t%s: !y%s", name, message)
        }
        else
        {
            format(messager, 191, "!y(*%s*) !t%s: !y%s", TEAM_TAG_DEAD, name, message)
        }
        color_print(0, "%s", messager)
    }
}

public hook_teamsay(id)
{
    new chat_msg[191]
    new chat_name[33]
   
    new format_msg[191]
   
    if(is_user_admin(id))
    {
        hook_say(id)
    }
    else
    {
        get_user_name(id, chat_name, 31)
       
        read_args(chat_msg, 191)
        remove_quotes(chat_msg)
       
        if(is_user_alive(id))
        {
            if(cs_get_user_team(id) == CS_TEAM_CT)
            {
                format(format_msg, 191, "!y(*%s*) !t%s: !y%s", TEAM_TAG_CT, chat_name, chat_msg)
                team_be = 1
            }
            else
            {
                format(format_msg, 191, "!y(*%s*) !t%s: !y%s", TEAM_TAG_T, chat_name, chat_msg)
                team_be = 0
            }
            color_print(1, "%s", format_msg)
        }
        else
        {
            format(format_msg, 191, "!y(*%s*) !t%s: !y%s", TEAM_TAG_DEAD, chat_name, chat_msg)
            color_print(0, "%s", format_msg)
        }
    }
}

stock color_print(team, const input[], any:...)
{
    new message[192], player
   
    vformat(message, 191, input, 3)
    format(message, 191, "^1%s", message)
    replace_all(message, 191, "!g", "^4")
    replace_all(message, 191, "!y", "^1")
    replace_all(message, 191, "!t", "^3")
    message[191] = '^0'
   
    if(team)
    {
        if(team_be)
        {
            for(new i = 1; i <= get_maxplayers(); i++)
            {
                if(is_user_connected(i) && cs_get_user_team(i) == CS_TEAM_CT)
                {
                    player = i
                    break
                }
            }
            message_begin(MSG_ONE, Text, _, player)  
            write_byte(player)
            write_string(message)
            message_end()
        }
        else
        {
            for(new i = 1; i <= get_maxplayers(); i++)
            {
                if(is_user_connected(i) && cs_get_user_team(i) == CS_TEAM_T)
                {
                    player = i
                    break
                }
            }
            message_begin(MSG_ONE, Text, _, player)
            write_byte(player)
            write_string(message)
            message_end()  
        }
    }
    else
    {
        for(new i = 1; i <= get_maxplayers(); i++)
        {
            if(is_user_connected(i))
            {
                player = i
                break
            }
        }
        message_begin(MSG_BROADCAST, Text, _, player)
        write_byte(player)
        write_string(message)
        message_end()
    }
    return 1
}

/* AdminChat
* By Alexander.3
* ICQ: 357330340
* Skype: ZombieLite
* WebSite: Elite-Servers.Ru
*/
 
Сообщения
1,536
Реакции
2,324
Помог
39 раз(а)
Нужные слова сами найдете в объявлении сверху.
 
  • Like a Boss
Реакции: Ayk
Статус
В этой теме нельзя размещать новые ответы.

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу