Configuration
Everything lives in config.lua (editable in both the open and encrypted version).
Options
| Option | Default | What it does |
|---|---|---|
Config.Command |
'pedspawner' |
The chat command that opens the UI. |
Config.Target |
'auto' |
'auto': register ped actions through vns-core on your running target system. 'none': no target actions. |
Config.Animations |
3 scenarios | The entries shown in the UI's animation dropdown (see below). |
Config.DataFile |
'peds.json' |
File (inside the resource folder) where placed peds are stored. |
Config.PedOptions.freeze |
true |
Freeze spawned peds in place. |
Config.PedOptions.invincible |
true |
Make spawned peds invincible. |
Config.PedOptions.blockevents |
true |
Peds ignore world events (gunshots, collisions) instead of fleeing. |
Config.Permission.enabled |
true |
Restrict the UI and all ped changes to admins and listed identifiers. See Installation. |
Config.Permission.allowedIdentifiers |
2 examples | Player identifiers or framework character identifiers that always have access. |
Config.PedOptions applies to all peds; there is no per-ped override.
Animations
The dropdown in the UI is fed from Config.Animations. Each entry is a GTA scenario played in place:
Config.Animations = {
{label = 'Stand Idle', dict = '', name = 'WORLD_HUMAN_STAND_IMPATIENT'},
{label = 'Smoking', dict = '', name = 'WORLD_HUMAN_SMOKING'},
{label = 'Using Phone', dict = '', name = 'WORLD_HUMAN_STAND_MOBILE'},
}
Add any scenario name (WORLD_HUMAN_*, PROP_HUMAN_*, ...) with a label of your choice. The dict field is unused for scenarios; leave it empty.
Placing a ped
- Run
/pedspawnerand click Add Ped. - Name - a label for your own list; players never see it.
- Ped Model - any GTA ped model name, e.g.
a_m_m_business_01,s_m_y_cop_01. Left empty, it falls back toa_m_m_business_01. - Coordinates - click Use My Position to take your current position and heading, or paste coordinates. The field accepts plain
x, y, z, has well as pastedvector4(...)/vec4(...)strings. - Animation - optionally pick a scenario from the dropdown.
- Save - the ped is written to
peds.jsonand spawns immediately for every player online.
The ped spawns at the given coordinates with 1.0 subtracted from Z, so ground-level player coordinates (from Use My Position) place it correctly on the ground.
Target actions
Each ped can carry any number of target options. Per action:
| Field | What it does |
|---|---|
| Label | The text players see in the target menu. |
| Icon | Font Awesome class (e.g. fa-solid fa-comments); click the field for the icon picker. |
| Event | The event name to trigger, e.g. myshop:open. |
| Type | Client triggers a client event, Server triggers a server event. |
| Jobs | Comma-separated job names allowed to see the option. Passed to your target system as its job filter. |
| Gangs | Saved with the ped, but not used for filtering in this version. |
The interaction distance is 3.0m. The events themselves come from your other resources; the ped spawner only triggers them, always with the same three arguments:
-- Client action
AddEventHandler('myshop:open', function(entity, distance, data)
-- entity: the ped's entity handle
-- distance: distance to the ped, if the target system provides it
-- data: the raw data table from the target system
end)
-- Server action
RegisterNetEvent('myshop:open', function(entity, distance, data)
local src = source
end)
Note
distance is filled in on ox_target. qb-target and qtarget only pass the entity, so there distance is nil and data is { entity = entity }. Don't rely on distance if you run one of those.
Warning
For server actions, entity is the client's local entity handle, which means nothing on the server. Use source to identify the player and do your own checks.
Editing and removing peds
The main list shows every saved ped with buttons to Edit (reopens the same form), Delete (with a confirmation prompt) and Teleport (moves you to the ped). Every save immediately rewrites peds.json and respawns the peds for all players; no restart needed.
Persistence - peds.json
All placed peds are stored as JSON in Config.DataFile (default peds.json) inside the resource folder, and are respawned on resource start and for every joining player. You can edit the file by hand while the resource is stopped, copy it between servers, and you should keep it (and back it up) when updating the script. Deleting it removes every placed ped.
Open files
| File | Function | Purpose |
|---|---|---|
client/client_open.lua |
RegisterPedTarget(entity, actions) |
Builds the target options and triggers the action events |
client/client_open.lua |
RemovePedTarget(entity) |
Removes the options before a ped is despawned |
client/client_open.lua |
OnPedSpawnerDenied() |
Runs when a player without access uses the command (prints to F8 by default) |
server/server_open.lua |
HasPedSpawnerPermission(src) |
The permission check for opening the UI and saving peds |