Skip to content

Commit

Permalink
Implement NPC setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Giana committed Feb 17, 2023
1 parent 4a56f5d commit c0f8853
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions client/main.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
-- Events --

RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
TriggerEvent('g-drugselling:client:spawnNpcs')
end)

RegisterNetEvent('g-drugselling:client:spawnNpcs', function()
for k, v in pairs(Config.SellLocations) do
if v.npc.enabled then
local npc = v.npc
RequestModel(GetHashKey(npc.ped))
while not HasModelLoaded(GetHashKey(npc.ped)) do
Citizen.Wait(100)
end
local sellPed = CreatePed(7, GetHashKey(npc.Ped), v.coords.x, v.coords.y, v.coords.z - 0.97, npc.heading, 0, true, true)
FreezeEntityPosition(sellPed, true)
SetBlockingOfNonTemporaryEvents(sellPed, true)
TaskStartScenarioInPlace(sellPed, npc.scenario, 0, false)
SetEntityInvincible(sellPed, true)
end
end
end)

-- Threads --

-- Blip setup
Expand Down

0 comments on commit c0f8853

Please sign in to comment.