As far as I can tell, the server side script doesn’t know what "CreatePed(…)’ is, so clientside is the only way I can figure out to spawn them.
Also, I’m creating a thread that loops that manages the ped’s AI that governs what the ped does, but again, a lot of the native functions I’m using to help with the AI don’t work on the server script. When I go offline, the peds’ AI breaks and won’t work even if I go back online.
Any tips on creating/managing peds on the server script? Thanks!
RegisterNetEvent("spawnped")
AddEventHandler("spawnped", function()
--Your code where you spawn a ped
end)
Server.lua
RegisterCommand("spawnped", function(source, args, raw)
TriggerClientEvent("spawnped", -1)
--The "-1" makes it so it does it on everyones client not only yours
end)
Altough, if im wanting to spawn a ped from server to client at the same coords with a TriggerClientEvent('spawnped', -1) this would make multiple peds right?
Is there an way to still get everyone the same event where it spawn the ped, but let it still spawn one ped for the hole server…