Esc to clear, Enter to open the best match, click an export to open it in its page
Reference
Server Events
Events whip_core fires on the server. Listen with AddEventHandler; every payload is one table, typed in whip_core/types/events.lua.
AddEventHandler('whip_core:item:used', function(e)
print(('Player %d used %s'):format(e.source, e.item))
end)Any server resource can fire them. Before a handler pays out, gives an item or punishes someone, check the sender:
if GetInvokingResource() ~= 'whip_core' then return end. A handler that only logs or updates a screen needs no check.How WHIP names its events#
whip_core:<what>:<what happened>, with one table: function(e) … e.source … e.item … end. Fields can be added later without breaking you. Names containing client: or server: are WHIP's own network messages, not events for you (see Client Events).
Players and characters
| Event | Payload | When |
|---|---|---|
| whip_core:onReady | { reason, resources? } | whip_core is ready for registrations. reason: 'coreStarted' (it remembers nothing: register everything) or 'resourceStarted' with the resources that just started. Also on the client. Use Whip.register instead |
| whip_core:player:loaded | { source, charId, name, newCharacter, player } | Character fully loaded. player is the data sheet, name the full name, newCharacter true on a first load. The client gets the same table |
| whip_core:player:logout | { source, charId, player, why } | The character is leaving: why is 'logout' or 'disconnect' |
| whip_core:player:died | { source, charId, killer, reported } | The server accepted a death. killer: the server id when the server saw a player do it (a car's driver counts), else nil. reported: the victim's game's account, for display only |
| whip_core:player:revived | { source, charId, how, reason } | how: 'revived' or 'respawned'; reason: 'revive', 'respawn', 'revive:admin' or 'revive:self' |
| whip_core:character:created | { source, charId } | New character created |
| whip_core:character:deleted | { source, charId } | Character deleted |
| whip_core:flag:changed | { source, charId, name, value, was } | A character's flag was set, or cleared (value nil) |
| whip_core:permission:changed | { userId, permission, granted } | An account gained or lost a permission |
Items and inventory
| Event | Payload | When |
|---|---|---|
| whip_core:item:added | { source, item, amount, count, reason, by } | A player carries more of an item, by any route (export, pickup, purchase, give, stash drag, cash). amount arrived, count is the new total; reason and by ('by my_resource') when an export did it |
| whip_core:item:removed | { source, item, amount, count, reason, by } | A player carries less: used, dropped, sold, given, stashed, taken by an export |
| whip_core:inventory:changed | { source } | Any change to a player's pockets, including moves between their own slots. Once per change. Not for a quiet SetItemMetadata |
| whip_core:item:used | { source, item, slot, addr } | Item used (hotbar or Use). slot is the slot's data, addr its address |
| whip_core:item:given | { source, target, item, amount } | A player gave an item to another |
| whip_core:heldProps:lost | { source, tag, reason, by? } | Props from your HoldProps (tag '<resource>:<tag>') left the hands without you asking. reason: 'replaced' (by is the new tag) or 'world' (moved to another routing bucket). GetHeldPropsTag(source) returns what's held now: a resource's tag, WHIP's 'emote', 'bar', 'give' or 'take', or nil |
| whip_core:container:opened | { containerId, source, charId } | The server opened a stash on a player's screen (E or OpenStore; not the admin page). Their game may still decline it |
- Pockets only.
item:added/item:removedfire for every change in what a player carries, but not for an item put in a stash, a rearrangement of their own slots, items inside a bag, or logging in. - No per-move event.
inventory:changedsays only that pockets changed: look again withGetInventoryorFindItem. For move detail, use a panel'sonValidate/onChange, or askGetOpenStores(source).
Money
| Event | Payload | When |
|---|---|---|
| whip_core:bank:balanceChanged | { type, accountId, amount, actorCharId, newBalance, message, … } | Any deposit, withdrawal or transfer. A 'transfer' has fromAccountId, toAccountId, fromBalance, toBalance instead of accountId and newBalance |
| whip_core:bank:accountChanged | { accountId, what } | No money moved. what: 'label', 'type', 'owner', 'frozen', 'main', 'closed' or 'access' (Banks page only, not job rank changes) |
Vehicles
The lifecycle (:created, :spawned, :despawned, :released, :deleted, :ownerChanged, :dataChanged) is in Vehicle events.
| Event | Payload | When |
|---|---|---|
| whip_core:vehicle:lockChanged | { vehicleId, plate, locked, source } | Locked or unlocked (fob, lockpick, SetVehicleLocked, admin), only on a real change. source nil when no player did it |
| whip_core:vehicle:lockpicked | { vehicleId, plate, source } | Lockpicked (with vehicle:lockChanged) |
| whip_core:vehicle:entered | { vehicleId, plate, source, seat, previousSeat? } | Got into, or moved to, a seat of a framework vehicle, checked by the server. seat -1 is the driver; previousSeat nil when getting in. Taking the driver's seat puts a strip key into an empty ignition |
| whip_core:vehicle:exited | { vehicleId, plate, source, seat, left } | Left the seat. left: 'logout' or 'dropped', nil for getting out. Getting out unlocks the car and returns a strip key; leaving the game changes neither |
| whip_core:vehicle:registered | { vehicleId, plate, model, session, source } | A vehicle registered in the framework (first time only) |
| whip_core:vehicle:claimed | { vehicleId, from, ownerCharId } | ClaimVehicle made an unowned car someone's: vehicleId the new car, from the old |
| whip_core:vehicle:plateChanged | { vehicleId, from, to } | SetVehiclePlate changed a plate |
World
| Event | Payload | When |
|---|---|---|
| whip_core:door:lockChanged | { doorId, locked, source, cause } | Real change only. cause: 'press', 'lockpick', 'autolock', 'code' or 'released' (a HoldDoor ended); source when a player did it |
| whip_core:door:denied | { doorId, source, reason } | A press was refused. reason is what they were told: don't show it to others |
| whip_core:zone:entered | { zoneId, key?, source } | Entered a zone with trackPlayers = true (checked about once a second) |
| whip_core:zone:exited | { zoneId, key?, source, dropped?, removed? } | Left it. dropped: left the server inside it; removed: the zone was removed |
| whip_core:time:changed | { hour, minute } | Server time set (export or dev tool) |
| whip_core:time:freezeChanged | { frozen } | Time frozen or unfrozen |
| whip_core:weather:changed | { weather } | Server weather changed |
| whip_core:property:ownerChanged | { propertyId, ownerCharId, previousOwnerCharId, by } | Given to someone, or made unowned (nil); every key is taken back. by: the charId who did it |
| whip_core:property:keyGranted | { propertyId, charId, by } | A key was given |
| whip_core:property:keyRevoked | { propertyId, charId } | A key was taken back |
| whip_core:npc:spawned · :despawned · :damaged · :killed | { npcId, tag, owner, … } | An NPC from SpawnNpc (NPCs). Ask GetNpc before paying out |
Shops and jobs
| Event | Payload | When |
|---|---|---|
| whip_core:shop:purchased | { shopId, charId, source, items, total, paymentMethod, mode } | A purchase completed |
| whip_core:shop:opened / :closed | { shopId, source, charId } | A player opened or closed a shop |
| whip_core:shop:created / :updated | { shopId, shop } | Shop created (export or dev tool) or updated |
| whip_core:shop:deleted | { shopId } | Shop deleted |
| whip_core:shop:priceChanged | { containerId, item, slot?, price, forSale } | A stocked shop's item priced or taken off sale; slot when set from a shelf slot |
| whip_core:job:created / updated / deleted | { jobId, key, … } | Made, changed (name, icon, ownerCharId, oldOwnerCharId) or deleted |
| whip_core:job:hired | { jobId, key, charId, source, roleId, role, by } | Hired. source only while online |
| whip_core:job:fired | { jobId, key, charId, source } | Fired (a deleted job fires only job:deleted) |
| whip_core:job:roleChanged | { jobId, key, charId, source, roleId, role, oldRoleId } | Role changed |
| whip_core:job:clockedOn / clockedOff | { jobId, key, charId, source } | On or off duty by any route, logout included; real changes only |
Duty is also a state bag.
Player(source).state.whipJob is the key of the job they're on duty at, or false: a resource that starts late can read it. The client fires clockedOn / clockedOff for the local player.Director
| Event | Payload | When |
|---|---|---|
| whip_core:run:started | { run, startedBy } | A run started (never a builder's Test). run is a DirectorRunView (Director: for other resources) |
| whip_core:run:ended | { run, outcome, reason, vars, payout, faultCard, stopping } | outcome: succeeded, failed, calledOff, aborted or faulted |
| whip_core:run:playerLeft | { run, source, charId, why, by, runEnds } | A player left before the end (logout, disconnect, or a script: by) |
| whip_core:run:playerJoined | { run, source, charId, by } | A script added a player (AddPlayerToScenarioRun) |
| whip_core:run:signalled | { run, name, data, source } | A Send Signal card fired ("alarm") |
| whip_core:scenario:switchedOn / :switchedOff | { scenario, name, rev, replaced | why, by } | A scenario was switched on or off |