搜索
查看: 3231|回复: 4

[AMXX 带源码] KKLV在国外发布的插件-貌似是假人攻击类的

[复制链接]
发表于 2013-6-4 23:38:58 | 显示全部楼层 |阅读模式 来自 中国–上海–上海–浦东新区
  1. #include <amxmodx>
  2. #include <fakemeta>

  3. #define PLUGIN_NAME "Connnection Protection"
  4. #define PLUGIN_VERSION  "0.1"

  5. #define fClearTrieTime      12.4
  6. #define iConnectionBanCount  6

  7. new Trie:ghTrie;

  8. public plugin_init( )
  9. {
  10.     register_plugin( PLUGIN_NAME , PLUGIN_VERSION , "LittleKu-Lv" );
  11.    
  12.     register_cvar( "amx_cfp_version" , PLUGIN_VERSION , FCVAR_SPONLY | FCVAR_SERVER );
  13.    
  14.     register_forward( FM_ClientConnect , "fwClientConnectPost" , true );
  15.    
  16.     ghTrie = TrieCreate();
  17. }

  18. public fwClientConnectPost( id , const szName[] , const szAddress[] , const szRejectReason[ 128 ] )
  19. {
  20.     if ( pev( id , pev_flags ) & FL_FAKECLIENT )
  21.     {
  22.         return FMRES_IGNORED;
  23.     }
  24.    
  25.     if ( szAddress[ 0 ] == 0 )
  26.     {
  27.         return FMRES_IGNORED;
  28.     }
  29.    
  30.     static iConnectionCount;
  31.     static params[ 32 ];
  32.    
  33.     if ( !TrieGetCell( ghTrie , szAddress , iConnectionCount ) )
  34.     {
  35.         copy( params , 31 , szAddress );
  36.         set_task( fClearTrieTime , "ClearValueFromTrie" , 0 , params , 32 );
  37.         
  38.         TrieSetCell( ghTrie , szAddress, 0 );
  39.         return FMRES_IGNORED;
  40.     }
  41.    
  42.     if ( iConnectionCount == iConnectionBanCount )
  43.     {
  44.         static iUserId;
  45.         iUserId = get_user_userid( id );
  46.         server_cmd( "kick #%d;addip 0 %s;writeip" , iUserId , szAddress );
  47.         return FMRES_IGNORED;
  48.     }
  49.    
  50.     TrieSetCell( ghTrie , szAddress , ( iConnectionCount + 1 ) );
  51.     return FMRES_IGNORED;
  52. }

  53. public ClearValueFromTrie( params[] )
  54. {
  55.     static szAddress[ 32 ];
  56.    
  57.     copy( szAddress, 31, params );
  58.    
  59.     TrieDeleteKey( ghTrie , szAddress );
  60.    
  61.     return PLUGIN_CONTINUE;
  62. }

  63. public plugin_end()
  64. {
  65.     TrieClear( ghTrie );
  66. }
复制代码
温馨提示:返回后,您可点击恢复数据,恢复您刚刚编辑的内容!
发表于 2013-8-4 22:31:37 | 显示全部楼层 来自 中国–山东–淄博
游泳没有啊 ,请指教啊
回复

使用道具 举报

发表于 2015-4-5 17:15:57 | 显示全部楼层 来自 中国–山东–威海
啊晕轻轻去去去去去去去去去{:4_124:}
回复

使用道具 举报

发表于 2015-4-12 18:25:40 | 显示全部楼层 来自 中国–广东–中山
0.0.0.0.00.0.0.0.0.0
回复

使用道具 举报

发表于 2015-4-12 18:29:48 | 显示全部楼层 来自 中国–广东–中山

啊晕轻轻去去去去去去去去去
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

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