Raised This Month: $ Target: $400
 0% 

High Ping Kicker "Argument Mismatch"


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
StickP0le
Senior Member
Join Date: Jan 2010
Location: cuantocabron.com
Old 06-25-2012 , 21:15   Re: High Ping Kicker "Argument Mismatch"
Reply With Quote #2

Code:
 /* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #define VERSION "1.0" #define MAX_PLAYERS    32 new g_pCvarHPKMaxPing, g_pCvarHPKPingChecks,       g_pCvarHPKCheckFrequency, g_pCvarHPKStartDelay,       g_pCvarHPKMinPlayers, g_pCvarHPKImmunity; new g_iPing[ 33 ], g_iSamples[ 33 ]; new g_iCheckPlayers[ MAX_PLAYERS + 1 ]    // To save the poor cpu having to keep track of the connected players new g_iMsgSayText; new g_iMaxPlayers; public plugin_init( ) {     register_plugin( "High Ping Kicker", VERSION, "Shadow & Bo0m!" );     register_concmd( "amx_hpk", "HighPingKicker", ADMIN_IMMUNITY, "- configures high ping kicker" );     g_pCvarHPKMaxPing = register_cvar( "amx_hpk_maxping", "130" );     g_pCvarHPKPingChecks = register_cvar( "amx_hpk_pingchecks", "5" );     g_pCvarHPKCheckFrequency = register_cvar( "amx_hpk_checkfrequency", "12" );     g_pCvarHPKStartDelay = register_cvar( "amx_hpk_startdelay", "60" );     g_pCvarHPKMinPlayers = register_cvar( "amx_hpk_minplayers", "10" );     g_pCvarHPKImmunity = register_cvar(" amx_hpk_immunity", "1" );           g_iMsgSayText = get_user_msgid( "SayText" );           g_iMaxPlayers = get_maxplayers( )     if( get_pcvar_num( g_pCvarHPKCheckFrequency ) < 5 )         set_pcvar_num( g_pCvarHPKCheckFrequency, 5 )           if( get_pcvar_num( g_pCvarHPKPingChecks ) < 3 )         set_pcvar_num( g_pCvarHPKPingChecks, 3 )               set_task( 15.0, "CheckPlayers", 64, _, _, "b" ) } public client_putinserver( id ) {         g_iPing[ id ] = 0       g_iSamples[ id ] = 0     if( !is_user_bot( id ) )       {         new iParam[ 1 ];         iParam[ 0 ] = id           set_task( 15.0, "ShowWarn", id, iParam, 1 )               if( get_pcvar_num( g_pCvarHPKStartDelay ) != 0 )             set_task( float( get_pcvar_num( g_pCvarHPKStartDelay ) ), "StartDelay", id, iParam, 1 )         else             set_task( float( get_pcvar_num( g_pCvarHPKCheckFrequency ) ), "CheckFrequency", id, iParam, 1, "b" )     } } public ShowWarn( szParam[ ] ) {     static iPingKicked;     iPingKicked = get_pcvar_num( g_pCvarHPKMaxPing )           ChatColor( szParam[ 0 ], "!g[ HPK ] !yPlayers with ping higher than !g%d !ywill be kicked!", iPingKicked ) } public StartDelay( szParam[ ] ) {     new uName[ 33 ];     get_user_name( szParam[ 0 ], uName, charsmax( uName ) );     set_task( float( get_pcvar_num( g_pCvarHPKCheckFrequency ) ), "CheckFrequency" , szParam[ 0 ], szParam, 1, "b" ) } public CheckPlayers( ) {     if( get_playersnum( ) >= get_pcvar_num( g_pCvarHPKMinPlayers ) )     {         for ( new i = 1; i <= g_iMaxPlayers; i++ )         {             if( g_iCheckPlayers[ i ] )                 CheckFrequency( i );         }     } } public CheckFrequency( szParam ) {     if( get_pcvar_num( g_pCvarHPKPingChecks ) < 3 )         set_pcvar_num( g_pCvarHPKPingChecks, 3 )     new id = szParam     if( get_user_flags( id ) & ADMIN_IMMUNITY && get_pcvar_num( g_pCvarHPKImmunity ) == 1 )     {         remove_task( id )         ChatColor( id, "!g[ HPK ] !yPing checking disabled due to immunity..." );         return PLUGIN_CONTINUE;     }     new iPing, iLoss;     get_user_ping( id, iPing, iLoss )       g_iPing[ id ] += iPing     ++g_iSamples[ id ]     if( ( g_iSamples[ id ] > get_pcvar_num( g_pCvarHPKPingChecks ) ) && ( g_iPing[ id ] / g_iSamples[ id ] > get_pcvar_num( g_pCvarHPKMaxPing ) ) )         KickPlayer( id )     return PLUGIN_CONTINUE } KickPlayer( id ) {       new uName[ 33 ], uAuthId[ 35 ];     get_user_name( id, uName, charsmax( uName ) );     get_user_authid( id, uAuthId, charsmax( uAuthId ) );           ChatColor( 0, "!g[ HPK ] !yPlayer !g%s !ydisconnected due to high ping.", uName );     server_cmd( "kick #%d ^"Sorry but your ping is too high, try again later...^"", get_user_userid( id ) )     log_amx( "HPK: ^"%s<%d><%s>^" was kicked due high ping ( Average Ping ^"%d^" )", uName, get_user_userid( id ), uAuthId, ( g_iPing[ id ] / g_iSamples[ id ] ) ) } public HighPingKicker( id, level, cid ) {     if( !cmd_access( id, level, cid, 3 ) )         return PLUGIN_HANDLED;           static iMaxPing;     iMaxPing = get_pcvar_num( g_pCvarHPKMaxPing )           static iPingChecks;     iPingChecks = get_pcvar_num( g_pCvarHPKPingChecks )           static iCheckFrequency;     iCheckFrequency = get_pcvar_num( g_pCvarHPKCheckFrequency )           static iStartDelay;     iStartDelay = get_pcvar_num( g_pCvarHPKStartDelay )           static iImmunity;     iImmunity = get_pcvar_num( g_pCvarHPKImmunity )     if( read_argc( ) < 6)     {         console_print( id, "Usage: amx_hpk <max ping> <total ping checks> <time between checks> <delay before starting checks> <0 for disable | 1 for enable immunity" )         console_print( id, "Current High Ping Kicker Settings:")         console_print( id, "Max Ping: %d | Ping Checks: %d | Check Frequency: %d | Start Delay: %d | Immunity: %d", iMaxPing, iPingChecks, iCheckFrequency, iStartDelay, iImmunity )         return PLUGIN_HANDLED;     }     new uName[ 33 ], uAuthId[ 35 ];     get_user_name( id, uName, charsmax( uName ) );     get_user_authid( id, uAuthId, charsmax( uAuthId ) );     new iArg_MaxPing[ 5 ], iArg_PingChecks[ 5 ], iArg_CheckFrequency[ 5 ], iArg_StartDelay[ 5 ], iArg_Immunity[ 5 ];     read_argv( 1, iArg_MaxPing, charsmax( iArg_MaxPing ) );     read_argv( 2, iArg_PingChecks, charsmax( iArg_PingChecks ) );     read_argv( 3, iArg_CheckFrequency, charsmax( iArg_CheckFrequency ) );     read_argv( 4, iArg_StartDelay, charsmax( iArg_StartDelay ) );     read_argv( 5, iArg_Immunity, charsmax( iArg_Immunity ) );         new iNum_MaxPing = str_to_num( iArg_MaxPing )     new iNum_PingChecks = str_to_num( iArg_PingChecks )     new iNum_CheckFrequency = str_to_num( iArg_CheckFrequency )     new iNum_StartDelay = str_to_num( iArg_StartDelay )     new iNum_Immunity = str_to_num( iArg_Immunity )     if( iNum_CheckFrequency < 5 )         iNum_CheckFrequency = 5           if( iNum_PingChecks < 3 )         iNum_PingChecks = 3     set_pcvar_num( g_pCvarHPKMaxPing, iNum_MaxPing )     set_pcvar_num( g_pCvarHPKPingChecks, iNum_PingChecks )     set_pcvar_num( g_pCvarHPKCheckFrequency, iNum_CheckFrequency )     set_pcvar_num( g_pCvarHPKStartDelay, iNum_StartDelay )     set_pcvar_num( g_pCvarHPKImmunity, iNum_Immunity )     console_print( id, "The following HPK Settings have been set:" )     console_print( id, "Max Ping: %d | Ping Checks: %d | Check Frequency: %d | Start Delay: %d | Immunity: %d", iMaxPing, iPingChecks, iCheckFrequency, iStartDelay, iImmunity )     log_amx( "HPK: ^"%s<%d><%s>^" has configured the HPK - Max Ping: %d | Ping Checks: %d | Check Frequency: %d | Start Delay: %d | Immunity: %d", uName, get_user_userid( id ), uAuthId, iMaxPing, iPingChecks, iCheckFrequency, iStartDelay, iImmunity )     return PLUGIN_HANDLED; } public client_disconnect( id ) {     g_iCheckPlayers[ id ] = 0     remove_task( id ) }       stock ChatColor( id, szInput[ ], any:... ) {     new iCount = 1, uPlayers[ 32 ];     static iMsgId[ 191 ];     vformat( iMsgId, 190, szInput, 3 );     replace_all( iMsgId, 190, "!y", "^1" ); // Default Color     replace_all( iMsgId, 190, "!g", "^4" ); // Green Color     replace_all( iMsgId, 190, "!team", "^3" ); // Team Color           if( id )         uPlayers[ 0 ] = id;     else         get_players( uPlayers, iCount, "ch" );     {         for( new i = 0; i < iCount; i++ )         {             if( is_user_connected( uPlayers[ i ] ) )             {                 message_begin( MSG_ONE_UNRELIABLE, g_iMsgSayText, _, uPlayers[ i ] );                 write_byte( uPlayers[ i ] );                 write_string( iMsgId );                 message_end( );             }         }     } }
__________________
Steam: stickp0le
StickP0le is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:08.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode