Fixes plugins fighting over the "m_flLaggedMovementValue" netprop value.
Multiple plugins can now use this plugin to set the speed value, whilst considering other plugins that may also be setting the speed on the same client.
Server owners have the option to combine the player speed set by plugins, or average the speed set by plugins.
Requires plugins that set the "m_flLaggedMovementValue" netprop value to add support for this plugin. See the Weapons Movement Speed plugin for example.
Suggest viewing "Weapons Movement Speed" plugin for an implementation example on making this plugin optional.
Highly suggest searching for "Fix movement speed bug when jumping or staggering" in "Weapons Movement Speed" and adding this section to fix issues when jumping and speed value is set.
PHP Code:
/**
* @brief Given the requested value, returns the required value to set considering all plugins wanting to set the m_flLaggedMovementValue value.
* @remarks The last plugin requesting this value in the same frame will be the one writing the value.
* @remarks Typically plugins set the m_flLaggedMovementValue in a PreThinkPost function.
*
* @notes Highly suggest viewing "Weapons Movement Speed" plugin by "Silvers" and adding the "Fix movement speed bug when jumping or staggering" code
* @notes from that plugin to your plugins PreThinkPost function before setting the m_flLaggedMovementValue value. This fixes bugs with the m_flLaggedMovementValue
* @Notes causing player to jump faster or slower when the value is changed from 1.0.
*
* @Notes View the "Weapons Movement Speed" plugin source to make this plugin optionally used if detected.
* @Notes Example code usage: SetEntPropFloat(client, Prop_Send, "m_flLaggedMovementValue", L4D_LaggedMovement(client, 2.0));
*
* @param client Client index of the person we're changing the speed value on
* @param value The speed we want to set on this player
* @param forced If forcing the value it will override all other plugins setting the value
*
* @return The speed value we need to set
*/
native float L4D_LaggedMovement(int client, float value, bool forced = false);
CVars:
Saved to l4d_lagged_movement.cfg in your servers \cfg\sourcemod\ folder.
PHP Code:
// When plugins compete to set a players speed value should the final value be: 1=Average of both. 2=Combined value added from both.
l4d_lagged_movement_type "1"
// Lagged Movement - Plugin Conflict Resolver plugin version.
l4d_lagged_movement_version
Changes:
Code:
1.0 (12-Nov-2022)
- Initial release.
Installation:
Click "Get Plugin" and put the .smx file into your servers \addons\sourcemod\plugins\ folder.