-- local playerPed = GetPlayerPed(-1)
-- local coords = GetEntityCoords(playerPed)
-- local Px, Py, Pz = table.unpack(coords)
ESX.Game.SpawnVehicle(model, { x = 0, y = 0, z = 0 }, 180, function (vehicle)
I’ve had a few and Christmas is pretty close, here you go.
local playerPed = PlayerPedId()
local playerCoords = GetEntityCoords(playerPed)
local playerHeading = GetEntityHeading(playerPed)
-- this is a comment, this will not be executed.
-- If you want it to spawn ahead of the player, get the forward vector and use those coords :^)
ESX.Game.SpawnVehicle(model, { x = playerCoords.x, y = playerCoords.y, z = playerCoords.z }, playerHeading , function (vehicle)
-- ... (Half snippet, half answer ;) )
man thanks could you help me again pls set the vehicle owned doesnt work so it doesnt add to my garage
RegisterNetEvent(‘lootbox:RewardVehicle’)
AddEventHandler(‘lootbox:RewardVehicle’, function(model)
local playerPed = PlayerPedId()
local playerCoords = GetEntityCoords(playerPed)
local playerHeading = GetEntityHeading(playerPed)
ESX.Game.SpawnVehicle(model, { x = playerCoords.x, y = playerCoords.y, z = playerCoords.z }, playerHeading , function (vehicle)
TaskWarpPedIntoVehicle(playerPed, vehicle, -1)
local newPlate = GeneratePlate()
local vehicleProps = ESX.Game.GetVehicleProperties(vehicle)
vehicleProps.plate = newPlate
SetVehicleNumberPlateText(vehicle, newPlate)
TriggerServerEvent('esx_vehicleshop:setVehicleOwned', vehicleProps)
Hey buddy, no. This is borderline doing the work for you. Hit up other ESX server owners or find a community where they can assist you, this is not meant for this forum.