Правила форума Гаранты форума
Размещение рекламы AMX-X компилятор

Здравствуйте, гость Вход | Регистрация

Наши новости:

14-дек
24-апр
10-апр
11-апр

Перевод на русский

Статус пользователя Benderben
сообщение 5.6.2011, 1:13
Сообщение #1
Стаж: 15 лет

Сообщений: 8
Благодарностей: 3
Полезность: 0

Всем доброго времени суток. Прошу объяснить начинающему, как перевести кусочек плагина собственно, на русский язык.

Как пример, возьмём плагин "Chat_mute". Я его слегка отредактировал, сделав так, чтобы при входе на сервер, и каждые 7 минут в чат высылался определённый текст, но никак не получается сделать этот текст русским.

*.sma
Код
#include <amxmodx>
#include <amxmisc>
#include <cstrike>


#define adtime     420.0 //Default of 10 minuites
#define MENU_SIZE    512
#define MENU_PLAYERS 8


new const PLUGIN[]    = "Chat Mute"
new const VERSION[]    = "1.6"
new const AUTHOR[]    = "Bender"

new const g_menutitle[][] =
{
    "Chat Mute%60s%i/%i^n^n",
    "\yChat Mute%60s%i/%i^n^n\w"
}

new const g_menutext1[][] =
{
    "%i.[admin] %s ^n",
    "\d%i. %s^n\w"
}

new const g_menutext2[][] =
{
    "%i.[%s] %s ^n",
    "%i. \r%s \w%s\w^n"
}

new g_is_counterstrike

//xeroblood
new g_nMenuPosition[33]
new g_nMenuPlayers[32]
//xeroblood

new bool:gb_mute[33][33]

new Float:gf_time[33]

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    
    register_clcmd("say /chatmute", "cmd_mutemenu")
        register_clcmd("say /mute", "cmd_mutemenu")
    register_clcmd("amx_chatmute", "cmd_chatmute", -1, "<name>")
    register_clcmd("amx_chatmutemenu", "cmd_mutemenu", -1, "displays chat mute menu")

    register_cvar("amx_mutechat", "1")
    
    register_menucmd(register_menuid("Chat Mute"),        1023,    "handle_mutemenu")
    
    register_message(get_user_msgid("SayText"), "message_SayText")
    
    new modname[32]
    get_modname(modname, 31)
    
    if(equal(modname, "cstrike"))
    {
        g_is_counterstrike = 1
    }
    if(get_cvar_num("amx_mutechat") == 1)

{
        set_task(adtime, "advertise", _, _, _, "b")
    }

    
}

public advertise()
{
    set_hudmessage (255, 0, 0, -1.0, 0.20, 0, 0.2, 12.0)
    show_hudmessage (0, "Если кто-то орёт в микрофон или спамит в чате, то /mute вам поможет")


}

public client_putinserver(id)
{
    if (get_cvar_num("amx_mutechat") == 1)
    {
        set_task(10.0, "connectmessage", id, _, _, "a", 1)
    }
}

public connectmessage(id)
{
    if(is_user_connected(id))
    {
    client_print(id, print_chat, "Если кто-то орёт в микрофон или спамит в чате, то /mute вам поможет")
    }
}
public message_SayText(iMsgid, iDest, receiver)
{
    static sender
    sender = get_msg_arg_int(1)
    
    if(gb_mute[receiver][sender])
        return PLUGIN_HANDLED
    
    return PLUGIN_CONTINUE
}


public cmd_chatmute(id)
{
    new arg1[32]
    
    read_argv(1, arg1, 31)
    
    if(!arg1[0])
    {
        client_print(id, print_console, "Usage:  amx_mute <name>")
        return PLUGIN_HANDLED
    }
    
    new player = cmd_target(id, arg1, 0)
    
    if(player)
    {
        exec_mute(id, player)
    }
    
    return PLUGIN_HANDLED
}

public exec_mute(id, target)
{
    if(access(target, ADMIN_KICK))
    {
        client_print(id, print_console, "[AMXX] You cannot mute an admin.")
        return 0
    }
    else if(target == id)
    {
        client_print(id, print_console, "[AMXX] You can't mute yourself.")
        return 0
    }
    
    new Float:current_time = get_gametime()
    new Float:interval = get_cvar_float("amx_flood_time")
    
    if(current_time > gf_time[id] + interval)
    {
        gf_time[id] = current_time
    }
    else
    {
        client_print(id, print_chat, "[AMXX] Please wait %f seconds to mute again.", interval)
        return 0
    }
    
    gb_mute[id][target] = !gb_mute[id][target]
    
    new name[32], name2[32]
    
    get_user_name(target, name, 31)
    
    get_user_name(id, name2, 31)
    
    client_print(0, print_chat, "[AMXX] %s has %smuted %s chat.", name2, (gb_mute[id][target] ? "" : "un"), name)
    
    return 1
}

/*
    xeroblood's fantastic menu, customized
*/
public cmd_mutemenu(id)
{
    show_mutemenu(id, g_nMenuPosition[id] = 0)
    return PLUGIN_HANDLED
}

public handle_mutemenu(id, key)
{
    switch(key)
    {
        case 8: show_mutemenu(id, ++g_nMenuPosition[id])
        
        case 9: show_mutemenu(id, --g_nMenuPosition[id])
        
        default:
        {
            new nPlayerID = g_nMenuPlayers[g_nMenuPosition[id] * MENU_PLAYERS + key]
            
            exec_mute(id, nPlayerID)
            
            show_mutemenu(id, g_nMenuPosition[id])
        }
    }
    
    return PLUGIN_HANDLED
}

public show_mutemenu(id, pos)
{
    if(pos < 0) return

    new i, iPlayerID
    new szMenuBody[MENU_SIZE]
    new nCurrKey = 0
    new szUserName[32]
    new nStart = pos * MENU_PLAYERS
    new nNum

    get_players(g_nMenuPlayers, nNum)

    if(nStart >= nNum)
        nStart = pos = g_nMenuPosition[id] = 0
    
    new nLen = format(szMenuBody, MENU_SIZE-1, g_menutitle[g_is_counterstrike], "", pos+1, (nNum / MENU_PLAYERS + ((nNum % MENU_PLAYERS) ? 1 : 0 )))
    new nEnd = nStart + MENU_PLAYERS
    new nKeys = (1<<9)
    
    if( nEnd > nNum )
        nEnd = nNum
    
    for(i = nStart; i < nEnd; i++)
    {
        iPlayerID = g_nMenuPlayers[i]
        get_user_name(iPlayerID, szUserName, 31)
        
        if(access(iPlayerID, ADMIN_KICK) || iPlayerID == id)
        {
            nCurrKey++
            nLen += format(szMenuBody[nLen], (MENU_SIZE-1-nLen), g_menutext1[g_is_counterstrike], nCurrKey, szUserName)
        }
        else
        {
            nKeys |= (1<<nCurrKey++)
            nLen += format(szMenuBody[nLen], (MENU_SIZE-1-nLen), g_menutext2[g_is_counterstrike], nCurrKey, (gb_mute[id][iPlayerID] ? "mute" : ""), szUserName)
        }
    }
    
    if(nEnd != nNum)
    {
        format(szMenuBody[nLen], (MENU_SIZE-1-nLen), "^n9. More...^n0. %s", pos ? "Back" : "Exit")
        nKeys |= (1<<8)
    }
    else
        format(szMenuBody[nLen], (MENU_SIZE-1-nLen), "^n0. %s", pos ? "Back" : "Exit")
    
    show_menu(id, nKeys, szMenuBody, -1)
    
    return
}

Прикрепленные файлы:
Прикрепленный файл  mute.rar ( 1,86 килобайт ) Кол-во скачиваний: 7
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   Цитировать сообщение
Статус пользователя Nb00wn
сообщение 5.6.2011, 6:06
Сообщение #2


Стаж: 15 лет

Сообщений: 25
Благодарностей: 5
Полезность: 154

https://c-s.net.ua/forum/topic14744.html
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя pike
сообщение 5.6.2011, 6:13
Сообщение #3


Стаж: 18 лет

Сообщений: 956
Благодарности: выкл.

Benderben,
Редактируй в AkelPad , сохраняй в utf-8 без BOOM
Прикрепленные файлы:
Прикрепленное изображение
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя Benderben
сообщение 5.6.2011, 17:12
Сообщение #4
Стаж: 15 лет

Сообщений: 8
Благодарностей: 3
Полезность: 0

Спасибо большое. Тему можно закрывать.
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
  Тема закрытаНачать новую тему
 
0 пользователей и 1 гостей читают эту тему: