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

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

IsReady()CLIENT#

Whether whip_core's client has loaded (not a character: that's IsPlayerLoaded). Whip.register already waits for it.

Returns: boolean
IsPlayerLoaded()CLIENT#

Whether a character is loaded and ready.

Returns: bool
GetPlayer()CLIENT#

A 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.

Returns: { source, userId, charId, firstName, lastName, fullName, dateOfBirth, gender, cash, position, health, armour, isDead, metadata }, or {} before a character loads
GetCharId()CLIENT#

The local player's character id.

Returns: number|nil
IsPlayerDead()CLIENT#

Whether the local player is in the death state (Death).

Returns: boolean
EnterCharacter(opts?)CLIENTWAITS#

For tools and tests: enters a character with nobody at the game, arriving where they left. Waits up to 90 s for the load.

optsTypeDescription
charIdnumber?The character, by id
slotnumber?Or its card's place on the character screen; default the first card
Returns: ok, why (false, 'already in a character')
GetPlayerFullName(serverId, wait?)CLIENTWAITS#

Another player's character name, asked of the server under Config.ShowPlayerNames: 'nearby' (default: within Config.PlayerNameRange metres, same instance), 'always' or 'never'.

ParamTypeDescription
serverIdnumberTheir server id (ctx.player.serverId when aiming at them)
waitboolean?true waits for the server. Without it the first ask returns nil and fetches: right for a label drawn every frame
Returns: string|nil: nil while fetching, when too far or names are 'never', or for nobody at that id

Stats and effects

Stats are read-only on the client: change them on the server with SetStat and AddStat.

GetStat(name)CLIENT#

One stat from the local cache: any stat registered with RegisterStat.

ParamTypeDescription
namestringe.g. 'hunger'
Returns: number|nil: nil if never set
GetStats()CLIENT#

A copy of every stat the client knows.

Returns: { [name] = number }
Needs count down. hunger and thirst start at 100 and cost health at 10 or below, so AddStat(source, 'hunger', 25) feeds the player.
OnStatChanged(name, callback, id?, opts?)CLIENT#

Runs a function whenever a stat changes, instead of polling. The server has the same export, for every player.

ParamTypeDescription
namestringThe stat, or '*' for all
callbackfunction(newValue, oldValue), or (name, newValue, oldValue) for '*'
idany?Only to hold two listeners on one stat (or the options)
optstable?table = true: one table { key, value, old } · now = true: also called at once (old = nil)
Returns: boolean ok, string|nil err
exports.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)
HasEffect(name)CLIENT#

Whether a named effect is active on the local player.

ParamTypeDescription
namestringEffect name
Returns: boolean
GetEffects()CLIENT#

A copy of every active effect, as the server's GetEffects.

Returns: { [name] = { duration, remaining, magnitude, tickRate, damageModifier, meleeModifier, resource } }

Body, walk and emotes

GetBodyState()CLIENT#

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.

Returns: 'underwater', 'swimming' or 'falling' and the words, or false
SetWalkOverride(clipset)CLIENT#

Overrides 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.

ParamTypeDescription
clipsetstring|nilA movement clipset ('MOVE_M@DRUNK@VERYDRUNK'); nil gives the walk back
Returns: true
PlayEmote(cmd)CLIENT#

Plays 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.

ParamTypeDescription
cmdstringe.g. 'drink' or 'phone'
Returns: true, or false, why (no such emote, dead, in a vehicle, a bar running, a weapon out …)
CancelEmote()CLIENT#

Stops the current emote and puts its props away. Check IsEmoting() == 'phone' (or yours) first, so you only end your own.

Returns: boolean: whether there was one
IsEmoting()CLIENT#

The current emote's /e name, so you can tell yours from the player's.

Returns: string|false

Voice

GetVoiceLevel() / GetVoiceName()CLIENT#

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.

Returns: 20, 50 or 100 · 'Whisper', 'Normal' or 'Shout'
SetVoiceTalking(talking, mode?)CLIENT#

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.

Returns: nothing