Esc to clear, Enter to open the best match, click an export to open it in its page
Players

Character Lifecycle

A player connects, picks a character, plays, and logs out or leaves. Here's what your resource can rely on at each step, how WHIP saves, and the events it fires.

Connecting and loading

Joining needs a FiveM licence; banned players (by any identifier) are told the reason and when the ban ends. Everyone else gets an account (userId) and picks, makes or deletes a character, up to Config.MaxCharacters (4).

whip_core then loads the character, moves them to routing bucket 0, spawns the ped and syncs the world around them. The server's whip_core:player:loaded fires last: your "player ready" hook. The client's fires once the ped is in the world and the screen is back.

It isn't resent when your resource restarts, so also set up everyone already in from Whip.register (make setUp safe to run twice):

AddEventHandler('whip_core:player:loaded', function(e) setUp(e.source, e.player) end)

Whip.register(function()
    for source, player in pairs(exports.whip_core:GetPlayers()) do setUp(source, player) end
end)

Save system#

Changes take effect at once in memory and reach the database within about a second (Config.FlushInterval, 1000 ms). You write no saving code.

WhatWhen it's written
Pockets, stashes, boots, health and armour, activity logWithin Config.FlushInterval, or when the action ends; both halves of a move together
Position, hunger, thirst, your saved statsEvery Config.PlayerPositionSaveInterval (30 s), if changed
Car stats (fuel, nitro…) and positionEvery Config.VehicleStatsSaveInterval (15 s), or with the action
Car data, the bank, ground itemsImmediately, with the running action's other saves
Logout and disconnectAt once; the next login waits for anything still owed
restart whip_coreEvery owed write is sent as it stops
txAdmin restart or shutdownOn txAdmin's warning, most important first. Set its Shutdown Notice Delay to 15 seconds

A failed write isn't a failed action. The change stands and WHIP retries forever; after five failures it shows as stuck in /whipsaves, and that character can't load until it lands. If the database goes away, items lock until everything owed is written (BACK TO NORMAL in the console).

Health and armour aren't proof. They're what the player's game last reported, as on QBCore and ESX; only a report of 0 health is checked. To sell armour, give it with SetStat after payment and keep your own record. Hunger, thirst and your stats are the server's alone.

Logging out and leaving

Logout (back to the character screen) and disconnect both save the character and any stash or boot they had open, close their panels (yours gets onClose if they were its last viewer), clock them off, end any escort, and fire whip_core:player:logout with why = 'logout' or 'disconnect'.

New characters

A new character starts with full needs, the other stats at their starting values, and Config.StartingBalance ($1000) in the bank, and loads into the appearance creator. Only that first load has e.newCharacter (and e.player.isNewCharacter) set, even if the creator reopens later: the hook for a starter car.

A new character isn't a new player. Deleting one frees a slot for another, so a sellable gift can be farmed. Tie it to e.player.userId, or make it something that can't leave the character.

Deleting a character

Only from the character screen. Nothing the character held is thrown away:

WhatAfter the delete
Homes they ownedFor sale again with every key gone; furniture and stored items stay
Keys they heldRemoved
JobsLeft. A business they owned runs on unowned; reassign it in /whip → Economy → Jobs
Stashes locked to themContents stay; owner and lock are cleared
Cars and bank accountsUnchanged; an admin can reassign them

Clean up your own per-character data on whip_core:character:deleted, but any server resource can fire it, so first check if not exports.whip_core:IsCharacterDeleted(e.charId) then return end.

Events

Server eventWhenPayload
whip_core:player:loadedCharacter loaded and ready (same table on the client){ source, charId, name, newCharacter, player }
whip_core:player:logoutLogout or disconnect, after the save{ source, charId, player, why }
whip_core:character:createdNew character created{ source, charId }
whip_core:character:deletedCharacter deleted{ source, charId }
whip_core:character:renamedAn admin renamed a character (source nil if offline){ charId, source, firstName, lastName, name, oldName, by }

The renamed player's game gets whip_core:player:renamed with { charId, firstName, lastName, name }.