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

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

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

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

Замутил :)

Статус пользователя Dale
сообщение 14.9.2011, 21:54
Сообщение #1


Стаж: 14 лет

Сообщений: 237
Благодарностей: 96
Полезность: 46

Попытался добавить в 2 плагина цветной чат, но я криворукий нечего не вышло :D
Первый спойлер
Код
/*
Plugin: Simple AFK Manager
Version: 2.3
© [gm-project.net] #Staff.

Support on alliedmods.net: http://forums.alliedmods.net/showthread.php?t=110536
Support on gm-project.net: http://gm-community.net/showthread.php?t=1352
*/

#include <amxmodx>
#include <fakemeta>

#define PLUGIN "Simple AFK Manager"
#define VERSION "2.3"
#define AUTHOR "[gm-project.net] #Staff"

#define PREFIX "SAM"

#define OFFSET_LAST_MOVEMENT 124

new g_maxplayers

new Float:g_spec_time[33]

new g_Reason, g_aTime, g_sTime, g_Report, g_Info
new g_Immunity, g_kickBots, g_kickHLTV, g_showMsg
new g_afkCount[2]

new SayText;

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    
    g_maxplayers = get_maxplayers()
    
    g_Reason = register_cvar("afk_kick_reason", "AFK")
    g_aTime = register_cvar("afk_time", "60.0")
    g_sTime = register_cvar("afk_spec_time", "180.0")
    g_Report = register_cvar("afk_report", "2")
    g_showMsg = register_cvar("afk_showmsg", "1")
    g_Info = register_cvar("afk_info_time", "20.0")
    g_Immunity = register_cvar("afk_immunity_flag", "b")
    g_kickBots = register_cvar("afk_kick_bots", "0")
    g_kickHLTV = register_cvar("afk_kick_hltv", "0")
    
    SayText = get_user_msgid("SayText")  

    register_dictionary("sam.txt")

    register_cvar("sam_version", VERSION, FCVAR_SERVER | FCVAR_SPONLY)
    set_task(10.0, "checkAFK", _, _, _, "b")
    register_logevent("RoundStart", 2, "1=Round_Start")
}

public client_putinserver(id) {
    g_spec_time[id] = 0.0
}

public RoundStart() {
    new ShowMsg
    ShowMsg = get_pcvar_num(g_showMsg)

    if (ShowMsg) {
        print_col_chat(0,  "[^4%s^1] %L", PREFIX, LANG_PLAYER, "AFK_MSG", g_afkCount[1], g_afkCount[0])
    }
}

public checkAFK() {
    new Float:afk_time = get_pcvar_float(g_aTime)
    new Float:afk_spec_time = get_pcvar_float(g_sTime)
    new Float:afk_info_time = get_pcvar_float(g_Info)
    new i, Float:cur_time, team, Float:lastActivity
    g_afkCount[0] = g_afkCount[1] = 0
    new strFlag[20]
    get_pcvar_string(g_Immunity, strFlag, 19)
    new flag = read_flags(strFlag)
    cur_time = get_gametime()
    if (afk_time)
        afk_time = cur_time - afk_time
    if (afk_spec_time)
        afk_spec_time = cur_time - afk_spec_time
    if (afk_info_time)
        afk_info_time = cur_time - afk_info_time
    
    new kick_bot = get_pcvar_num(g_kickBots)
    new kick_hltv = get_pcvar_num(g_kickHLTV)
    
    for (i = 1; i <= g_maxplayers; i++)
    {
        if (!is_user_connected(i) || (get_user_flags(i)&flag)
        || (is_user_bot(i) && kick_bot)
        || (is_user_hltv(i) && kick_hltv))
                continue
                
        team = get_user_team(i)
        if (1 <= team <= 2)
               {
                   if (!is_user_alive(i) || !afk_time)
                         continue
            g_spec_time[i] = 0.0
            lastActivity = get_pdata_float(i, OFFSET_LAST_MOVEMENT)
            if (lastActivity < afk_time)
                kickAFK(i)
            else
            {
                if (lastActivity < afk_info_time) {
                    print_col_chat(i, "[^4%s^1] %L", PREFIX, LANG_PLAYER, "AFK_WARN", floatround(afk_info_time - afk_time))
                    g_afkCount[team - 1] ++
                }
            }
        }
        else
        {
            if (!afk_spec_time)
                continue
            if (!g_spec_time[i])
                g_spec_time[i] = cur_time
            else
            if (g_spec_time[i] < afk_spec_time)
                kickAFK(i)
        }
        
    }
}

public kickAFK(id) {
    new name[32], reason[128], report
    
    get_user_name(id, name, 31)
    get_pcvar_string(g_Reason, reason, 127)
    report = get_pcvar_num(g_Report)
    
    message_begin( MSG_ONE, SVC_DISCONNECT, _, id )
    write_string( reason )
    message_end( )
    server_exec()
    
    if (report == 2)
        print_col_chat(0, "[^4%s^1] %L", PREFIX, LANG_PLAYER, "AFK_KICK", name)
    else
    if (report == 1) {
        for (report = 1; report <= g_maxplayers; report++)
        {
            if (get_user_flags(report) & ADMIN_CHAT)
                print_col_chat(report, "[^4%s^1] %L", PREFIX, LANG_PLAYER, "AFK_KICK", name)
        }
    }
    
}
stock print_col_chat(const id, const input[], any:...)
{
    new count = 1, players[32];
    static msg[191];
    vformat(msg, 190, input, 3);
    replace_all(msg, 190, "!g", "^4"); // Green Color
    replace_all(msg, 190, "!y", "^1"); // Default Color (у©°  ж№«ој©)
    replace_all(msg, 190, "!t", "^3"); // Team Color
    if (id) players[0] = id; else get_players(players, count, "ch");
    {
        for ( new i = 0; i < count; i++ )
        {
            if ( is_user_connected(players[i]) )
            {
                message_begin(MSG_ONE_UNRELIABLE, SayText, _, players[i]);
                write_byte(players[i]);
                write_string(msg);
                message_end();
            }
        }
    }
}  
/* Fedcomp is bot */


Второй спойлер
Цитата
[en]
AFK_WARN = You have !t%d!n seconds to move or else you will be kicked!
AFK_KICK = !t%s!n has been kicked for being AFK!
AFK_MSG = AFK players: CT - !t%d,!n !tT - %d

[ru]
AFK_WARN = У тебя есть !t%d!n секунд, чтобы начать двигаться или ты будешь удален с сервера!
AFK_KICK = !t%s!n кикнут за АФК!
AFK_MSG = Простаивающие игроки: CT - !t%d,!n T - !t%d


Третий спойлер
Код
/*
    Nextmap Chooser
    Интегрированы:    Lastround & RockTheVote

    Использован код следующих плагинов, за что их авторам большая благодарность:
        1.    Nextmap Chooser Plugin
            by the AMX Mod X Development Team
            originally developed by OLO

        2.    RockTheVote    v1.8
             Made by DA

    Переменные:
        amx_extendmap_max  (default: 45)  - Максимальная длительность карты в минутах
        amx_extendmap_step (default: 15)  - Время продления карты за 1 раз в минутах
        amx_vote_time      (default: 15)  - Длительность голосования в секундах
        amx_vote_delay     (default: 3)   - Отсрочка голосования в минутах от начала карты
        amx_votemap_ratio  (default: 0.6) - Процент голосов для начала голосования (по-умолчанию 60%)
        amx_lastround      (default: 1)   - Производить смену карты по окончании раунда.

    Rebuilding by UFPS.Team
*/


#include <amxmodx>
#include <amxmisc>

#define PLUGIN_NAME        "Nextmap Chooser"
#define PLUGIN_VERSION    "1.9"
#define PLUGIN_AUTHOR    "UFPS.Team"

#define SELECTMAPS        5
#define MAPS_MAX        128
#define AUTO_LANG        -76

#define charsmax(%1)    (sizeof(%1)-1)


new g_mapNums
new g_mapName        [MAPS_MAX][32]

new g_nextName        [SELECTMAPS]
new g_voteCount        [SELECTMAPS + 2]
new g_mapVoteNum
new g_teamScore        [2]
new g_lastMap        [32]
new g_rtv_count
new g_rtv_vote        [33]

new g_MENU            [512]
new g_MENU_keys =    ( 1 << SELECTMAPS + 1 )
new g_MENU_name        [64]
new g_MENU_title    [128]

new const speak[][] = { "one", "two", "three", "four", "five" }

new g_coloredMenus        = 0
new bool:g_rtv            = false
new bool:g_lastround    = false
new bool:g_changemap    = false
new bool:g_selected        = false
new Float:g_timelimit    = 0.0

new pcv_lastround
new pcv_extendmap_max
new pcv_extendmap_step
new pcv_vote_time
new pcv_vote_delay
new pcv_votemap_ratio
new pcv_amx_nextmap
new pcv_mp_chattime
new pcv_mp_timelimit
new pcv_mp_winlimit
new pcv_mp_maxrounds
new SayText;


public plugin_init( )
{
    register_plugin( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR )

    register_dictionary    ( "common.txt" )
    register_dictionary    ( "lastround.txt" )
    register_dictionary    ( "mapchooser.txt" )
    
    SayText = get_user_msgid("SayText")  

    register_clcmd( "say rockthevote",            "cmd_say_rtv" )
    register_clcmd( "say /rockthevote",            "cmd_say_rtv" )
    register_clcmd( "say rtv",                    "cmd_say_rtv" )
    register_clcmd( "say /rtv",                    "cmd_say_rtv" )

    register_clcmd( "say_team rockthevote",        "cmd_say_rtv" )
    register_clcmd( "say_team /rockthevote",    "cmd_say_rtv" )
    register_clcmd( "say_team rtv",                "cmd_say_rtv" )
    register_clcmd( "say_team /rtv",            "cmd_say_rtv" )

    pcv_vote_time        = pcvar_register( "amx_vote_time",        "15"   )
    pcv_vote_delay        = pcvar_register( "amx_vote_delay",        "3"    )
    pcv_votemap_ratio    = pcvar_register( "amx_votemap_ratio",    "0.60" )
    pcv_extendmap_max     = pcvar_register( "amx_extendmap_max",    "45"   )
    pcv_extendmap_step     = pcvar_register( "amx_extendmap_step",    "15"   )

    pcv_mp_chattime        = get_cvar_pointer( "mp_chattime"  )
    pcv_mp_timelimit    = get_cvar_pointer( "mp_timelimit" )
    pcv_mp_winlimit        = get_cvar_pointer( "mp_winlimit"  )
    pcv_mp_maxrounds    = get_cvar_pointer( "mp_maxrounds" )
    pcv_amx_nextmap        = get_cvar_pointer( "amx_nextmap"  )

    if( !pcv_amx_nextmap )
        pcv_amx_nextmap    = register_cvar( "amx_nextmap",    "", FCVAR_SERVER | FCVAR_EXTDLL | FCVAR_SPONLY )

    if( cstrike_running( ) )
    {
        pcv_lastround = register_cvar( "amx_lastround", "1" )
        register_event( "TeamScore", "team_score", "a" )
        register_logevent( "evRoundStart", 2, "0=World triggered", "1=Round_Start" )
    }

    register_event( "30", "mapChange", "a" )

    g_coloredMenus = colored_menus( )

    get_localinfo( "lastMap", g_lastMap, charsmax( g_lastMap ) )
    set_localinfo( "lastMap", "" )

    set_cvar_float( "sv_restart", 1.0 )
}

public plugin_cfg( )
{
    new mapcycle[64]
    get_configsdir( mapcycle, charsmax( mapcycle ) )
    format( mapcycle, charsmax( mapcycle ), "%s/maps.ini", mapcycle )

    if( !file_exists( mapcycle ) )
        get_cvar_string( "mapcyclefile", mapcycle, charsmax( mapcycle ) )

    if( !file_exists( mapcycle ) )
        copy( mapcycle, charsmax( mapcycle ), "mapcycle.txt" )

    if( loadSettings( mapcycle) )
        set_task( 15.0, "voteNextmap", 987456, "", 0, "b" )

    formatex( g_MENU_name, charsmax( g_MENU_name ), "%L", "en", "CHOOSE_NEXTM" )
    register_menucmd( register_menuid( g_MENU_name ), ( -1 ^ ( -1 << ( SELECTMAPS + 2 ) ) ), "countVote" )
}

public countVote( id, key )
{
    if( get_cvar_float( "amx_vote_answers" ) )
    {
        new name[32]
        get_user_name( id, name, charsmax( name ) )

        if( key == SELECTMAPS )
            print_col_chat( 0, "%L", LANG_PLAYER, "CHOSE_EXT", name )

        else if( key < SELECTMAPS )
        {
            new map[32]
            copy( map, charsmax( map ), g_mapName[g_nextName[key]] )
            print_col_chat( 0, "%L", LANG_PLAYER, "X_CHOSE_X", name, map )
        }
    }

    g_voteCount[key]++

    return PLUGIN_HANDLED
}

public voteNextmap( )
{
    if( !g_mapNums ) return 0

    new winlimit = get_pcvar_num( pcv_mp_winlimit )
    new maxrounds = get_pcvar_num( pcv_mp_maxrounds )

    if( g_rtv )
    {
        winlimit = 0
        maxrounds = -1
    }

    if( winlimit )
    {
        new c = winlimit - 2

        if( ( c > g_teamScore[0] ) && ( c > g_teamScore[1] ) )
        {
            g_selected = false
            return 0
        }
    }

    else if( maxrounds )
    {
        if( ( maxrounds - 2 ) > ( g_teamScore[0] + g_teamScore[1] ) )
        {
            g_selected = false
            return 0
        }
    }
    
    else
    {
        new timeleft = get_timeleft( )

        if( timeleft < 1 || timeleft > 129 )
        {
            g_selected = false
            return 0
        }
    }

    if( g_selected ) return 0

    g_selected = true

    new pos, a

    g_MENU_keys = ( 1 << SELECTMAPS + 1 )

    new dmax = clamp( g_mapNums, 0, SELECTMAPS )

    for( g_mapVoteNum = 0; g_mapVoteNum < dmax; g_mapVoteNum++ )
    {
        a = random_num( 0, g_mapNums - 1 )

        while( isInMenu( a ) ) { if( ++a >= g_mapNums ) a = 0; }

        g_nextName[g_mapVoteNum] = a
        pos += format( g_MENU[pos], charsmax( g_MENU ), "%d. %s^n", g_mapVoteNum + 1, g_mapName[a] )
        g_MENU_keys |= ( 1 << g_mapVoteNum )
        g_voteCount[g_mapVoteNum] = 0
    }

    g_MENU[pos++] = '^n'
    g_voteCount[SELECTMAPS] = 0
    g_voteCount[SELECTMAPS + 1] = 0

    new mapname[32]
    get_mapname( mapname, charsmax( mapname ) )

    if( ( winlimit + maxrounds ) == 0 && ( get_pcvar_float( pcv_mp_timelimit ) < get_pcvar_float( pcv_extendmap_max ) ) )
    {
        pos += format( g_MENU[pos], charsmax( g_MENU ), "%d. %L^n", SELECTMAPS + 1, LANG_SERVER, "EXTED_MAP", mapname )
        g_MENU_keys |= ( 1 << SELECTMAPS )
    }

    format( g_MENU[pos], charsmax( g_MENU ), "%d. %L", SELECTMAPS + 2, LANG_SERVER, "NONE" )
    set_task( 1.0, "countDown", 5 )

    return 1
}

stock bool:isInMenu( id )
{
    for( new a; a < g_mapVoteNum; a++ )
        if( id == g_nextName[a] ) return true

    return false
}

public countDown( timer )
{
    if( timer )
    {
        client_cmd( 0 ,"spk ^"fvox/%s^"", speak[timer-1] )
        say_hudmessage( 0, 64, 64, 64, 0.025, -1.0, 0, 0.0, 1.03, 0.0, 0.0, 4, "%L %L", AUTO_LANG, "CHOOSE_NEXTM", AUTO_LANG, "VOTE_COUNTER", timer, g_MENU )
        set_task(1.0, "countDown", --timer)
    }

    else
        set_task( 0.01, "showMenu" )
}

public showMenu( )
{
    new Float:votetime = floatclamp( get_pcvar_float ( pcv_vote_time ), 10.0, 60.0 )

    new menu[512], players[32], player, num
    get_players( players, num, "ch" )

    for( new i; i < num; i++ )
    {
        player = players[i]

        formatex( g_MENU_title, charsmax( g_MENU_title ), g_coloredMenus ? "\y%L:\w^n^n" : "%L:^n^n", player, "CHOOSE_NEXTM" )
        formatex( menu, charsmax( menu ), "%s%s", g_MENU_title, g_MENU )
        show_menu( player, g_MENU_keys, menu, floatround( votetime ), g_MENU_name )
    }

    set_task( votetime + 0.5, "checkVotes" )

    print_col_chat( 0, "%L", LANG_PLAYER, "TIME_CHOOSE" )
    client_cmd( 0, "spk Gman/Gman_Choose%d", random_num( 1, 2 ) )
    log_amx( "Vote: Voting for the nextmap started" )
}

public checkVotes( )
{
    new b = 0

    for( new a; a < g_mapVoteNum; ++a )
        if( g_voteCount[b] < g_voteCount[a] ) b = a

    if( g_voteCount[SELECTMAPS] > g_voteCount[b] && g_voteCount[SELECTMAPS] > g_voteCount[SELECTMAPS + 1] )
    {
        if( !g_timelimit )
            g_timelimit = get_pcvar_float( pcv_mp_timelimit )

        new Float:steptime = get_pcvar_float( pcv_extendmap_step )

        new mapname[32]
        get_mapname( mapname, charsmax( mapname ) )

        set_pcvar_float( pcv_mp_timelimit, get_pcvar_float( pcv_mp_timelimit ) + steptime )
        print_col_chat( 0, "%L", LANG_PLAYER, "CHO_FIN_EXT", steptime )
        log_amx( "Vote: Voting for the nextmap finished. Map %s will be extended to next %.0f minutes", mapname, steptime )

        return
    }

    new smap[32]
    if( g_voteCount[b] && g_voteCount[SELECTMAPS + 1] <= g_voteCount[b] )
    {
        copy( smap, charsmax( smap ), g_mapName[g_nextName[b]] )
        set_pcvar_string( pcv_amx_nextmap, smap )
    }

    get_pcvar_string( pcv_amx_nextmap, smap, charsmax( smap ) )
    print_col_chat( 0, "%L", LANG_PLAYER, "CHO_FIN_NEXT", smap )
    log_amx( "Vote: Voting for the nextmap finished. The nextmap will be %s", smap )

    new players[32], num
    get_players( players, num, "ch" )

    if( g_rtv )
    {
        if( pcv_lastround && get_pcvar_num( pcv_lastround ) )
        {
            if( !g_timelimit )
                g_timelimit = get_pcvar_float( pcv_mp_timelimit )

            set_pcvar_float( pcv_mp_timelimit, 0.0 )

            g_rtv = false
            g_changemap = true
            g_lastround = false

            say_hudmessage( 0, 210, 0, 0, 0.02, 0.21, 1, 20.0, 10.0, 0.5, 0.15, 4, "%L", AUTO_LANG, "FINAL_ROUND" )
    
            return
        }
    
        else
            g_rtv = false
    }

    else if( num > 1 )
    {
        if( pcv_lastround )
        {
            set_task( 90.0 - floatclamp( get_pcvar_float ( pcv_vote_time ), 10.0, 60.0 ), "initiateLastRound", 23478, "", 0, "d" )
            return
        }
    }

    set_task( 1.0, "delayMapChange" )
}

public initiateLastRound( )
{
    if( !get_pcvar_num( pcv_lastround ) ) return PLUGIN_CONTINUE

    if( !g_timelimit )
        g_timelimit = get_pcvar_float( pcv_mp_timelimit )

    g_lastround = true
    set_pcvar_float( pcv_mp_timelimit, 0.0 )

    say_hudmessage( 0, 100, 200, 0, 0.02, 0.21, 1, 20.0, 10.0, 0.5, 0.15, 4, "%L", AUTO_LANG, "FINAL_COMING" )

    return PLUGIN_CONTINUE
}

public evRoundStart( )
{
    if( !pcv_lastround ) return PLUGIN_CONTINUE

    if( !get_pcvar_num( pcv_lastround ) ) return PLUGIN_CONTINUE

    if( g_lastround )
    {
        g_changemap = true
        g_lastround = false

        say_hudmessage( 0, 210, 0, 0, 0.02, 0.21, 1, 20.0, 10.0, 0.5, 0.15, 4, "%L", AUTO_LANG, "FINAL_ROUND" )
    }
    
    else if( g_changemap )
    {
/*
        message_begin    ( MSG_ALL, SVC_INTERMISSION )
        message_end        ( )
*/

        set_pcvar_float( pcv_mp_timelimit, 0.01 )
    }

    return PLUGIN_CONTINUE
}

public mapChange ( )
{
    new Float:chattime = get_pcvar_float ( pcv_mp_chattime )

    if ( chattime < 3.0 )
    {
        chattime = 3.0
        set_pcvar_float ( pcv_mp_chattime, chattime )
    }

    set_task( chattime - 1.0, "delayMapChange" )

    return PLUGIN_CONTINUE
}

public delayMapChange( )
{
    new nextmap[32]
    get_pcvar_string( pcv_amx_nextmap, nextmap, charsmax( nextmap ) )
    server_cmd( "changelevel %s", nextmap )
}

loadSettings( filename[] )
{
    if( !file_exists( filename ) )
    {
        log_amx( "Mapcycle file ^"%s^" not found", filename )
        return 0
    }

    g_mapNums = 0

    new currentMap[32], map[32], string[256]
    get_mapname( currentMap, charsmax( currentMap ) )

    new file = fopen( filename, "r" )
    
    while( !feof( file ) )
    {
        fgets( file, string, charsmax( string ) )

        if
        (
            ( string[0] != ';' ) &&
            ( string[0] != '/' ) &&
            parse( string, map, charsmax( map ) ) &&
            isValidMap( map, charsmax( map ), currentMap ) &&
            isMapCycle( map ) == -1
        )
        {
            copy( g_mapName[g_mapNums++], charsmax( g_mapName[] ), map )
        }
    
    }

    fclose( file )

    return g_mapNums
}

stock bool:isValidMap( map[], const len, const currentMap[] )
{
    remove_quotes ( map )
    strtolower( map )

    while( replace( map, len, "/", "" ) ) {}
    while( replace( map, len, "\", "" ) ) {}
    while( replace( map, len, ":", "" ) ) {}
    while( replace( map, len, "*", "" ) ) {}
    while( replace( map, len, "?", "" ) ) {}
    while( replace( map, len, ">", "" ) ) {}
    while( replace( map, len, "<", "" ) ) {}
    while( replace( map, len, "|", "" ) ) {}
    while( replace( map, len, ".", "" ) ) {}

    if( is_map_valid( map ) && !equali( map, g_lastMap ) && !equali( map, currentMap ) ) return true

    return false
}

stock isMapCycle( map[] )
{
    for( new i; i < g_mapNums; i++ )
        if( equali( g_mapName[i], map ) ) return i

    return -1
}

public team_score( )
{
    new team[2]

    read_data( 1, team, 1 )
    g_teamScore[( team[0]=='C' ) ? 0 : 1] = read_data( 2 )
}

public pcvar_register( const pcvar_name[], const pcvar_value[] )
{
    new pcvar_index = get_cvar_pointer( pcvar_name )
    
    if( !pcvar_index )
        pcvar_index = register_cvar( pcvar_name, pcvar_value )

    return pcvar_index
}

stock say_hudmessage( id, red=255, green=255, blue=255, Float:x=0.05, Float:y=0.45, effects=0, Float:fxtime=6.0, Float:holdtime=5.0, Float:fadeintime=0.5, Float:fadeouttime=0.15, channel=4, msg[], any:... )
{
    new arg_num = numargs()
    new arg_langid[16], arg_langcount

    for( new i = 12; i < arg_num; i++ )
        if( getarg( i ) == AUTO_LANG )
            arg_langid[arg_langcount++] = i

    new players[32], player, num

    if( id )
    {
        players[0] = id
        num = 1
    }

    else
        get_players( players, num )

    set_hudmessage( red, green, blue, x, y, effects, fxtime, holdtime, fadeintime, fadeouttime, channel )

    new message[192]

    for( new i; i < num; i++ )
    {
        player = players[i]

        if( !is_user_connected( player ) ) continue

        for( new j; j < arg_langcount; j++ )
            setarg( arg_langid[j], 0, player )

        vformat( message, charsmax( message ), msg, 14 )
        show_hudmessage( player, message )
    }
}

public cmd_say_rtv( id )
{
    if( get_gametime( ) < ( get_pcvar_float( pcv_vote_delay ) * 60.0 ) )
    {
        new timeleft = floatround( get_pcvar_float( pcv_vote_delay ) * 60.0 - get_gametime( ) )

        print_col_chat( id, "%L", id, "RTV_NOTALLOWED", timeleft / 60, timeleft % 60 )
    }

    else
    {
        if( g_rtv_vote[id - 1] == id ) print_col_chat( id, "%L", id, "RTV_ALREADY" )

        else
        {
            g_rtv_vote[id - 1] = id
            g_rtv_count++
    
            static players[32], num
            get_players( players, num, "ch" )

            new Float:voteratio = floatclamp( get_pcvar_float ( pcv_votemap_ratio ), 0.0, 1.0 )

            num = floatround( voteratio * num )

            if( num <= g_rtv_count )
            {
                 g_rtv = true
                voteNextmap( )

                return PLUGIN_CONTINUE
            }

            static name[32]
            get_user_name( id, name, charsmax( name ) )
    
            print_col_chat( 0, "%L", LANG_PLAYER, "RTV_ADDVOTE", name, num - g_rtv_count, floatround( voteratio * 100.0 ) )
        }
    }

    return PLUGIN_CONTINUE
}

public client_disconnect( id )
{
    if( g_rtv_vote[id - 1] == id )
    {
        g_rtv_vote[id - 1] = 0
        g_rtv_count--
    }
}

public plugin_end( )
{
    if( g_timelimit )
        set_pcvar_float( pcv_mp_timelimit, g_timelimit )

    new current_map[32]
    get_mapname( current_map, charsmax( current_map ) )

    set_localinfo( "lastMap", current_map )

    return PLUGIN_CONTINUE
}
stock print_col_chat(const id, const input[], any:...)
{
    new count = 1, players[32];
    static msg[191];
    vformat(msg, 190, input, 3);
    replace_all(msg, 190, "!g", "^4"); // Green Color
    replace_all(msg, 190, "!y", "^1"); // Default Color (у©°  ж№«ој©)
    replace_all(msg, 190, "!t", "^3"); // Team Color
    if (id) players[0] = id; else get_players(players, count, "ch");
    {
        for ( new i = 0; i < count; i++ )
        {
            if ( is_user_connected(players[i]) )
            {
                message_begin(MSG_ONE_UNRELIABLE, SayText, _, players[i]);
                write_byte(players[i]);
                write_string(msg);
                message_end();
            }
        }
    }
}


Четвертый спойлер
Цитата
[en]
FINAL_ROUND = FINAL ROUND
FINAL_COMING = The FINAL ROUND^nis coming up
VOTE_COUNTER = %i seconds:^n^n%s
RTV_NOTALLOWED = Vote is currently not allowed. Wait %d minutes %d seconds.
RTV_ALREADY = You have already voted!
RTV_ADDVOTE = "%s" vote was added. Need %d to start voting! (%d^%^%)

[ru]
FINAL_ROUND = Последний раунд
FINAL_COMING = Ожидается^nПоследний раунд
VOTE_COUNTER = через %i секунд:^n^n%s
RTV_NOTALLOWED = [!gGF!n] Голосование будет доступно через !g%d!n минут !g%d!n секунд.
RTV_ALREADY = [!gGF!n] Вы уже проголосовали!
RTV_ADDVOTE = [!gGF!n] !t%s!n проголосовал. Для голосования нужно еще %d голосов! (%d^%^%)


Пятий спойлер
Цитата
[en]
CHO_FIN_EXT = Choosing finished. Current map will be extended to next %.0f minutes
CHO_FIN_NEXT = Choosing finished. The nextmap will be %s
CHOSE_EXT = %s chose map extending
X_CHOSE_X = %s chose %s
CHOOSE_NEXTM = AMX Choose nextmap
EXTED_MAP = Extend map %s
TIME_CHOOSE = It's time to choose the nextmap...

[ru]
CHO_FIN_EXT = [!gGF!n] Голосование завершено. Карта продлена на !t%.0f!n минут.
CHO_FIN_NEXT = [!gGF!n]Голосование завершено. Следующая карта %s
CHOSE_EXT = [!gGF!n] !t%s!n выбрал продление карты
X_CHOSE_X = [!gGF!n] !t%s!n выбрал %s
CHOOSE_NEXTM = [!gGF!n] Выбор следующей карты
EXTED_MAP = [!gGF!n] Продление карты на !t%s!n
TIME_CHOOSE = [!gGF!n] Пора выбирать следующую карту...


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

Отредактировал: MaZzai, - 15.9.2011, 20:27
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   Цитировать сообщение
Статус пользователя MaZzai
сообщение 15.9.2011, 20:24
Сообщение #2


Стаж: 17 лет

Сообщений: 2659
Благодарностей: 1411
Полезность: 1024

Елы-палы... А спойлер зачем придумали ? cbf1b2bfde1a.gif
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
Поблагодарили 2 раз
   + Цитировать сообщение
Статус пользователя Dale
сообщение 15.9.2011, 20:53
Сообщение #3


Стаж: 14 лет

Сообщений: 237
Благодарностей: 96
Полезность: 46

Цитата(MaZzai @ 15.9.2011, 21:24) *
Елы-палы... А спойлер зачем придумали ? cbf1b2bfde1a.gif

Извини, так что помогите :D
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя AndrewZ
сообщение 15.9.2011, 21:32
Сообщение #4


Иконка группы

Стаж: 18 лет
Город: Санкт-Петербург


Сообщений: 4700
Благодарностей: 2452
Полезность: 1018

У меня стоит плагин для цветного чата, его удобно использовать если на сервере много плагинов с цветным чатом, для оптимизации:
плагин
#include <amxmodx>

#define VERSION "0.1.0"

#define MAX_PLAYERS 32
#define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers )

enum _:Colors {
DontChange,
Red,
Blue,
Grey
}

new const g_szTeamName[][] =
{
"",
"TERRORIST",
"CT",
"SPECTATOR"
}

new gmsgSayText, gmsgTeamInfo, g_iMaxPlayers

new g_bConnected[MAX_PLAYERS+1]
new g_bBot[MAX_PLAYERS+1]
new g_iPlayerTeamColor[MAX_PLAYERS+1]

new Array:g_aStoreML

public plugin_init()
{
register_plugin("ColorChat", VERSION, "ConnorMcLeod")

register_event("TeamInfo", "Event_TeamInfo", "a")

gmsgTeamInfo = get_user_msgid("TeamInfo")
gmsgSayText = get_user_msgid("SayText")
g_iMaxPlayers = get_maxplayers()
g_aStoreML = ArrayCreate(1, 10) // assume we won't have more that 10 LANG_PLAYER args, so don't reserve more
}

public plugin_end()
{
// just in case...
ArrayDestroy(g_aStoreML)
}

public plugin_natives()
{
register_library("chatcolor")
register_native("client_print_color", "client_print_color")
}

public client_putinserver(id)
{
// Little tip so we won't alter HLTV TeamInfo, dunno what would result
g_bConnected[id] = !is_user_hltv(id)

// So we won't send useless msgs to bots
g_bBot[id] = is_user_bot(id)
}

public client_disconnect(id)
{
g_bConnected[id] = false
}

public Event_TeamInfo()
{
// Store the TeamInfo msg sent by game so if we alter that player TeamInfo
// we can restore is w/o retrieving his team
static szTeamInfo[2]
read_data(2, szTeamInfo, charsmax(szTeamInfo))
switch( szTeamInfo[0] )
{
case 'T': g_iPlayerTeamColor[ read_data(1) ] = Red
case 'C': g_iPlayerTeamColor[ read_data(1) ] = Blue
default : g_iPlayerTeamColor[ read_data(1) ] = Grey
}
}

public client_print_color(iPlugin, iParams) // client_print_color(id, iColor=DontChange, const szMsg[], any:...)
{
new id = get_param(1)

// check if id is different from 0
if( id )
{
// check player range and ingame player
if( !IsPlayer(id) || !g_bConnected[id] || g_bBot[id] )
{
return
}
}

new iColor = get_param(2)
if( iColor > Grey )
{
iColor = DontChange
}

new szMessage[256], iPlayerTeamColor
if( iColor > DontChange )
{
// if color specified, set 1st color to team color
szMessage[0] = 0x03
}
else
{
// if no color passed, set 1st color to green
szMessage[0] = 0x04
}

// Specific player code
if(id)
{
if( iParams == 3 )
{
// if only 3 args are passed, no need to format the string, just retrieve it
get_string(3, szMessage[1], charsmax(szMessage)-1)
}
else
{
// else format the string
vdformat(szMessage[1], charsmax(szMessage)-1, 3, 4)
}

// convert !g, !t, and !n flags
Set_String_Color(szMessage, charsmax(szMessage))

// cut the string at its 192th character to prevent a bug
// that would prevent players from joining the server
szMessage[192] = 0

// if color specified
iPlayerTeamColor = g_iPlayerTeamColor[id]
if( iColor && iPlayerTeamColor != iColor )
{
// set id TeamInfo in consequence
// so SayText msg gonna show the right color
Send_TeamInfo(id, id, MSG_ONE_UNRELIABLE, g_szTeamName[iColor])

// Send the message
Send_SayText(id, id, MSG_ONE_UNRELIABLE, szMessage)

// restore TeamInfo
Send_TeamInfo(id, id, MSG_ONE_UNRELIABLE, g_szTeamName[iPlayerTeamColor])
}
else
{
Send_SayText(id, id, MSG_ONE_UNRELIABLE, szMessage)
}
}

// Send message to all players
else
{
// Figure out if at least 1 player is connected
// so we don't send useless message if not
// and we gonna use that player as team reference (aka SayText message sender) for color change
new iPlayerFound = FindPlayer()
if( !iPlayerFound )
{
return
}

new j

// Use that array to store LANG_PLAYER args indexes, and szTemp to store ML keys
new iArraySize, szTemp[64]

for(j=4; j<iParams-1; j++)
{
// retrieve original param value and check if it's LANG_PLAYER value
if( get_param_byref(j) == LANG_PLAYER )
{
// as LANG_PLAYER == -1, check if next parm string is a registered language translation
get_string(j+1, szTemp, charsmax(szTemp))
if( GetLangTransKey(szTemp) )
{
// Store that arg as LANG_PLAYER so we can alter it later
ArrayPushCell(g_aStoreML, j)

// Update ML array saire so we'll know 1st if ML is used,
// 2nd how many args we have to alterate
iArraySize++

j++
}
}
}

// If arraysize == 0, ML is not used
// we can only send 1 MSG_BROADCAST message
if( !iArraySize )
{
if( iParams == 3 )
{
get_string(3, szMessage[1], charsmax(szMessage)-1)
}
else
{
vdformat(szMessage[1], charsmax(szMessage)-1, 3, 4)
}

Set_String_Color(szMessage, charsmax(szMessage))
szMessage[192] = 0

iPlayerTeamColor = g_iPlayerTeamColor[iPlayerFound]
if( iColor && iPlayerTeamColor != iColor )
{
Send_TeamInfo(0, iPlayerFound, MSG_BROADCAST, g_szTeamName[iColor])
Send_SayText(0, iPlayerFound, MSG_BROADCAST, szMessage)
Send_TeamInfo(0, iPlayerFound, MSG_BROADCAST, g_szTeamName[iPlayerTeamColor])
}
else
{
Send_SayText(0, iPlayerFound, MSG_BROADCAST, szMessage)
}
}

// ML is used, we need to loop through all players,
// format text and send a MSG_ONE_UNRELIABLE SayText message
else
{
iPlayerTeamColor = g_iPlayerTeamColor[iPlayerFound]
new bColorChange = ( iColor && iPlayerTeamColor != iColor )
new szNewColor[10], szPreviousColor[10]
if( bColorChange )
{
copy(szNewColor, charsmax(szNewColor), g_szTeamName[iColor])
copy(szPreviousColor, charsmax(szPreviousColor), g_szTeamName[iPlayerTeamColor])
}

for( new i = 1; i <= g_iMaxPlayers; i++ )
{
if( g_bConnected[i] && !g_bBot[i] )
{
for(j=0; j<iArraySize; j++)
{
// Set all LANG_PLAYER args to player id ( = i )
// so we can format the text for that specific player
set_param_byref(ArrayGetCell(g_aStoreML, j), i)
}

// format string for player i
vdformat(szMessage[1], charsmax(szMessage)-1, 3, 4)

Set_String_Color(szMessage, charsmax(szMessage))
szMessage[192] = 0

if( bColorChange )
{
Send_TeamInfo(i, iPlayerFound, MSG_ONE_UNRELIABLE, szNewColor)
Send_SayText(i, iPlayerFound, MSG_ONE_UNRELIABLE, szMessage)
Send_TeamInfo(i, iPlayerFound, MSG_ONE_UNRELIABLE, szPreviousColor)
}
else
{
Send_SayText(i, iPlayerFound, MSG_ONE_UNRELIABLE, szMessage)
}
}
}
// clear the array so next ML message we don't need to figure out
// if should use PushArray or SetArray
ArrayClear(g_aStoreML)
}
}
}

// convert !g, !t, and !n flags
Set_String_Color( szString[] , iLen )
{
while( replace(szString, iLen, "!g", "^4") )
{
}
while( replace(szString, iLen, "!t", "^3") )
{
}
while( replace(szString, iLen, "!n", "^1") )
{
}
}

Send_TeamInfo(iReceiver, iPlayerId, MSG_DEST, szTeam[])
{
message_begin(MSG_DEST, gmsgTeamInfo, _, iReceiver)
write_byte(iPlayerId)
write_string(szTeam)
message_end()
}

Send_SayText(iReceiver, iPlayerId, MSG_DEST, szMessage[])
{
message_begin(MSG_DEST, gmsgSayText, _, iReceiver)
write_byte(iPlayerId)
write_string(szMessage)
message_end()
}

FindPlayer()
{
for(new id=1; id<=g_iMaxPlayers; id++)
{
if(g_bConnected[id])
{
return id
}
}
return 0
}


и нужен инклуд
#if defined _chatcolor_included
#endinput
#endif
#define _chatcolor_included

#pragma reqlib chatcolor

/* ColorChat Support */
/* Replace in .sma line #include <colorchat> with #include <chatcolor> */
#define NORMAL DontChange
#define GREEN DontChange
#define TEAM_COLOR DontChange
#define RED Red
#define BLUE Blue
#define GREY Grey
#define ColorChat client_print_color
/* ColorChat Support */

enum _:Colors {
DontChange,
Red,
Blue,
Grey
}

native client_print_color(id, iColor=DontChange, const szMsg[], any:...);
native register_dictionary_colored(const filename[]);


Пример перевода с лангом:
Цитата
client_print_color(id, Blue, "%L", id, "TYPE_HELP")
client_print_color(id, Red, "%L", id, "TYPE_HELP")
client_print_color(id, Grey, "%L", id, "TYPE_HELP")
client_print_color(id, DontChange, "%L", id, "TYPE_HELP")


Пример ланга:
Цитата
TIME_INFO_1 = !nВремени осталось: !t%d:%02d мин. !nСледующая карта: !t%s


!n - нормальный цвет, !t - цвет указанный вторым аргументом (Blue, Red, Grey, DontChange), !g - зеленый

Отредактировал: ZZZombiE, - 15.9.2011, 21:33


Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
Поблагодарили 1 раз
   + Цитировать сообщение
Статус пользователя Dale
сообщение 15.9.2011, 22:01
Сообщение #5


Стаж: 14 лет

Сообщений: 237
Благодарностей: 96
Полезность: 46

Дай аську не то по айпи вычеслю :D:D:D
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя _Skyline
сообщение 16.9.2011, 8:44
Сообщение #6


Стаж: 18 лет
Город: Екатеринбург

Сообщений: 1414
Благодарностей: 839
Полезность: 1060

А ничего что плагины UFPS нельзя выносить с d-s.ru?
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя iLLuSioN
сообщение 16.9.2011, 10:46
Сообщение #7
Иконка группы

Стаж: 19 лет

Сообщений: 6911
Благодарностей: 7990
Полезность: 1639

_Skyline,
А ничего что это не тот плагин UFPS который нельзя выносить с d-s.ru ?



Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
Поблагодарили 3 раз
   + Цитировать сообщение
Статус пользователя drocher
сообщение 16.9.2011, 11:04
Сообщение #8


Стаж: 14 лет

Сообщений: 41
Благодарностей: 2
Полезность: 39

Цитата(_Skyline @ 16.9.2011, 9:44) *
А ничего что плагины UFPS нельзя выносить с d-s.ru?

а шо эта за ды-сы.ру ?
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя H@ROS
сообщение 16.9.2011, 16:05
Сообщение #9


Стаж: 14 лет

Сообщений: 102
Благодарностей: 17
Полезность: 134

Цитата(drocher @ 16.9.2011, 12:04) *
а шо эта за ды-сы.ру ?

Если по-проще, то там покупается MyAC.
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя drocher
сообщение 16.9.2011, 17:37
Сообщение #10


Стаж: 14 лет

Сообщений: 41
Благодарностей: 2
Полезность: 39

Цитата(H@ROS @ 16.9.2011, 17:05) *
Если по-проще, то там покупается MyAC.

Гы, там еще и акк покупать надо crazy.gif циркачи,плиать
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя H@ROS
сообщение 17.9.2011, 6:13
Сообщение #11


Стаж: 14 лет

Сообщений: 102
Благодарностей: 17
Полезность: 134

Цитата(drocher @ 16.9.2011, 17:37) *
Гы, там еще и акк покупать надо crazy.gif циркачи,плиать

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