/* * * Config Fixer: * ------------- * * This plugin will give the admins the ability to fix a user's config, returning it to * default. This is very useful for players that have been slowhacked to advertise the * servers without their approval. * This plugin will not execute any command until the player has agreed to the fix. In * the player does not approve to the fix, the admins have the choice to decide wether * or not to give the player a punishment or let him be, configurable by cvar. * * * Commands: * --------- * amx_fixconfig - Fixes a users config (ADMINS) * * Cvars: * ------ * None * * Installation: * ------------- * Copy ConfigFixer.amxx to cstrike/addons/amxmodx/plugins * Go to cstrike/addons/amxmodx/configs/plugin.ini and add: ConfigFixer.amxx * * Modules: * -------- * amxmodx * * Credits: * -------- * None * * Change Log: * ----------- * 1.0: + initial release * 1.1: + added cvar for punishement picking (none - kick - ban) * + added cvar for bantime * 1.2: + removed punishment and bantime cvars * + added a client command to reset their own config * + added command that displays the command to the user * + fixed some bugs * + added the escape button to the binds * + added missing binds * 1.3: + fixed small bug thanks to isotonic * */ // Includes #include #include // Forcing Semicolon #pragma semicolon 1 // Plugin Info new NAME[] = "ConfigFixer"; new VERSION[] = "1.3"; new AUTHOR[] = "n0br41ner"; // Variables new bool:g_bDidChoose; new bool:g_bVoteStarted; new g_iWhoIssued; new g_strAdminName[32]; new g_strPlayerName[32]; new g_iTarget; new g_iAdmin; public plugin_init( ) { // Registering plugin register_plugin( NAME, VERSION, AUTHOR ); // Command for admins to use on players register_clcmd( "say /fixconfig", "askTarget" ); register_concmd( "amx_displaycommand", "displayCommand", ADMIN_ADMIN, " - Displays the /fixconfig command to a player" ); register_concmd( "amx_fixconfig", "askTargetAd", ADMIN_BAN, " - Displays the menu for the user to default his config" ); } public askTargetAd( id, level, cid ) { if( !cmd_access( id, level, cid, 1 ) ) { return PLUGIN_HANDLED; } if( read_argc( ) != 2 ) { return PLUGIN_HANDLED; } if( g_bVoteStarted ) { client_print( id, print_chat, "[AMXX] Another player is already using the menu." ); return PLUGIN_HANDLED; } g_iWhoIssued = 2; g_iAdmin = id; read_argv( 1, g_strPlayerName, charsmax( g_strPlayerName ) ); g_iTarget = cmd_target( id, g_strPlayerName, CMDTARGET_NO_BOTS /*| CMDTARGET_OBEY_IMMUNITY*/ ); get_user_name( g_iAdmin, g_strAdminName, charsmax( g_strAdminName ) ); get_user_name( g_iTarget, g_strPlayerName, charsmax( g_strPlayerName ) ); if( !g_iTarget ) { return PLUGIN_HANDLED; } g_bVoteStarted = true; AskTarget( g_iTarget ); set_task( 15.0, "EndMenuIfNot" ); return PLUGIN_HANDLED; } public displayCommand( id, level, cid ) { if( !cmd_access( id, level, cid, 1 ) ) { return PLUGIN_HANDLED; } if( read_argc( ) != 2 ) { return PLUGIN_HANDLED; } // Local variables new szPlayerName[32]; // Store the player's name new iTarget; // Store the player's id // Setoring the player's name in the variable and getting the id read_argv(1, szPlayerName, charsmax(szPlayerName)); iTarget = cmd_target(id, szPlayerName, CMDTARGET_NO_BOTS); get_user_name(id, g_strAdminName, charsmax(g_strAdminName)); get_user_name(iTarget, szPlayerName, charsmax(szPlayerName)); if( !iTarget ) { return PLUGIN_HANDLED; } set_hudmessage( 255, 255, 255, -1.0, 0.20, 0, 0.2, 20.0 ); show_hudmessage( iTarget, "ADMIN %s: please type /fixconfig to remove the auto-spam^nNOTE: all your binds will be defaulted", g_strAdminName ); return PLUGIN_HANDLED; } public askTarget( id ) { if( g_bVoteStarted ) { client_print( id, print_chat, "[AMXX] Another player is already using the menu." ); return PLUGIN_HANDLED; } g_bVoteStarted = true; g_iWhoIssued = 1; AskTarget( id ); g_iTarget = id; set_task( 15.0, "EndMenuIfNot" ); return PLUGIN_HANDLED; } AskTarget( id ) { new menu = menu_create("\rFix Config? ALL your binds will be defaulted:^n\dby n0br41ner", "HandleMenu" ); if( g_iWhoIssued == 2 ) { client_print( id, print_chat, "[AMXX] %s has requested that you reset your config to default.", g_strAdminName ); } menu_additem( menu, "\wAccept", "1", 0 ); menu_additem( menu, "\wReject", "2", 0 ); menu_display( id, menu, 0 ); } public HandleMenu( id, menu, item ) { if( item == MENU_EXIT ) { g_bVoteStarted = false; if( g_iWhoIssued == 2 ) { client_print( g_iAdmin, print_chat, "[AMXX] %s did not accept to reset his config", g_strPlayerName ); } g_iWhoIssued = 0; g_bDidChoose = true; client_print( id, print_chat, "[AMXX] No changes were made to your config." ); return PLUGIN_HANDLED; } // Get the info that the user chose new data[6], strName[64], access, callback; menu_item_getinfo( menu, item, access, data, charsmax( data ), strName, charsmax( strName ), callback ); new key = str_to_num( data ); // Reacting off the user's choice switch( key ) { case 1: { FixConfig( id ); client_print( id, print_chat, "[AMXX] ALL your binds have been defaulted." ); if( g_iWhoIssued == 2 ) { client_print( g_iAdmin, print_chat, "[AMXX] %s has accepted to reset his config", g_strPlayerName ); } g_bDidChoose = true; g_bVoteStarted = false; return PLUGIN_HANDLED; } case 2: { client_print( id, print_chat, "[AMXX] No changes were made to your config." ); if( g_iWhoIssued == 2 ) { client_print( g_iAdmin, print_chat, "[AMXX] %s did not accept to reset his config", g_strPlayerName ); } g_bVoteStarted = false; g_bDidChoose = true; return PLUGIN_HANDLED; } } return PLUGIN_HANDLED; } FixConfig( id ) { // Binding all keys to default ones client_cmd( id, "bind TAB +showscores;wait;wait;bind ENTER +attack;wait;wait;bind ESCAPE cancelselect;wait;wait;bind SPACE +jump;wait;wait;bind ' +moveup;wait;wait;bind + sizeup;wait;wait;bind , buyammo1" ); client_cmd( id, "bind - sizedown;wait;wait;bind . buyammo2;wait;wait;bind / +movedown;wait;wait;bind 0 slot10;wait;wait;bind 1 slot1;wait;wait;bind 2 slot2;wait;wait;bind 3 slot3;wait;wait;bind 4 slot4" ); client_cmd( id, "bind 5 slot5;wait;wait;bind 6 slot6;wait;wait;bind 7 slot7;wait;wait;bind 8 slot8;wait;wait;bind 9 slot9;wait;wait;bind ^";^" +mlook;wait;wait;bind = sizeup;wait;wait;bind [ invprev" ); client_cmd( id, "bind ] invnext;wait;wait;bind ` toggleconsole;wait;wait;bind a +moveleft;wait;wait;bind b buy;wait;wait;bind c radio3;wait;wait;bind d +moveright;wait;wait;bind e +use;wait;wait;bind f ^"impulse 100^"" ); client_cmd( id, "bind g drop;wait;wait;bind h +commandmenu;wait;wait;bind i showbriefing;wait;wait;bind j cheer;wait;wait;bind k +voicerecord;wait;wait;bind m chooseteam;wait;wait;bind n nightvision" ); client_cmd( id, "bind o buyequip;wait;wait;bind q lastinv;wait;wait;bind r +reload;wait;wait;bind s +back;wait;wait;bind t ^"impulse 201^";wait;wait;bind u messagemode2;wait;wait;bind w +forward" ); client_cmd( id, "bind x radio2;wait;wait;bind y messagemode;wait;wait;bind z radio1;wait;wait;bind ~ toggleconsole;wait;wait;bind UPARROW +forward;wait;wait;bind DOWNARROW +back;wait;wait;bind LEFTARROW +left" ); client_cmd( id, "bind RIGHTARROW +right;wait;wait;bind ALT +strafe;wait;wait;bind CTRL +duck;wait;wait;bind SHIFT +speed;wait;wait;bind F1 autobuy;wait;wait;bind F2 rebuy;wait;wait;bind F5 snapshot;wait;wait;bind F6 ^"save quick^"" ); client_cmd( id, "bind F7 ^"load quick^";wait;wait;bind F10 ^"quit prompt^";wait;wait;bind INS +klook;wait;wait;bind PGDN +lookdown;wait;wait;bind PGUP +lookup;wait;wait;bind END centerview" ); client_cmd( id, "bind MWHEELDOWN invnext;wait;wait;bind MWHEELUP invprev;wait;wait;bind MOUSE1 +attack;wait;wait;bind MOUSE2 +attack2;wait;wait;bind PAUSE pause" ); client_print( id, print_chat, "It is also recommended to delete your config.cfg and userconfig.cfg files from your cstrike folder." ); } public EndMenuIfNot( ) { if( !g_bDidChoose ) { g_bDidChoose = false; g_bVoteStarted = false; g_iWhoIssued = 0; show_menu( g_iTarget, 0, "^n", 1 ); client_print( g_iTarget, print_chat, "[AMXX] You did not choose any option. No changes were made." ); } return PLUGIN_HANDLED; }