Code:
/*
* -----------------------------
* -*- Bandwidth Reducer 0.1 -*-
* -----------------------------
*
* #1. Add these to your server.cfg.
*
* sys_ticrate 33
* sv_minupdaterate 10
* sv_maxupdaterate 10
* sv_minrate 0
* sv_maxrate 0
* sv_voiceenable 0
*
* Note: this settings are meant for Zombie-Mods. For
* normal CS you'll probably want faster response times.
*
* #2. Set one or more of the following to 1 (enabled) to reduce bandwidth.
* Note: Each has its own side effect you should be aware of.
*
* Settting // Side effect when enabled
* -------- // -------------------------*/
#define CD_DONT_SEND_STEPSOUND 0 // Players won't hear their own footstep sounds.
#define CD_DONT_SEND_PUNCHANGLE 0 // Players won't see the actual weapon's recoil if using cl_lw 1.
#define CD_DONT_SEND_NEXTATTACK 0 // Players may see weapons fire when they shouldn't if using cl_lw 1.
#define CD_DONT_SEND_VELOCITY 0 // Players may experience sloppy movements.
#define ES_DONT_SEND_ORIGIN_SELF 1 // None that I can see.
#define ES_DONT_SEND_ANGLES_SELF 0 // If using 3rd person view, players will see themselves looking at an odd direction.
#define ES_DONT_SEND_FRAME_SELF 0 // If using 3rd person view, players will see their own weapon animations incorrectly.
#define ES_DONT_SEND_ANIMTIME_SELF 0 // If using 3rd person view, players will see their own weapon animations incorrectly.
#define ES_DONT_SEND_BLENDING_SELF 1 // None that I can see.
#define ES_DONT_SEND_ANGLES_OTHERS 0 // Players will see others looking at an odd direction
#define ES_DONT_SEND_FRAME_OTHERS 0 // Players will see others' weapon animations incorrectly.
#define ES_DONT_SEND_ANIMTIME_OTHERS 0 // Players will see others skipping around.
#define ES_DONT_SEND_BLENDING_OTHERS 1 // None that I can see.
// #3. You're done. That's the best you'll get out of your connection.
#include <amxmodx>
#include <fakemeta>
public plugin_init()
{
register_plugin("Bandwidth Reducer", "0.1", "MeRcyLeZZ")
register_forward(FM_UpdateClientData, "fw_UpdateClientData", 1)
register_forward(FM_AddToFullPack, "fw_AddToFullPack", 1)
}
public client_putinserver(id) set_task(5.0, "set_cmdrate", id)
public set_cmdrate(id) client_cmd(id, "cl_cmdrate 10")
public fw_UpdateClientData(player, sendweapons, handle)
{
#if CD_DONT_SEND_STEPSOUND
set_cd(handle, CD_flTimeStepSound, 999 )
#endif
#if CD_DONT_SEND_PUNCHANGLE
set_cd(handle, CD_PunchAngle, Float:{ 0.0, 0.0, 0.0 } )
#endif
#if CD_DONT_SEND_NEXTATTACK
set_cd(handle, CD_flNextAttack, 0.0 )
#endif
#if CD_DONT_SEND_VELOCITY
set_cd(handle, CD_Velocity, Float:{ 0.0, 0.0, 0.0 } )
#endif
}
public fw_AddToFullPack(handle, e, ent, host, hostflags, player, pset)
{
if (!player) return;
if (host == ent)
{
#if ES_DONT_SEND_ORIGIN_SELF
set_es(handle, ES_Origin, Float:{ 0.0, 0.0, 0.0 })
#endif
#if ES_DONT_SEND_ANGLES_SELF
set_es(handle, ES_Angles, Float:{ 0.0, 0.0, 0.0 })
#endif
#if ES_DONT_SEND_FRAME_SELF
set_es(handle, ES_Frame, 1.0 )
#endif
#if ES_DONT_SEND_ANIMTIME_SELF
set_es(handle, ES_AnimTime, 1.0 )
#endif
#if ES_DONT_SEND_BLENDING_SELF
set_es(handle, ES_Blending, { 0, 0, 0, 0} )
#endif
}
else
{
#if ES_DONT_SEND_ANGLES_OTHERS
set_es(handle, ES_Angles, Float:{ 0.0, 0.0, 0.0 })
#endif
#if ES_DONT_SEND_FRAME_OTHERS
set_es(handle, ES_Frame, 1.0 )
#endif
#if ES_DONT_SEND_ANIMTIME_OTHERS
set_es(handle, ES_AnimTime, 1.0 )
#endif
#if ES_DONT_SEND_BLENDING_OTHERS
set_es(handle, ES_Blending, { 0, 0, 0, 0} )
#endif
}
}