搜索
查看: 3503|回复: 0

[AMXX 带源码] 防止快速下载重连时不再从http绝对路径

[复制链接]
发表于 2015-6-20 11:05:40 | 显示全部楼层 |阅读模式 来自 美国
There is such a bug. If the client while downloading files from sv_downloadurl, will cancel downloading and make a reconnect. He will be downloading that files from server (not sv_downloadurl)

#include < amxmodx >
#include < fakemeta >

new const VERSION[ ] = "0.0.3";

new const SYMBOLS[ ][ ] =
{
        "!" , "@" , "#" ,"$" , "%" , "&",
        "*" , "(" , ")" , "_" , "-" , "=" , "+",
        "{" , "[" , "}" , "]" , ":" , ";" , "'" , "\",
        "|" , "/" , "<" , ">" , "." , "?"               
};

new Trie:g_check;
new Trie:g_reconnect;

new ServerIp[ 32 ]

public plugin_init()
{
        register_plugin( "Fix fast download to reconnect", VERSION, "PomanoB \ Bos93" );

        register_forward( FM_ClientDisconnect, "fw_ClientDisconnect" );

        g_check = TrieCreate();
        g_reconnect = TrieCreate();


        get_user_ip( 0, ServerIp, charsmax( ServerIp ) );
}

public fw_ClientDisconnect( pPlayer )  
{  
        new zsIp[32];

        get_user_ip( pPlayer, zsIp, charsmax( zsIp ) );
        TrieSetCell( g_reconnect, zsIp, 1 );  
}

public client_connect( pPlayer )
{
        new zsIp[32]
        new lastTime
        
        get_user_ip( pPlayer, zsIp, charsmax( zsIp ) );

        if ( TrieKeyExists( g_reconnect , zsIp ) )
        {
                if ( !TrieGetCell( g_check, zsIp, lastTime ) || lastTime < get_systime( ) - 4 )
                {
                        TrieSetCell( g_check, zsIp, get_systime( ) ) ;
                        TrieClear( g_reconnect );  

                        client_cmd( pPlayer, "Connect %s`%c", ServerIp, SYMBOLS[ random_num( 0, sizeof SYMBOLS - 1 ) ] );   
                }
        }
}
游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表