AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Rates Plugin for CS (https://forums.alliedmods.net/showthread.php?t=5752)

QuakerOates 09-11-2004 17:01

Rates Plugin for CS
 
1 Attachment(s)
Need help on this one.
Could some1 customize the plugin for me so i can force the rates i want ppl conecting to the server to us.

thx

Code:

/* AMX Mod script.
*
* © Copyright 2002, OLO
* This file is provided as is (no warranties).
*
*/

/*
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.16","H3inBlo3d")
  register_cvar("amx_ctrlupdaterate","8")
  register_cvar("amx_maxupdaterate","95")
  register_cvar("amx_minupdaterate","45")
  return PLUGIN_CONTINUE
}


FeuerSturm 09-11-2004 19:05

http://forums.alliedmods.net/showthr...?p=51227#53981

QuakerOates 09-12-2004 04:34

wondefull :D
and even better its for .20 as well =]]


All times are GMT -4. The time now is 17:26.

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