Hello I’m new to fivem modding my question is if I spawn a ped on the server side [OneSync] using CreatePed will it automatically sync to all clients or do I need to do additional stuff?
if currentPedCount < MIN_PEDS_AROUND_PLAYER then
local pedCountToSpawn = math.min(MAX_PEDS_TO_SPAWN - currentPedCount, MIN_PEDS_AROUND_PLAYER - currentPedCount)
for i = 1, pedCountToSpawn do
local offsetX = getRandomOffset(50, 75)
local offsetY = getRandomOffset(50, 75)
local finalPlayerCoords = vector3(playerCoords.x + offsetX, playerCoords.y + offsetY, playerCoords.z)
local pedModel = GetRandomPedModel()
local ped = CreatePed(1, pedModel, finalPlayerCoords.x, finalPlayerCoords.y, finalPlayerCoords.z, 0.0, true, false)
while not DoesEntityExist(ped) do
Wait(1)
end
end
end
It spawns additional ped around the player and it works. but I do not have another computer to test if it is syncing. Will get my friend to test it with me this weekend.
In the meantime can anyone confirm if you spawn create a ped server side it will sync?
Or do I have to do additional things to make it sync with other players.
My goal is just to mostly spawn a bunch of npcs around the players and make sure they sync. And if my friend shoot or do something with them will they sync also on my end?