[FREE] Backward Movement Script

Backward Movement Script

PERVIEW

To be honest, I wrote this code just for people who wants their players to move properly on something like a felony stop…

I just wanna be clear, This code was written in 10 minutes for a specific roleplay situation
IT MAY BE UNSTABLE :thinking: NOT SURE … IT’S JUST USEFULL
HAVE FUN :smiley:

To walk backwards you need to Press H (or any other button that you choose) and just start walking with A S D

BackwardMovement.rar (785 Bytes)

EDITED
optimized & beautified :)
client.lua (4.3 KB)

Code is accessible Yes
Subscription-based No
Requirements No
Support No
26 Likes

actually a cool resource! thanks for that :slightly_smiling_face:

Thank you for the awsome work and share ! Really good one !

Yeah, can see that when looking at the code, quick and dirty to say it at least!
But other than that, cool concept!

1 Like

Great work!

Can you optimize it ?

client.lua (2.4 KB)

done:)

1 Like

I play GTA5 since 2014 but i really don’t remember if we can go backward :thinking:

you normally cant, exept when in 1. person

@ShaharAlt seems to have done a good job on the new one, I would maybe have changed some of the syntax a little, but other than that, it seems great.

(I like that you now use key mapping, it was the main thing I wanted to change about it!)

3 Likes

nice!

When cool people working together ! This is da wae ! :yellow_heart:

nice work

From what i’ve tested I will give you a suggestion.

  • Not to be usable while inside a vehicle. ( if you press it by mistake or whatever reason, your car will go nuts into walls ) :smiley:

done:)

1 Like

Try this PS:im not sure if works perfectly

local backwardModifierButton = “ALT”
local backwardModifier = false
local playerPed = nil

local animTable = {
{name = “walk_bwd_180_loop”, button = 33},
{name = “walk_bwd_135_loop”, button = 35},
{name = “walk_bwd_-135_loop”, button = 34},
{name = “walk_bwd_-90_loop”, button = 34},
{name = “walk_fwd_90_loop”, button = 35}
}

RegisterCommand(‘+backwardModifier’, function()
playerPed = PlayerPedId()
if not IsPedInAnyVehicle(playerPed, true) then
backwardModifier = true

    CreateThread(function()
        while backwardModifier do 
            local isSPressed = IsControlPressed(0, 33)
            local isAPressed = IsControlPressed(0, 34)
            local isDPressed = IsControlPressed(0, 35)
            
            for i = 1, #animTable do
                local animData = animTable[i]
                local isButtonPressed = animData.button == 33 and isSPressed or animData.button == 34 and isAPressed or animData.button == 35 and isDPressed
                
                if isButtonPressed then
                    TaskPlayAnim(playerPed, "move_strafe@first_person@generic", animData.name, 5.0, 1.0, -1, 1, 0.1)
                    while backwardModifier and IsControlPressed(0, animData.button) do Wait(0) end
                    ClearPossibleActiveEmotes(playerPed)
                end
            end
            Wait(0)
        end
    end)
end

end, false)

RegisterCommand(‘-backwardModifier’, function()
backwardModifier = false
end, false)

ClearPossibleActiveEmotes = function(playerPed)
StopAnimTask(playerPed, “move_strafe@first_person@generic”, “walk_bwd_135_loop”, 2.0)
StopAnimTask(playerPed, “move_strafe@first_person@generic”, “walk_bwd_-135_loop”, 2.0)
StopAnimTask(playerPed, “move_strafe@first_person@generic”, “walk_bwd_180_loop”, 2.0)
StopAnimTask(playerPed, “move_strafe@first_person@generic”, “walk_bwd_-90_loop”, 2.0)
StopAnimTask(playerPed, “move_strafe@first_person@generic”, “walk_fwd_90_loop”, 2.0)
end

RegisterKeyMapping(‘+backwardModifier’, ‘Walking Backward Modifier’, ‘keyboard’, backwardModifierButton)