The Event populationPedCreating Where you can Change Ped Model
For a good bug report you should probably include:
- Client (production/canary) and FXServer version
Gamebuild 2060 and 2189, probably same with 1604 too, latest artifact fxserver
- What you expected to happen
Peds should Spawn only to local places, local roads, normal walking path.
- What actually happens
Ped Local Spawn to custom maps, local roads, highways,
it do spawn where near the Player Coordinates.
- Category of bug (eg. client, server, weapons, peds, native)
PEDS and native?
- Reproducible steps, preferably with example script(s)
Short Summary: i think peds should not spawn everywhere, only spawned in designated location? like walking paths, city, not in custom maps,highways etc…
function requestmodel(model)
RequestModel(model)
while not HasModelLoaded(model) do
Citizen.Wait(1)
RequestModel(model)
end
end
local loaded = false
Citizen.CreateThread(function()
requestmodel('s_f_y_stripper_01')
requestmodel('s_f_y_stripper_02')
loaded = true
while true do
SetParkedVehicleDensityMultiplierThisFrame(0.5)
SetVehicleDensityMultiplierThisFrame(0.5)
SetRandomVehicleDensityMultiplierThisFrame(0.5)
Wait(0)
end
end)
AddEventHandler('populationPedCreating', function(x, y, z, model, setters)
local ped = {
's_f_y_stripper_01',
's_f_y_stripper_02'
}
setters.setModel(ped[math.random(0,1)]) -- you can use a hash as well
unusedBool, spawnZ = GetGroundZAndNormalFor_3dCoord(x, y, 9999.0, 1)
setters.setPosition(x, y, spawnZ)
-- you can also CancelEvent() to skip creating the ped
end)
Screens
also i am using this GetGroundZAndNormalFor_3dCoord to get the Z coords
because the default Z spawns maybe + 10.0 Z coords (it spawned very high z)
also note that even without the coords setter
setters.setPosition(x, y, spawnZ)
it still spawn in high ways
OH SHIT ITS LITTERALY A BIRDS a CROW
Thanks Bubble for this.
also i replaced them now and puted a condition.