Tesla vehicle features - v1.2

Hello guys :slight_smile:

I am here to release my Tesla vehicle functions script.
It works in every car and does not use permissions.

Commands (in a vehicle as driver)
  • /tesla mark: Marks your vehicle as your Tesla and creates a blip on the map. This vehicle will be used for commands executed while not being in a vehicle as driver.
  • /tesla pilot: Makes your vehicle drive to your waypoint autonomous. Execute again to cancel.
  • /tesla crash: Enables/disables crash avoidance.
  • /tesla dance: Enables/disables Tesla Dance known from the Tesla Model X for your current vehicle.
  • /tesla lines: Show lines showing where you’re driving when in reverse gear.
Commands (not in a vehicle as driver)
  • /tesla mark: Removes your currently marked vehicle.
  • /tesla pilot: Makes your marked vehicle drive to you autonomous. Execute again to cancel.
  • /tesla crash: Nothing.
  • /tesla dance: Enables/disables Tesla Dance known from the Tesla Model X for your marked vehicle.
Changelog

1.2

  • Improved crash avoidance
  • Added reverse lines

1.1

  • Vehicles can be defined, so these features are not available for all vehicles
  • Auto-Pilot can be stopped by accelerating, braking (including handbrake) or steering to left and/or right

tesla.zip (4.1 KB)

13 Likes

the commands for not being in the car do not work is there something you have to im istting in the passgaer seat comes up unknow

Sounds good however a video/screens of this resources would be nice too :wink:

Good work :+1:

Veri nice :+1:

Is there a way to make it follow the speed limit

can you let it work just for specific tesla’s now it’s for every car

when you /tesla pilot outside the car to get the the car to come to you, makes me crash everytime no matter the car…

Hm. Insta crash after /tesla pilot :smiley: loved the dance tho :smiley:

Are you using any script deleting NPCs?

Would need to change the flag for the AutoPilot, these flags are not that easy to understand… sadly :frowning:

Make sure to mark the car as your Tesla first :wink:

You do not seem to be the only one.
Could you send me a logfile?

i willl have look but i dont think so

CitizenFX_log_2020-05-18T215056.log (248.4 KB)

Here is crash after typing /tesla pilot

1 Like

Hehehe i am not sure if this is like a joke because of tesla crashes in real life, but mine hits almost every thing in it’s way when i do /tesla pilot not sure why :stuck_out_tongue: so i thought it was like a joke

It is not supposed to be a joke :wink:
Sometimes autopilot seems to loose the track, not sure why yet.

It worked well for me while testing tho.

Thanks for your bug-report.

Process crash captured. Crash dialog content:
FiveM has encountered an error
Recursive-recursive error: AircraftFlames Pool Full, Size == 34 (you need to raise AircraftFlames PoolSize in common/data/gameconfig.xml)
Recursive error: AircraftFlames Pool Full, Size == 34 (you need to raise AircraftFlames PoolSize in common/data/gameconfig.xml)
Original error: AircraftFlames Pool Full, Size == 34 (you need to raise AircraftFlames PoolSize in common/data/gameconfig.xml)

This seems a bit weird to me.
Maybe try what it says and increase the AircraftFlames PoolSize?

That would be a good idea for an update :slight_smile:

heres my version of autopilot drives to your current waypoint.

Press Space to emergency brake + regain control at any time

CTRL + shift to toggle normally

your car will act like AI if you dont shutoff autopilot when you hit your waypoint, never fixed this issue…

also you can adjust your speed while in autopilot by pressing W or S

function translatespeed(float)
local speed = float + 11
return speed
end

autopilotenabled = false
Citizen.CreateThread(function()
    while true do
			local waypointBlip = GetFirstBlipInfoId(8) -- 8 = Waypoint ID
			local x,y,z = table.unpack(Citizen.InvokeNative(0xFA7C7F0AADF25D09, waypointBlip, Citizen.ResultAsVector()))
			local px,py,pz = table.unpack(GetEntityCoords(PlayerPedId()))
			local distbetween = Vdist(x,y,z,px,py,pz)
			if IsControlPressed(1,36) then
				if IsControlJustPressed(1,21) then
					if GetEntityModel(GetVehiclePedIsUsing(PlayerPedId())) == -1894894188 or GetEntityModel(GetVehiclePedIsUsing(PlayerPedId())) == -429774847 or GetEntityModel(GetVehiclePedIsUsing(PlayerPedId())) == -1622444098 or GetEntityModel(GetVehiclePedIsUsing(PlayerPedId())) == 884483972 or GetEntityModel(GetVehiclePedIsUsing(PlayerPedId())) == 569305213 or GetEntityModel(GetVehiclePedIsUsing(PlayerPedId())) == -1285460620 or GetEntityModel(GetVehiclePedIsUsing(PlayerPedId())) == -1529242755 or GetEntityModel(GetVehiclePedIsUsing(PlayerPedId())) == -429774847 then
							autopilotenabled = not autopilotenabled
							if autopilotenabled then
								SetNotificationTextEntry("STRING")
								AddTextComponentString("~y~Autopilot ~g~Engaged")
								DrawNotification(false, true)
								if(not IsWaypointActive())then
									SetNotificationTextEntry("STRING")
									AddTextComponentString("~r~ERROR:~w~ No Destination Set.")
									DrawNotification(true, true)
									autopilotenabled = false
									SetNotificationTextEntry("STRING")
									AddTextComponentString("~y~Autopilot ~r~Deactivated")
									DrawNotification(true, true)
									TaskPause(PlayerPedId(), 10)
								else
									defaultspeed = 20.0  --1 = 3 MPH 5 = 11 MPH
									TaskVehicleDriveToCoordLongrange(PlayerPedId(),GetVehiclePedIsUsing(PlayerPedId()), x,y,z, defaultspeed, 262579, 1.0) --262579
								end
							else
								SetNotificationTextEntry("STRING")
								AddTextComponentString("~y~Autopilot ~r~Deactivated")
								DrawNotification(false, true)
								TaskPause(PlayerPedId(), 10)
							end
					else
						SetNotificationTextEntry("STRING")
						AddTextComponentString("This Vehicle is not equipped with ~y~Autopilot~w~!")
						DrawNotification(false, true)
					end
				end			
			end
			
			if autopilotenabled then
				if IsControlJustPressed(0, 71) and GetLastInputMethod( 0 ) then
										defaultspeed = defaultspeed + 1.0
										TaskVehicleDriveToCoordLongrange(PlayerPedId(),GetVehiclePedIsUsing(PlayerPedId()), x,y,z, defaultspeed, 262579, 1.0)
				end
				if IsControlJustPressed(0,72) and GetLastInputMethod( 0 ) then
										defaultspeed = defaultspeed - 1.0
										TaskVehicleDriveToCoordLongrange(PlayerPedId(),GetVehiclePedIsUsing(PlayerPedId()), x,y,z, defaultspeed, 262579, 1.0)
				end				
				if IsControlJustPressed(0,76) and GetLastInputMethod( 0 ) then
										defaultspeed = 0.0
										TaskVehicleDriveToCoordLongrange(PlayerPedId(),GetVehiclePedIsUsing(PlayerPedId()), x,y,z, defaultspeed, 262579, 1.0)
										SetNotificationTextEntry("STRING")
										AddTextComponentString("~y~[Autopilot]~r~ Emergency Stop Engaged")
										DrawNotification(true, true)
										SetNotificationTextEntry("STRING")
										AddTextComponentString("~y~Autopilot ~r~Deactivated")
										DrawNotification(false, true)
										TaskPause(PlayerPedId(), 10)
										autopilotenabled = false
										
				end
			end
        Citizen.Wait(0)
    end
end)

your car will act like AI if you dont shutoff autopilot when you hit your waypoint, never fixed this issue…

I fixed this by checking, if the vehicle is in a radius of ~8m to the waypoint.

image
Got this msg after using /tesla pilot out of the car :’(