👤Ped Helper

What it does

Spawns static NPCs with animation, creates a proximity point, shows hold UI on entry, and calls your callback on completion. Auto‑cleans on exit.

Register :

  • Signature : pedRegister(model, pos, heading, name, anim, interact) -> index

  • Anim : string scenario or {dict, name, flag}

  • Interact : {message, icon?, intent?, holdKey?, holdTime?, interactRange?, holdDistance?, onInteract?}

  • Example :

exports["Var-Interact"]:pedRegister(
    CFG.model,
    CFG.coords,
    CFG.heading,
    nil,
    {dict = CFG.animDict, name = CFG.animName, flag = CFG.animFlag},
    {
        message = CFG.message,
        icon = CFG.icon,
        intent = CFG.intent,
        holdKey = CFG.holdKey,
        holdTime = CFG.holdTime,
        interactRange = CFG.interactRange,
        holdDistance = CFG.holdDistance,
        offsetZ = CFG.offsetZ,
        onInteract = function(i, ped, spec)
            print("Interacted with ped", i, ped, spec)
        end
    }
)
  • Batch init : Ped:InitFromLists(lists) to register from tables in bulk.

Last updated