Поиск flags for cvar

Shadowless

Пользователь
Регистрация
24 Фев 2019
Сообщения
237
Симпатии
4
Пол
Мужской
i`m looking for plugin... something like cvars access level(flags)
for example...
admin with flag "gt" (ADMIN_CVAR + ADMIN_LEVEL_H) can use csstats_reset and admin with only flag g(ADMIN_CVAR) can`t

я ищу плагин ... что-то вроде уровня доступа cvars (флаги)
например...
Администратор с флагом "gt" (ADMIN_CVAR + ADMIN_LEVEL_H) может использовать "csstats_reset", а администратор только с флагом g (ADMIN_CVAR) не может
 

perfectblood0

Команда форума
Администратор
Регистрация
29 Окт 2017
Сообщения
2.578
Симпатии
914
Пол
Женский
i`m looking for plugin... something like cvars access level(flags)
for example...
admin with flag "gt" (ADMIN_CVAR + ADMIN_LEVEL_H) can use csstats_reset and admin with only flag g(ADMIN_CVAR) can`t

я ищу плагин ... что-то вроде уровня доступа cvars (флаги)
например...
Администратор с флагом "gt" (ADMIN_CVAR + ADMIN_LEVEL_H) может использовать "csstats_reset", а администратор только с флагом g (ADMIN_CVAR) не может
Cmdaccess.ini
 

Shadowless

Пользователь
Регистрация
24 Фев 2019
Сообщения
237
Симпатии
4
Пол
Мужской
Views: 25 :( and nobady wanted to help.. so i did it by myself

as well on my server only server owner has flag "t" i maked ( stolen : ) it for ADMIN_LEVEL_H
its prevent "cvar admins" for use csstats_reset and only server owner can reset stats
you can change or add other cvars for disable using of it
hope it will help lot of servers owners for prevent some cvar changes

C++:
/*
Plugin generated by AMXX-Studio
Credits To OLO for "Admin Commands"
*/

#include <amxmodx>

#define PLUGIN "CVAR GUARD"
#define VERSION "1.0"
#define AUTHOR "Shadowless"

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_clcmd("amx_cvar","amxcvarguard",ADMIN_CVAR,"amx_cvar < cvar > < value >")
    register_concmd("amx_cvar", "amxcvarguard", ADMIN_CVAR, "<cvar> [value]")
    return PLUGIN_CONTINUE
}

public amxcvarguard(id)
{
    if (!(get_user_flags(id) & ADMIN_CVAR)){
        client_print(id,print_console,"[AMX] You have no access to that command")
        return PLUGIN_HANDLED
    }
    if (read_argc() < 3){
        client_print(id,print_console,"[AMX] Usage: amx_cvar < cvar > < value >")
        return PLUGIN_HANDLED
    }

    new arg[32], arg2[64]
    read_argv(1,arg,32)
    read_argv(2,arg2,64)

    if (cvar_exists(arg)){
        if (equal(arg,"csstats_reset") && !(get_user_flags(id) & ADMIN_LEVEL_H)){
            client_print(id,print_console,"[AMX] You have no access to that cvar")
            return PLUGIN_HANDLED
        }
    
        new authid[16],name[32]
        get_user_authid(id,authid,16)
        get_user_name(id,name,32)
    
        set_cvar_string(arg,arg2);
        client_print(id,print_console,"[AMX] Cvar ^"%s^" changed to ^"%s^"",arg,arg2)
    }
    else{
        client_print(id,print_console,"[AMX] Unknown cvar")
    }
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/

sorry for beeing newbie in scripting :) but i think its good idea...

P.S. its must located up to admincmd.amxx in plugins.ini
 

Shadowless

Пользователь
Регистрация
24 Фев 2019
Сообщения
237
Симпатии
4
Пол
Мужской
C++:
/*
Plugin generated by AMXX-Studio
Credits To OLO for "Admin Commands"
*/

#include <amxmodx>

#define PLUGIN "CVAR GUARD"
#define VERSION "1.0"
#define AUTHOR "Shadowless"

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_clcmd("amx_cvar","amxcvarguard",ADMIN_CVAR,"amx_cvar < cvar > < value >")
    register_concmd("amx_cvar", "amxcvarguard", ADMIN_CVAR, "<cvar> [value]")
    return PLUGIN_CONTINUE
}

public amxcvarguard(id)
{
    if (!(get_user_flags(id) & ADMIN_CVAR)){
        client_print(id,print_console,"[AMX] You have no access to that command")
        return PLUGIN_HANDLED
    }
    if (read_argc() < 3){
        client_print(id,print_console,"[AMX] Usage: amx_cvar < cvar > < value >")
        return PLUGIN_HANDLED
    }
    
    new arg[32], arg2[64]
    read_argv(1,arg,32)
    read_argv(2,arg2,64)
    
    if (cvar_exists(arg)){
        if (equal(arg,"csstats_reset") && !(get_user_flags(id) & ADMIN_LEVEL_H)){
            client_print(id,print_console,"[AMX] You have no access to that cvar")
            return PLUGIN_HANDLED
        }
        
        set_cvar_string(arg,arg2);
        client_print(id,print_console,"[AMX] Cvar ^"%s^" changed to ^"%s^"",arg,arg2)
    }
    else{
        client_print(id,print_console,"[AMX] Unknown cvar")
    }
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/
 
Сверху Снизу