Skip to content

update getPedControlState calls to include localPlayer #598

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions [editor]/freecam/freecam.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion [gamemodes]/[race]/[addons]/race_ghost/record_client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion [gamemodes]/[race]/[addons]/race_nos/c_main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions [gamemodes]/[stealth]/stealth/noisebar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -217,18 +217,18 @@ 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
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
Expand Down