Anyone know how to create/manage peds on the server-side?


#1

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!


#2

If you do this:
Client.lua

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)

It should work. :slight_smile: