搜索
查看: 2363|回复: 0

【转帖】服务器带宽控制(for amxx 1.0)

[复制链接]
发表于 2005-8-2 23:42:20 | 显示全部楼层 |阅读模式 来自 中国–广东–深圳–罗湖区
small[php] /*
*  Plugin By: OLO
*
* This file is provided as is (no warranties).
* Ported by VanillA Ice
*I take no credit in the making of this plugin...all i did was port it..
*
*/

/*
Controls sv_maxupdaterate (be wise with usage or you will get

pings worse).

cvars:
amx_ctrlupdaterate <value> - when players is more than that value

then
                                                            server starts to lowering

sv_udpdaterate                          
amx_maxupdaterate <value> -     this is what you want maximum

sv_updaterate to be
amx_minupdaterate <value> -     this is what you want minimum

sv_updaterate to be
*/

#include <amxmodx>

new low = 0
new udl = 0
new bool:calculate = true

public client_putinserver(id)
{
    if (calculate)
    {
        calculate = false
         
        new maxupd = get_cvar_num("amx_maxupdaterate")
        new minupd = get_cvar_num("amx_minupdaterate")
              
        new divv = get_maxplayers() - get_cvar_num

("amx_ctrlupdaterate")
              
        if (divv < 1)
            divv = 1
         
        low = (maxupd - minupd) / divv
        udl = maxupd
         
        set_cvar_num("sv_maxupdaterate",udl)
        /*server_print("sv_maxupdaterate set to %d",udl)*/
    }
      
    if ( get_playersnum() > get_cvar_num("amx_ctrlupdaterate") )
    {
        udl -= low
        set_cvar_num("sv_maxupdaterate",udl)
        /*server_print("sv_maxupdaterate set to %d",udl)*/
    }
         
    return PLUGIN_CONTINUE
}

public client_disconnect(id)
{
    /* get_playersnum still includes this id */
    if ( get_playersnum() >= get_cvar_num("amx_ctrlupdaterate") )
    {
        udl += low
        set_cvar_num("sv_maxupdaterate",udl)
        /*server_print("sv_maxupdaterate set to %d",udl)*/
    }
      
    return PLUGIN_CONTINUE
}

public plugin_init()
{
    register_plugin("Bandwidth Control","0.8.7","VanillA Ice")
    register_cvar("amx_ctrlupdaterate","8")
    register_cvar("amx_maxupdaterate","60")
    register_cvar("amx_minupdaterate","45")
    return PLUGIN_CONTINUE
}
[/php]
downloadurlbandwithcontrolamxxx.amxx
downloadurl
bandwithcontrol.sma

downloadurl
bandwithcontrol.amxx

and you want see them

If you have these set in your server.cfg will it not kick or get rid of what the max is that you set?


Code:


  1. //minrate
  2. sv_minrate 0

  3. //maxrate
  4. sv_maxrate 6000

  5. //maxupdaterate
  6. sv_maxupdaterate 20
复制代码


上面所说的是如何控制服务器连接带宽。
原文是:Plugin - Bandwith Control

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

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