防止快速下载重连时不再从http绝对路径
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;
get_user_ip( pPlayer, zsIp, charsmax( zsIp ) );
TrieSetCell( g_reconnect, zsIp, 1 );
}
public client_connect( pPlayer )
{
new zsIp
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 ) ] );
}
}
}
页:
[1]