Citizen.CreateThread(function()
RequestModel(npcHash)
while not HasModelLoaded(npcHash) do
Wait(500)
end
npcPed = CreatePed(4, npcHash, npcCoords.x, npcCoords.y, npcCoords.z - 1.0, npcHeading, false, true)
FreezeEntityPosition(npcPed, true)
SetEntityInvincible(npcPed, true)
SetBlockingOfNonTemporaryEvents(npcPed, true)
while true do
Citizen.Wait(0)
local playerPed = PlayerPedId()
local playerCoords = GetEntityCoords(playerPed)
local npcCoords = GetEntityCoords(npcPed)
local distance = GetDistanceBetweenCoords(playerCoords, npcCoords, true)
if distance < 2 and IsControlJustPressed(0, 38) then
local vehicleModel = GetHashKey("12charger")
local vehicle = CreateVehicle(vehicleModel, -149.93916320801,156.19316101074,76.93675994873, GetEntityHeading(PlayerPedId()), true, false)
SetEntityVisible(vehicle, true, false)
SetEntityCollision(vehicle, false, false)
NetworkSetEntityInvisibleToNetwork(vehicle, true)
TriggerServerEvent('oxi:showroom:getData')
end
end
end)
This is what i have.