I made a simple script that spawns peds around you. It seems like peds never get desynced when playing on flat surface as the airport. However, when I play on a bumpy surface like San Fierro, many peds get desynced. It seems like desynced peds always spawn on the sideways, I never seen a desynced pedestrian on the street. This probably means that they end up on sideways by falling under the ground. I don't know how it is possible since I use getGroundPosition. I know many scripts like the most popular script in the community (zombies script) somehow avoid desynced zombies. Does anyone know how I can do that in my script?
Server:
addEvent("makeped", true)
function makeped (x, y, z)
if math.random(1,2) == 1 then
x = x + math.random(15,40)
else
x = x + math.random(-40,-15)
end
if math.random(1,2) == 1 then
y = y + math.random(15,40)
else
y = y + math.random(-40,-15)
end
local ped = createPed (290, x, y, z+5, 0)
setElementSyncer(ped, client)
end
addEventHandler("makeped", root, makeped)
Client:
function haha()
local x, y, z = getElementPosition(localPlayer)
triggerServerEvent("makeped", resourceRoot, x, y, getGroundPosition(x, y, z))
end
setTimer(haha,math.random(2000,5000),0)