From 516c44df154bad94f05504af7713a51e04dc74ae Mon Sep 17 00:00:00 2001 From: Reguas <64607261+Reguas@users.noreply.github.com> Date: Thu, 21 Sep 2023 16:17:33 +0300 Subject: [PATCH] Fixed movement speed effects for different players --- ChaosMod/Effects/db/Player/PlayerMovementSpeed.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ChaosMod/Effects/db/Player/PlayerMovementSpeed.cpp b/ChaosMod/Effects/db/Player/PlayerMovementSpeed.cpp index 5078d96a3..cbfc2c5d5 100644 --- a/ChaosMod/Effects/db/Player/PlayerMovementSpeed.cpp +++ b/ChaosMod/Effects/db/Player/PlayerMovementSpeed.cpp @@ -1,9 +1,13 @@ #include +static void Override(float value) +{ + SET_PED_MOVE_RATE_OVERRIDE(PLAYER_PED_ID(), value); +} + static void OnTickx5() { - static Ped plr = PLAYER_PED_ID(); - SET_PED_MOVE_RATE_OVERRIDE(plr, 5.f); + Override(5.f); } // clang-format off @@ -19,8 +23,7 @@ REGISTER_EFFECT(nullptr, nullptr, OnTickx5, EffectInfo static void OnTickx10() { - static Ped plr = PLAYER_PED_ID(); - SET_PED_MOVE_RATE_OVERRIDE(plr, 5.f); + Override(10.f); } // clang-format off @@ -36,8 +39,7 @@ REGISTER_EFFECT(nullptr, nullptr, OnTickx10, EffectInfo static void OnTickx05() { - static Ped plr = PLAYER_PED_ID(); - SET_PED_MOVE_RATE_OVERRIDE(plr, 0.5f); + Override(0.5f); } // clang-format off