Hey, does anybody know why this script isn’t working?
The ped is spawning properly but the car isn’t… and in another script of mine the car spawning code is also working properly… I have no clue why this isn’t working… Is anybody able to help me with this?
Greetings
RegisterCommand("crusader", function(source, args, rawCommand)
createNPC("a_m_m_hasjew_01", -630.54, -2350.82, 13.95, 136.14)
SpawnShopVehicle("crusader", -617.87, -2316.05, 13.4, 320.0)
end, false)
function SpawnShopVehicle(model, x, y, z, h)
LoadModel(model)
local vehPos = CreateVehicle(model, x, y, z - 0.975, h, false)
FreezeEntityPosition(vehPos, true)
SetEntityInvincible(vehPos, true)
SetVehicleColours(vehPos, 121, 121)
SetVehicleExtraColours(vehPos, 121, 121)
SetVehicleDirtLevel(vehPos, 0)
SetEntityAsMissionEntity(vehPos, true, true)
SetModelAsNoLongerNeeded(model)
end
function createNPC(model, x, y, z, h)
modelHash = GetHashKey(model)
RequestModel(modelHash)
while not HasModelLoaded(modelHash) do
Wait(1)
end
created_ped = CreatePed(0, model, x, y, z - 0.975, h, true)
FreezeEntityPosition(created_ped, true)
SetEntityInvincible(created_ped, true)
SetBlockingOfNonTemporaryEvents(created_ped, true)
TaskStartScenarioInPlace(created_ped, "WORLD_HUMAN_COP_IDLES", 0, true)
end