Registering with WHIP
Items, stats, secure events, callbacks, actions, zones, store kinds: everything a resource registers with WHIP follows one rule, so running your registration twice is always safe.
| You register | What happens |
|---|---|
| Something new | It's yours. Returns true |
| The same thing again | Nothing: no reset, no re-broadcast |
| A changed version of your own | It replaces yours |
| Something another resource registered | Refused: false, 'item "x" belongs to other_resource', also printed once in the console (F8 on a client) and listed in the setup report |
A name starting whip_core: | Refused: those are WHIP's own |
When your resource stops, what it registered is removed. Items are the exception, since players still carry them, but they stop being yours and another resource may take the name.
Prefix names with your resource's name#
Item keys, right-click action names, stats, vehicle stats, server zone ids and permissions share one list per server, and the first resource to register a name owns it. Start each with your resource's name and an underscore: mycafe_coffee, mycafe_stress. Events and callbacks use a colon: mycafe:buy. An unprefixed name still works, but the console lists it once:
[whip_core] mycafe registers 3 items whose names do not start with "mycafe" (coffee, bagel, tea). ...phone, sim_card, rope, radio, megaphone, nitro, whip_gunny's weapons, magazines and ammo (weapon_pistol and the like), and every item in whip_core's config.lua; vehicle stats nitro, boost and fuel. /whip → Economy → Items shows each key's owner.Listing registrations, and run tags#
GetRegistrations shows who holds a name that was refused. Run tags let a mission or heist clean up everything it made in one call: pass { tag = 'run:42' } in a registration's options (on modules that support it), then ReleaseTag.
Everything registered with WHIP on this side (events, callbacks, items, stats, actions, stat listeners, client hooks, settings, /w pages, debug tools, held props), or one resource's share.
| Param | Type | Description |
|---|---|---|
| resource | string? | Only this resource's registrations; everything when omitted |
table[]: { { registry, key, owner }, … }for _, r in ipairs(exports.whip_core:GetRegistrations(GetCurrentResourceName())) do
print(r.registry, r.key)
end
Removes everything your resource registered under a run tag, in every WHIP module, and closes the tag: later registrations under it are refused with "… has ended". Use a new tag for each run; releasing one never touches another run or another resource's things.
| Param | Type | Description |
|---|---|---|
| tag | string | Your run's label, e.g. 'run:42' (up to 100 characters) |
true, count (how many things were removed), or false, why for an empty or over-long taglocal tag = 'heist:' .. jobId
exports.whip_core:SpawnNpc({ model = 's_m_m_security_01', coords = guardPos, behaviour = 'guard' }, { tag = tag })
exports.whip_core:SpawnTempVehicle('stockade', vanPos, { tag = tag })
-- The job is over: the guard and the van go
local ok, count = exports.whip_core:ReleaseTag(tag)
What your resource holds under a run tag, across WHIP's modules.
| Param | Type | Description |
|---|---|---|
| tag | string | Your run's label |
table[]: { { registry, key }, … }; empty for an unknown or bad tag