AutoPilot | standalone | free release

another Free release … this one is autopilot to waypoint

this can be used in car or on foot … simply do /autopilot to start or /stopautopilot to stop

watch the video here

Download here
Bucko_autopilot.zip (2.0 KB)

Join the discord for help or suggestion on my next release

7 Likes

Little bit of a learning curve to use it, but once you get your head around it, its a great fun script and you can use it to record video of your vehicle if you need to.

Nice release, thanks :slight_smile:

2 Likes

thanks dude :slight_smile:

1 Like

good job bro

1 Like

little sneek peak on something iv made … just not yet posted (still needs some work)

https://youtu.be/j8OilQPYm5Y?si=Gwy2Mlv3uyU4zZWz :rofl:

1 Like

Have you found that it goes rogue once in a while?

I have noticed it will follow the road and adjust for traffic speed, traffic and even stop at lights, but occasionally, on a long bend, it wants to take a direct route across the paddock rather than follow the road.

Despite that, its a fun script and the other ppl in server have fun with it, its making us lazy drivers :joy:

1 Like

would you mid if i compare from your and add some utilization of this within something im working on?

feel free dude… only thing i ask is if you use my code …you can release it but make it free of charge

of course, i should have be done by tonight would you like me to ping it to you?

na if you release it just @ me in your post :slight_smile:

1 Like

How to make it to trigger Auto Pilot while pressing certain key?

Modified for qb-radialmenu

Replace the start and stop autopilot functions in client.lua with

AddEventHandler('Bucko_autopilot:client:StartAutoPilot', function()
		print("autopilot fired")
    if isAutopilotActive then
        TriggerEvent('chat:addMessage', { args = { "^3Autopilot", "Already active!" } })
        return
    end

    local playerPed = PlayerPedId()
    blip = GetFirstBlipInfoId(8)

    if not DoesBlipExist(blip) then
        TriggerEvent('chat:addMessage', { args = { "^1Error", "Set a waypoint first." } })
        return
    end

    local dest = GetBlipInfoIdCoord(blip)
    isAutopilotActive = true

    if IsPedInAnyVehicle(playerPed, false) then
        if not BuckoConfig.EnableDrivingAutopilot then
            TriggerEvent('chat:addMessage', { args = { "^1Autopilot", "Driving autopilot is disabled on this server." } })
            isAutopilotActive = false
            return
        end

        local vehicle = GetVehiclePedIsIn(playerPed, false)
        TaskVehicleDriveToCoordLongrange(playerPed, vehicle, dest.x, dest.y, dest.z, 30.0, 786603, 10.0)
        TriggerEvent('chat:addMessage', { args = { "^2Autopilot", "Driving to waypoint..." } })
        DriveToWaypoint(playerPed, vehicle, dest)

    else
        if not BuckoConfig.EnableWalkingAutopilot then
            TriggerEvent('chat:addMessage', { args = { "^1Autopilot", "Walking autopilot is disabled on this server." } })
            isAutopilotActive = false
            return
        end

        TriggerEvent('chat:addMessage', { args = { "^2Autopilot", "Walking to waypoint..." } })
        WalkToWaypointSafely(playerPed, dest)
    end
end)

AddEventHandler('Bucko_autopilot:client:StopAutoPilot', function()
    print("autopilot fired")
		local playerPed = PlayerPedId()
    if IsPedInAnyVehicle(playerPed, false) then
        local vehicle = GetVehiclePedIsIn(playerPed, false)
        ClearPedTasks(playerPed)
        SetVehicleHandbrake(vehicle, false)
        SetDriveTaskCruiseSpeed(playerPed, 0.0)
        SetEntityVelocity(vehicle, 0.0, 0.0, 0.0)
        Wait(100)
    else
        ClearPedTasks(playerPed)
    end

    isAutopilotActive = false
    blip = nil

    TriggerEvent('chat:addMessage', { args = { "^3Autopilot", "Autopilot deactivated. You now have full control." } })
end)

in your qb-radialmenu config add a new menu item with the following:

{
            id = 'autopilot',
            title = 'Autopilot(Car/Foot)',
            icon = 'plane',
            items = {
										{
                    id = 'startap',
                    title = 'Start Autopilot',
                    icon = 'plane',
                    type = 'client',
                    event = 'Bucko_autopilot:client:StartAutoPilot',
                    shouldClose = true
                    }, {
										id = 'stopap',
                    title = 'Stop Autopilot',
                    icon = 'plane',
                    type = 'client',
                    event = 'Bucko_autopilot:client:StopAutoPilot',
                    shouldClose = true
        }
				}
    },