From 306ac39c7b1bb9731463bfc7139b406a6c54e671 Mon Sep 17 00:00:00 2001 From: Xenius97 Date: Thu, 30 Jan 2025 09:46:09 +0100 Subject: [PATCH] refactor: update getPedControlState calls to include localPlayer --- [editor]/freecam/freecam.lua | 4 ++-- [gamemodes]/[race]/[addons]/race_ghost/record_client.lua | 2 +- [gamemodes]/[race]/[addons]/race_nos/c_main.lua | 2 +- [gamemodes]/[stealth]/stealth/noisebar.lua | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/[editor]/freecam/freecam.lua b/[editor]/freecam/freecam.lua index 5864f231d..11efb168f 100644 --- a/[editor]/freecam/freecam.lua +++ b/[editor]/freecam/freecam.lua @@ -57,7 +57,7 @@ function getKeyState(key) return mta_getKeyState(controlToKey[key]) else -- We can use getControlState - return getPedControlState(key) + return getPedControlState(localPlayer, key) end end @@ -96,7 +96,7 @@ local function freecamFrame () speed = speed + acceleration speedKeyPressed = true end - if ( getKeyState ( options.key_backward ) or getPedControlState ( options.key_backward_veh ) ) and not getKeyState("arrow_d") then + if ( getKeyState ( options.key_backward ) or getPedControlState ( localPlayer, options.key_backward_veh ) ) and not getKeyState("arrow_d") then speed = speed - acceleration speedKeyPressed = true end diff --git a/[gamemodes]/[race]/[addons]/race_ghost/record_client.lua b/[gamemodes]/[race]/[addons]/race_ghost/record_client.lua index 57c322ac9..74decfbe4 100644 --- a/[gamemodes]/[race]/[addons]/race_ghost/record_client.lua +++ b/[gamemodes]/[race]/[addons]/race_ghost/record_client.lua @@ -173,7 +173,7 @@ end function GhostRecord:checkStateChanges() -- Keys for _, v in ipairs( keyNames ) do - local state = getPedControlState( v ) + local state = getPedControlState( localPlayer, v ) if not state and analogNames[v] then -- Not a really good implementation, but didn't think if anything else state = getAnalogControlState( v ) >= 0.5 diff --git a/[gamemodes]/[race]/[addons]/race_nos/c_main.lua b/[gamemodes]/[race]/[addons]/race_nos/c_main.lua index 86864d8ca..49ea18532 100644 --- a/[gamemodes]/[race]/[addons]/race_nos/c_main.lua +++ b/[gamemodes]/[race]/[addons]/race_nos/c_main.lua @@ -94,7 +94,7 @@ addEventHandler( "onClientRender", root, dxDrawImage( g_tGaugePosition[ 1 ] + 45, g_tGaugePosition[ 2 ] + 41, 10, 40, "gauge/nos_arrow.png", nosangle, 0, -11, tocolor( 255, 0, 0 ) ); local nitro = getVehicleUpgradeOnSlot( veh, 8 ); - if ( getPedControlState( "vehicle_fire" ) and type( nitro ) == "number" and nitro ~= 0 ) then + if ( getPedControlState( localPlayer, "vehicle_fire" ) and type( nitro ) == "number" and nitro ~= 0 ) then if nos > 0 then nos = nos - .2; if getTickCount() - clicktick > 20000 then diff --git a/[gamemodes]/[stealth]/stealth/noisebar.lua b/[gamemodes]/[stealth]/stealth/noisebar.lua index da401bd64..020f7179a 100644 --- a/[gamemodes]/[stealth]/stealth/noisebar.lua +++ b/[gamemodes]/[stealth]/stealth/noisebar.lua @@ -217,10 +217,10 @@ addCommandHandler ( "crippleme", startalimp ) function movementcheck ( source, key, keystate ) if ( isPedDucked ( getLocalPlayer () ) ) == false then - if ( getPedControlState ( "sprint" ) ) then + if ( getPedControlState ( localPlayer, "sprint" ) ) then soundlevel = soundlevel +1 end - if ( getPedControlState ( "walk" ) ) == false then + if ( getPedControlState ( localPlayer, "walk" ) ) == false then soundlevel = soundlevel +1 end end @@ -228,7 +228,7 @@ end function walksoundstop ( source, key, keystate ) if isplayermoving == 1 then - if ( getPedControlState ( "forwards" ) ) == false and ( getPedControlState ( "backwards" ) ) == false and ( getPedControlState ( "left" ) ) == false and ( getPedControlState ( "right" ) ) == false then + if ( getPedControlState ( localPlayer, "forwards" ) ) == false and ( getPedControlState ( localPlayer, "backwards" ) ) == false and ( getPedControlState ( localPlayer, "left" ) ) == false and ( getPedControlState ( localPlayer, "right" ) ) == false then killTimer ( movementsound ) isplayermoving = 0 end