Player & Status (Client)
Client exports about the local player: their sheet, stats and effects, body state, emotes and voice. For the server side, see Player.
The local player
Whether whip_core's client has loaded (not a character: that's IsPlayerLoaded). Whip.register already waits for it.
booleanWhether a character is loaded and ready.
boolA copy of the local player's sheet: cash and metadata follow the server, and isDead, health and armour are read live. position is where they loaded; use GetEntityCoords(PlayerPedId()) for now.
{ source, userId, charId, firstName, lastName, fullName, dateOfBirth, gender, cash, position, health, armour, isDead, metadata }, or {} before a character loadsThe local player's character id.
number|nilFor tools and tests: enters a character with nobody at the game, arriving where they left. Waits up to 90 s for the load.
| opts | Type | Description |
|---|---|---|
| charId | number? | The character, by id |
| slot | number? | Or its card's place on the character screen; default the first card |
ok, why (false, 'already in a character')Another player's character name, asked of the server under Config.ShowPlayerNames: 'nearby' (default: within Config.PlayerNameRange metres, same instance), 'always' or 'never'.
| Param | Type | Description |
|---|---|---|
| serverId | number | Their server id (ctx.player.serverId when aiming at them) |
| wait | boolean? | true waits for the server. Without it the first ask returns nil and fetches: right for a label drawn every frame |
string|nil: nil while fetching, when too far or names are 'never', or for nobody at that idStats and effects
Stats are read-only on the client: change them on the server with SetStat and AddStat.
One stat from the local cache: any stat registered with RegisterStat.
| Param | Type | Description |
|---|---|---|
| name | string | e.g. 'hunger' |
number|nil: nil if never setA copy of every stat the client knows.
{ [name] = number }hunger and thirst start at 100 and cost health at 10 or below, so AddStat(source, 'hunger', 25) feeds the player.Runs a function whenever a stat changes, instead of polling. The server has the same export, for every player.
| Param | Type | Description |
|---|---|---|
| name | string | The stat, or '*' for all |
| callback | function | (newValue, oldValue), or (name, newValue, oldValue) for '*' |
| id | any? | Only to hold two listeners on one stat (or the options) |
| opts | table? | table = true: one table { key, value, old } · now = true: also called at once (old = nil) |
boolean ok, string|nil errexports.whip_core:OnStatChanged('hunger', function(new, old)
if new <= 20 and (old or 100) > 20 then exports.whip_core:Notify('You are starving.', 'error') end
end)
Whether a named effect is active on the local player.
| Param | Type | Description |
|---|---|---|
| name | string | Effect name |
booleanA copy of every active effect, as the server's GetEffects.
{ [name] = { duration, remaining, magnitude, tickRate, damageModifier, meleeModifier, resource } }Body, walk and emotes
Whether the player can't work with their hands: under water (or in a sunken car), swimming, or falling, with the words to show. Progress bars check this with notWhile.
'underwater', 'swimming' or 'falling' and the words, or falseOverrides the player's walk (a drunk stagger, a limp). The newest override wins; when the last clears, the player's own /walk returns. Cleared when your resource stops.
| Param | Type | Description |
|---|---|---|
| clipset | string|nil | A movement clipset ('MOVE_M@DRUNK@VERYDRUNK'); nil gives the walk back |
truePlays an emote and its props by /e name (see shared/emote_list.lua), under WHIP's cancel (X) and cleanup. Use it for anything held, like a phone, instead of your own TaskPlayAnim.
| Param | Type | Description |
|---|---|---|
| cmd | string | e.g. 'drink' or 'phone' |
true, or false, why (no such emote, dead, in a vehicle, a bar running, a weapon out …)Stops the current emote and puts its props away. Check IsEmoting() == 'phone' (or yours) first, so you only end your own.
boolean: whether there was oneThe current emote's /e name, so you can tell yours from the player's.
string|falseVoice
The voice range the player cycles with Z (whip_cyclevoice). It's client-owned; a voice resource reads it here and listens for whip_core:voice:rangeChanged.
20, 50 or 100 · 'Whisper', 'Normal' or 'Shout'For a voice resource: lights the HUD's voice gauge while push-to-talk is held, blue, or orange with a radio icon when mode is 'radio'. It goes out if your resource stops.