PNJ spawn script


#1

Hi,

Is it possible to spawn a ped (pnj) ?

Is it a client or server side script ?

I can do it in lua or C# or other :slight_smile:

Thanks a lot.


#2

Maybe using some scripts from Freeroam/Stripclub ?

 local bartenders = {
    {type=5, hash=0x780c01bd, x=128.900, y=-1283.211, z=29.273, a=123.98},
  }

function LocalPed()
  return GetPlayerPed(-1)
end

Citizen.CreateThread(function()
  -- Load the ped modal (s_f_y_bartender_01)
  RequestModel(GetHashKey("s_f_y_bartender_01"))
  while not HasModelLoaded(GetHashKey("s_f_y_bartender_01")) do
    Wait(1)
  end

 -- Spawn the bartender to the coordinates
    bartender =  CreatePed(5, 0x780c01bd, 128.900, -1283.21, 29.273, 123.98, false, true)
    SetBlockingOfNonTemporaryEvents(bartender, true)
    SetPedCombatAttributes(bartender, 46, true)
    SetPedFleeAttributes(bartender, 0, 0)
    SetPedRelationshipGroupHash(bartender, GetHashKey("CIVFEMALE"))


If it works, tell us :slight_smile:


#3

Yep, it works fine ty.

In fact i was working on while waiting an answer and just :
SetBlockingOfNonTemporaryEvents
SetBlockingOfNonTemporaryEvents
SetPedFleeAttributes

were missing for me.

Thanks a lot.