From 5039f5a4f333afb0dcaa68085c64031eae5bca0c Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Sun, 4 Sep 2022 15:49:41 -0500 Subject: [PATCH] Use player control func --- scripts/client/utilities.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/scripts/client/utilities.js b/scripts/client/utilities.js index 05000645..551a25d8 100644 --- a/scripts/client/utilities.js +++ b/scripts/client/utilities.js @@ -18,9 +18,10 @@ function setLocalPlayerFrozenState(state) { function setLocalPlayerControlState(controlState, cursorState = false) { logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting control state to ${controlState} (Cursor: ${cursorState})`); controlsEnabled = controlState; + game.setPlayerControl(controlState); if (getGame() == AGRP_GAME_GTA_III || getGame() == AGRP_GAME_GTA_VC) { game.SET_PLAYER_CONTROL(game.GET_PLAYER_ID(), boolToInt(controlState)); - } else if (getGame() != AGRP_GAME_GTA_IV) { + } else if (getGame() <= AGRP_GAME_GTA_IV) { setElementCollisionsEnabled(localPlayer, controlState); setPedInvincible(localPlayer, true); } @@ -55,14 +56,6 @@ function restoreLocalCamera() { // =========================================================================== -function clearLocalPlayerOwnedPeds() { - logToConsole(LOG_DEBUG, `[VRR.Utilities] Clearing all self-owned peds ...`); - clearSelfOwnedPeds(); - logToConsole(LOG_DEBUG, `[VRR.Utilities] All self-owned peds cleared`); -}; - -// =========================================================================== - function setLocalCameraLookAt(cameraPosition, cameraLookAt) { logToConsole(LOG_DEBUG, `[VRR.Utilities] Set camera to look at [${cameraLookAt.x}, ${cameraLookAt.y}, ${cameraLookAt.z}] from [${cameraPosition.x}, ${cameraPosition.y}, ${cameraPosition.z}]`); if (isCustomCameraSupported()) { @@ -72,6 +65,14 @@ function setLocalCameraLookAt(cameraPosition, cameraLookAt) { // =========================================================================== +function clearLocalPlayerOwnedPeds() { + logToConsole(LOG_DEBUG, `[VRR.Utilities] Clearing all self-owned peds ...`); + clearSelfOwnedPeds(); + logToConsole(LOG_DEBUG, `[VRR.Utilities] All self-owned peds cleared`); +}; + +// =========================================================================== + function setCityAmbienceState(state, clearElements = false) { logToConsole(LOG_DEBUG, `[VRR.Utilities] Ambient civilians and traffic ${(state) ? "enabled" : "disabled"}`); game.setTrafficEnabled(state);