populationPedCreating BUG (PED Spawning everywhere)

The Event populationPedCreating Where you can Change Ped Model

For a good bug report you should probably include:

  1. Client (production/canary) and FXServer version

Gamebuild 2060 and 2189, probably same with 1604 too, latest artifact fxserver

  1. What you expected to happen

Peds should Spawn only to local places, local roads, normal walking path.

  1. What actually happens
    Ped Local Spawn to custom maps, local roads, highways,

it do spawn where near the Player Coordinates.

  1. Category of bug (eg. client, server, weapons, peds, native)

PEDS and native?

  1. 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


image

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 :smiley:
Thanks Bubble for this.
also i replaced them now and puted a condition.

No, they should, ever heard of birds? You’re replacing birds with people so of course they spawn ‘everywhere’.

Yeah as you’re replacing birds.

Therefore, not a bug. Check the model before being all eager and replacing birds. ._.

1 Like