mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-16 21:46:03 +01:00
Add function to makeDistPed that runs after creation
Kept forgetting to do this When using `makeDistPed()` (making a npc that only appears when nearby) you can now send a function to apply custom modifiers to it after the npc is created eg. ```lua makeDistPed(v.model[i], b, true, false, v.scenario, nil, nil, function(ped) if v["killable"] then SetEntityInvincible(ped, false) SetBlockingOfNonTemporaryEvents(ped, false) FreezeEntityPosition(ped, false) end end) ```
This commit is contained in:
@@ -18,7 +18,7 @@ local Peds = {}
|
||||
-- ```lua
|
||||
-- makeDistPed(pedData, pedCoords, true, false, 'WORLD_HUMAN_STAND_IMPATIENT', nil, true)
|
||||
-- ```
|
||||
function makeDistPed(data, coords, freeze, collision, scenario, anim, synced)
|
||||
function makeDistPed(data, coords, freeze, collision, scenario, anim, synced, func)
|
||||
local zoneCoords = type(data) == "table" and data.coords or coords
|
||||
local randName = keyGen()..keyGen()
|
||||
createCirclePoly({
|
||||
@@ -27,6 +27,7 @@ function makeDistPed(data, coords, freeze, collision, scenario, anim, synced)
|
||||
radius = 50.0,
|
||||
onEnter = function()
|
||||
Peds[randName] = makePed(data, coords, freeze, collision, scenario, anim, synced)
|
||||
if func then func(Peds[randName]) end
|
||||
end,
|
||||
onExit = function()
|
||||
DeletePed(Peds[randName])
|
||||
|
||||
Reference in New Issue
Block a user