• Гость, перед открытием темы прочитай описание раздела, чтобы не ошибиться. Любые вопросы по настройке сервера создаются в разделе Технической Поддержки.
Иконка ресурса

AmxModX Auto Steam Vip 1.0

Нет прав для скачивания
Код:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN    "Auto VIP [STEAM]"
#define VERSION    "1.1"
#define AUTHOR    "Jack Daniel`s"
#define IGNORE_FLAG ADMIN_LEVEL_A

new bool:steam[33];
new vipaccess[32];
new defaccess[32];

new check_time, amx_vip_access, amx_default_access, steam_check;

new const PREFIX[] = "!n[!gСервер!n]";

public plugin_init()
{
    register_plugin( PLUGIN, VERSION, AUTHOR )
    register_dictionary( "auto_steam_vip.txt" )
   
    check_time = register_cvar( "amx_check_after", "10.0" )
    amx_vip_access = register_cvar( "amx_vip_access", "bit" )
    amx_default_access = register_cvar( "amx_default_access", "z" )
    steam_check = register_cvar( "amx_steam_check", "1" )
   
    register_clcmd("say", "handle_say")
}

public plugin_cfg( )
{
    new cfgdir[ 32 ]
    get_configsdir( cfgdir, charsmax( cfgdir ) )
   
    server_cmd( "exec %s/auto_steam_vip.cfg", cfgdir )
}

public client_putinserver( id )
{
    set_task( get_pcvar_float( check_time ), "check_access", id )
}

public check_access( id )
{
    steam[ id ] = ( is_user_steam( id ) )
   
    get_pcvar_string( amx_vip_access, vipaccess, 31 )
    get_pcvar_string( amx_default_access, defaccess, 31 )
   
    new defaccess2 = read_flags( defaccess )
    new vipaccess2 = read_flags( vipaccess )
    new iFlags = get_user_flags(id)
   
    if( is_user_connected( id ) )
    {
        if ( iFlags & IGNORE_FLAG || iFlags & vipaccess2 == vipaccess2 )
            return
        if( steam[ id ] )
        {
            if ( defaccess2 )
            {
                remove_user_flags( id, defaccess2 )
                set_user_flags( id, vipaccess2 )
               
                ChatColor( id, "%L", id, "GIVE_VIP", PREFIX )
                ChatColor( id, "%L", id, "GOOD_LUCK", PREFIX )
            }
        }
    }
}

public handle_say( id )
{
    new said[192]
    read_args( said,192 )

    if( get_pcvar_num( steam_check ) == 1 )
    {
        if( containi(said, "/steam") != -1 )
            show_users( id )
    }

    return PLUGIN_CONTINUE
}

public show_users( user )
{
    new steamnames[32][33]
    new message[256]
    new id, count, x, len
   
    new players[32], playersnum
    get_players( players, playersnum, "ch" )
    for( --playersnum; playersnum >= 0; playersnum-- )
    {
        id = players[playersnum]

        if( steam[ id ] )
        {
            get_user_name( id, steamnames[count++], charsmax(steamnames[]) )
        }
    }

    len = formatex(message, charsmax(message), "%L", user, "STEAM_ONLINE" )
    if( count > 0 )
    {
        for( x = 0 ; x < count ; x++ )
        {
            len += formatex(message[len], charsmax(message)-len, "^3 %s%s", steamnames[x], x < (count-1) ? ", ":"." )
            if( len > 96 )
            {
                ChatColor( user, message )
                len = format( message, 255, "^4" )
            }
        }
        ChatColor( user, message )
    }
    else
    {
        len += format( message[len], 255-len, " %L", user, "STEAM_OFFLINE" )
        ChatColor( user, message )
    }
}

stock bool:is_user_steam( id )
{
    static dp_pointer;

    if (dp_pointer || (dp_pointer = get_cvar_pointer("dp_r_id_provider")))
    {
        server_cmd("dp_clientinfo %d", id);
        server_exec();
        return (get_pcvar_num(dp_pointer) == 2) ? true : false;
    }

    return false;
}

stock ChatColor(const id, const input[], any:...)
{
    new count = 1, players[32]
    static msg[192]
    vformat(msg, 191, input, 3)
 
    replace_all(msg, 191, "!g", "^4") // Green Color
    replace_all(msg, 191, "!y", "^1") // Default Color
    replace_all(msg, 191, "!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, get_user_msgid("SayText"), _, players[i])
                write_byte(players[i]);
                write_string(msg);
                message_end();
            }
        }
    }
}
Сверху