здравствуйте, есть такой plugin когда игрок напишет clearcfg у него очищается config.
если кто то поможет хочу чтоб добавили amx_cleanmenu для админов чтобы они тоже могли очистить конфиги у игроков.
заранее спасибо.
Код
/* Config Clear With Command */
#include <amxmodx>
#include <amxmisc>
#define LEN_RECORDS 191
#define DEF_CONFIG 128
new pcv_menu
new def_counter
new def_database[DEF_CONFIG][LEN_RECORDS+1]
public plugin_init( )
{
register_plugin( "Config Clear With Command","1.0","player" )
register_dictionary( "antiadvert.txt" )
register_clcmd( "clearcfg", "_print_menu" )
}
public plugin_cfg()
{
new configsdir[64], filename[64], string[LEN_RECORDS+1], pos, len
get_configsdir( configsdir, charsmax( configsdir ) )
formatex( filename, charsmax( filename ), "%s/antiadvert.ini", configsdir )
if( file_exists( filename ) )
{
while( ( def_counter < DEF_CONFIG ) && read_file( filename, pos++, string, LEN_RECORDS, len ) )
{
if( !containi( string, "BIND" ) || !containi( string, "UNBINDALL" ) )
copy( def_database[def_counter++], LEN_RECORDS, string )
}
}
else
{
log_amx( "%s not found", filename )
}
pcv_menu = menu_create( "ADV_CLEAR_MENU", "_handle_menu", 1 )
menu_additem( pcv_menu, "", "1" )
menu_setprop( pcv_menu, MPROP_NUMBER_COLOR, "\r" )
menu_setprop( pcv_menu, MPROP_EXIT, MEXIT_NEVER )
}
public _print_menu( id )
{
if( !is_user_connected( id ) )
return PLUGIN_HANDLED
new m_title[256], m_clear[128]
formatex( m_title, charsmax( m_title ), "%L", id, "UAA_TITLE" )
formatex( m_clear, charsmax( m_clear ), "%L", id, "UAA_CLEAR" )
menu_item_setname( pcv_menu, 0, m_clear )
menu_setprop( pcv_menu, MPROP_TITLE, m_title )
menu_display( id, pcv_menu )
return PLUGIN_CONTINUE
}
public _handle_menu( id, menu, item )
{
if( item == MENU_EXIT ) return PLUGIN_HANDLED
new _access, info[3], callback
menu_item_getinfo( menu, item, _access, info, charsmax( info ), _, _, callback )
new key = str_to_num( info )
switch( key )
{
case 1:
{
for( new i=0; i < def_counter; ++i )
{
client_cmd( id, def_database[i] )
}
}
}
return PLUGIN_HANDLED
}
public plugin_end( )
{
menu_destroy( pcv_menu )
}