Example
-- Here are 3 examples how to integrate this system with almost anything
-- (3rd example requires you to have drugs creator from jaksam, or use own exports)
--
--
--
--
-- Example of asking gang member for informations
RegisterNetEvent("edev_npc:gangInfo", function()
local ped = GetCurrentPed()
if not ped then return end
local infoLines = {
"Heard something's going down near the old docks...",
"There's a stash hidden behind the Vinewood sign.",
"Someone set up camp deep in the sewer tunnels.",
"Check out the motel near Sandy — shady stuff happening.",
"Word is there's a trader operating out of the quarry at night.",
"Saw smoke near the forest south of Paleto Bay. Something’s up.",
"Some guy’s been dealing out of a taco truck on Grove Street.",
"The rooftops near Legion have eyes, watch yourself.",
"You didn’t hear it from me, but there’s a passage behind Bahama Mamas.",
"The church in the north? Not as abandoned as it looks."
}
local line = infoLines[math.random(#infoLines)]
Config.Notification.Show({
title = "Gang Member",
description = line,
type = "inform"
})
end)
--
--
--
--
-- Example of asking persons how they are
RegisterNetEvent('edev_npc:howAreYou', function()
local ped = GetCurrentPed()
if not ped or IsPedDead(ped) then
Config.Notification.Show({ title = Config.Text["add_title"], description = Config.Text["error_dead"], type = 'error' })
return
end
local emotions = { "happy", "angry", "confused", "sad" }
local selected = emotions[math.random(#emotions)]
playEmotion(ped, selected)
Wait(800)
Config.Notification.Show({
title = Config.Text["add_title"],
description = getRandomResponse("howareyou"),
type = "info"
})
end)
--
--
--
--
-- Sell Drugs example (in this case i use event from jaksams drugs creator)
RegisterNetEvent('edev_npc:selldrugs', function()
local ped = GetCurrentPed()
if not ped or IsPedDead(ped) then
Config.Notification.Show({ title = Config.Text["add_title"], description = Config.Text["error_dead"], type = 'error' })
return
end
-- This is only example (jaksam drugs creator)
TriggerEvent("drugs_creator:sellToNPC", ped)
end)
Last updated