[Solved] Respawn with vehicle

I am trying to make it to where you re-spawn inside a vehicle:


AddEventHandler('playerSpawned', function(spawn)
local player = GetPlayerPed(-1)
local vehicle = GetHashKey("sabregt")
local coords = GetOffsetFromEntityInWorldCoords(playerPed, 0, 5.0, 0)
local car = CreateVehicle(vehicle, coords, 0.0, true, false)

        SetPedIntoVehicle(player, car, -1)
end)

I tried that, it didn’t work, also I am not sure if any model name would work for a hash, because I want it for a resource added car…

I guess this is just something that isn’t very well supported?

This:

AddEventHandler('playerSpawned', function(spawn)
local player = GetPlayerPed(-1)
local vehicle = GetHashKey("inter")
local coords = GetOffsetFromEntityInWorldCoords(playerPed, 0, 5.0, 0)

RequestModel(0x5D0B86E5)
while not HasModelLoaded(0x5D0B86E5) do
    Wait(1)
end

local car = CreateVehicle(vehicle, coords, 0.0, true, false)

        SetPedIntoVehicle(player, car, -1)
end)

Will load native vehicles, now, I need ti to load resource added vehicles.

It load custom vehicles too! I used this tool https://www.gta5-mods.com/tools/xtremtoolbox-hash-dehash-get-xyz-coords-of-object and typed in my model name “inter” and got 0x8AFAD0CB I plugged that in and now it works flawlessly.

Special thanks to ^1Scammer

Hello, do you have a finished script to put it on the server? Sorry, I’m a noob in this stuff.