LocalPlayer
constLocalPlayer:object
Defined in: client/api.d.ts:1053
The player this client controls, as it was captured this frame. Read-only: the server’s Player changes it. Other players are not reachable on the client, which holds one only while it streams in.
Type Declaration
Section titled “Type Declaration”dropItem()
Section titled “dropItem()”dropItem(
form,count?):boolean
Drops items the player carries into the world in front of them, as the Pip-Boy’s drop does. In a session the server’s itemDrop follows and may refuse it, which takes the item back.
Parameters
Section titled “Parameters”string | number
The base object.
count?
Section titled “count?”number
How many; 1 when left out.
Returns
Section titled “Returns”boolean
False when they carry fewer, or the game dropped nothing.
fastTravel()
Section titled “fastTravel()”fastTravel(
destination):boolean
Asks to fast travel to a reference, as picking it on the Pip-Boy map does: the server’s playerFastTravel decides, and the player travels when no script refuses.
Parameters
Section titled “Parameters”destination
Section titled “destination”string | number
The reference to arrive at: a map marker, or any other placed reference.
Returns
Section titled “Returns”boolean
True when asked; false when the reference is not here or the player does not stand in the world.
getAimPitch()
Section titled “getAimPitch()”getAimPitch():
number|null
Aim pitch, in radians.
Returns
Section titled “Returns”number | null
Null outside a session or before the player stands in the world.
getBaseValue()
Section titled “getBaseValue()”getBaseValue(
value):number|null
An actor value’s base on the player.
Parameters
Section titled “Parameters”string | number
The ActorValueInfo form ID, such as 0x2D4 for Health.
Returns
Section titled “Returns”number | null
Null for a form ID that is no actor value, or before the player stands in the world.
getBodyPoints()
Section titled “getBodyPoints()”getBodyPoints(): {
eyeLevel:number;lookAt:Vector3;parts:Vector3[];standingEyeHeight:number; } |null
Where the game places the points of the player’s body, in world units: the height of the eyes above the feet in the current pose and the standing height the game keeps for the player, the point others look at, and the four points the game keeps on the body, from the eyes down.
Returns
Section titled “Returns”{ eyeLevel: number; lookAt: Vector3; parts: Vector3[]; standingEyeHeight: number; } | null
Null while the player is not in the world.
getCritMeter()
Section titled “getCritMeter()”getCritMeter(): {
charge:number;max:number;stored:number; } |null
The player’s critical meter as the game holds it: the charge towards the next stored critical, how many are stored and how many can be.
Returns
Section titled “Returns”{ charge: number; max: number; stored: number; } | null
Null before the player exists.
getFurnitureState()
Section titled “getFurnitureState()”getFurnitureState():
"none"|"sitting"|"sleeping"|"moving"
Whether the player is in a piece of furniture: seated, lying asleep, or on their way in or out of one.
Returns
Section titled “Returns”"none" | "sitting" | "sleeping" | "moving"
getHeading()
Section titled “getHeading()”getHeading():
number|null
Facing, in radians around Z.
Returns
Section titled “Returns”number | null
Null outside a session or before the player stands in the world.
getHolotape()
Section titled “getHolotape()”getHolotape(): {
form:number;playing:boolean; } |null
The holotape in the player’s Pip-Boy and whether it runs now; null for none.
Returns
Section titled “Returns”{ form: number; playing: boolean; } | null
getInventory()
Section titled “getInventory()”getInventory():
InventoryItem[]
What the player carries, counted from their game.
Returns
Section titled “Returns”One entry per base object, condition and mods; empty before the player stands in the world.
getItemCount()
Section titled “getItemCount()”getItemCount(
form):number
How many of an item the player carries.
Parameters
Section titled “Parameters”string | number
The base object.
Returns
Section titled “Returns”number
The count; 0 when they carry none.
getLevel()
Section titled “getLevel()”getLevel():
number
The player’s level.
Returns
Section titled “Returns”number
0 before the player stands in the world.
getLocation()
Section titled “getLocation()”getLocation():
number|null
The named location the player is in, a BGSLocation form ID, as ObjectReference.GetCurrentLocation reads it.
Returns
Section titled “Returns”number | null
Null in the open, where the game names no location.
getMapWaypoint()
Section titled “getMapWaypoint()”getMapWaypoint(): {
x:number;y:number;z:number; } |null
Where the player’s own map marker is: the waypoint dropped on the Pip-Boy map.
Returns
Section titled “Returns”{ x: number; y: number; z: number; } | null
Null while there is none.
getMovement()
Section titled “getMovement()”getMovement():
PlayerMovement|null
What the player’s body is doing: stance, weapon, Pip-Boy.
Returns
Section titled “Returns”PlayerMovement | null
Null outside a session or before the player stands in the world.
getOutfit()
Section titled “getOutfit()”getOutfit():
OutfitPiece[]
What the player wears.
Returns
Section titled “Returns”One entry per armor piece; empty outside a session.
getPerkPoints()
Section titled “getPerkPoints()”getPerkPoints():
number
Perk points the player has to spend.
Returns
Section titled “Returns”number
0 before the player stands in the world.
getPosition()
Section titled “getPosition()”getPosition(): {
x:number;y:number;z:number; } |null
Where the player stands, in world units of their space.
Returns
Section titled “Returns”{ x: number; y: number; z: number; } | null
Null outside a session or before the player stands in the world.
getPowerArmor()
Section titled “getPowerArmor()”getPowerArmor():
PlayerPowerArmor|null
The power armor frame the player wears.
Returns
Section titled “Returns”PlayerPowerArmor | null
Null when they wear none, and outside a session.
getSpace()
Section titled “getSpace()”getSpace():
PlayerSpace|null
The worldspace or interior cell the player is in.
Returns
Section titled “Returns”PlayerSpace | null
Null outside a session or before the player stands in the world.
getTimeUnderwater()
Section titled “getTimeUnderwater()”getTimeUnderwater():
number
The seconds the player has been under water (isUnderwater) without coming up; 0 above it. Fallout 4 has no drowning of its own: this is what a script builds one on.
Returns
Section titled “Returns”number
getValue()
Section titled “getValue()”getValue(
value):number|null
An actor value’s current value on the player.
Parameters
Section titled “Parameters”string | number
The ActorValueInfo form ID, such as 0x2D4 for Health.
Returns
Section titled “Returns”number | null
Null for a form ID that is no actor value, or before the player stands in the world.
getVelocity()
Section titled “getVelocity()”getVelocity(): {
x:number;y:number;z:number; } |null
How fast the player moves, in world units per second.
Returns
Section titled “Returns”{ x: number; y: number; z: number; } | null
Null outside a session or before the player stands in the world.
getVitals()
Section titled “getVitals()”getVitals():
PlayerVitals|null
Health and armor, as captured at most a tenth of a second ago.
Returns
Section titled “Returns”PlayerVitals | null
Null outside a session or before the player stands in the world.
getWeapon()
Section titled “getWeapon()”getWeapon():
PlayerWeapon|null
The weapon in the player’s hands.
Returns
Section titled “Returns”PlayerWeapon | null
Null for empty hands, and outside a session.
getXp()
Section titled “getXp()”getXp():
number
The player’s XP.
Returns
Section titled “Returns”number
0 before the player stands in the world.
hasPerk()
Section titled “hasPerk()”hasPerk(
perk):boolean
Whether the player holds a perk rank.
Parameters
Section titled “Parameters”string | number
The rank’s BGSPerk form ID.
Returns
Section titled “Returns”boolean
isBleedingOut()
Section titled “isBleedingOut()”isBleedingOut():
boolean
Whether the player is in the game’s bleedout.
Returns
Section titled “Returns”boolean
isCollisionEnabled()
Section titled “isCollisionEnabled()”isCollisionEnabled():
boolean
Whether the player has their collision: false after setCollision(false) or the console’s tcl.
Returns
Section titled “Returns”boolean
isDead()
Section titled “isDead()”isDead():
boolean
Whether the player is down.
Returns
Section titled “Returns”boolean
False outside a session.
isInvulnerable()
Section titled “isInvulnerable()”isInvulnerable():
boolean
Whether the game holds the player invulnerable: setInvulnerable, or the game’s own god mode.
Returns
Section titled “Returns”boolean
False before the player exists.
isJetpackFiring()
Section titled “isJetpackFiring()”isJetpackFiring():
boolean
Whether the jetpack of the player’s power armor thrusts. The thrust drains the fusion core; the fJetpack* settings tune it.
Returns
Section titled “Returns”boolean
isKnockedDown()
Section titled “isKnockedDown()”isKnockedDown():
boolean
Whether the player is knocked down: in their ragdoll or getting up from it, by a script or by the game, a blast for one.
Returns
Section titled “Returns”boolean
isPipboyLightOn()
Section titled “isPipboyLightOn()”isPipboyLightOn():
boolean
Whether the player’s Pip-Boy light is on.
Returns
Section titled “Returns”boolean
False before the player exists.
isPipboyVisible()
Section titled “isPipboyVisible()”isPipboyVisible():
boolean
Whether the Pip-Boy shows on the player’s wrist: false after setPipboyVisible(false).
Returns
Section titled “Returns”boolean
isRestrained()
Section titled “isRestrained()”isRestrained():
boolean
Whether the player is held in place by setRestrained.
Returns
Section titled “Returns”boolean
isSwimming()
Section titled “isSwimming()”isSwimming():
boolean
Whether the player swims: in water deep enough that the game took them off their feet.
Returns
Section titled “Returns”boolean
isUnderwater()
Section titled “isUnderwater()”isUnderwater():
boolean
Whether the water reaches above the player’s neck, as the game’s IsUnderWater condition answers (the fNeckUnderwaterThreshold setting). A swimmer’s body often keeps it so at the surface too.
Returns
Section titled “Returns”boolean
knockDown()
Section titled “knockDown()”knockDown(
force?,from?):boolean
Knocks the player off their feet into their ragdoll, as ObjectReference.PushActorAway does: they fall, lie a moment and get up by themselves. Every other player sees them fall and get up.
Parameters
Section titled “Parameters”force?
Section titled “force?”number
How hard they are thrown, as ObjectReference.PushActorAway takes it; 0, the default, drops them where they stand.
The point they are thrown away from; their own position by default.
number
number
number
Returns
Section titled “Returns”boolean
False before the player stands in the world, while they are dead, down already, bleeding out, held in place or in furniture.
leaveFurniture()
Section titled “leaveFurniture()”leaveFurniture():
boolean
Has the player get up from the furniture they are in, or stop making for it.
Returns
Section titled “Returns”boolean
False when they are in none.
playHolotape()
Section titled “playHolotape()”playHolotape(
holotape):boolean
Plays a holotape recording in the player’s Pip-Boy, in place of the one in it, without the loading animation: the radio goes quiet while it runs, as when the player loads one. Seen and heard in this game alone.
Parameters
Section titled “Parameters”holotape
Section titled “holotape”string | number
The holotape’s form ID. It need not be carried.
Returns
Section titled “Returns”boolean
False when the form is no holotape, holds no recording (a game or a terminal tape), or would not start.
setAlpha()
Section titled “setAlpha()”setAlpha(
alpha,fade?):boolean
Draws the player’s body more or less see-through in this game, as Actor.SetAlpha does. Other players’ games are not told.
Parameters
Section titled “Parameters”number
0, invisible, to 1, opaque.
boolean
Fade there rather than cut (default false).
Returns
Section titled “Returns”boolean
False before the player stands in the world.
setBleedingOut()
Section titled “setBleedingOut()”setBleedingOut(
bleedingOut):boolean
Puts the player into the game’s bleedout, or gets them out of it: down on the ground and alive, the camera pulled out, the controls held, as a downed companion is. Every other player sees them down. Nothing kills them there, as nothing kills a downed companion; they stay until a script gets them up or the session ends, and get up at full health.
Parameters
Section titled “Parameters”bleedingOut
Section titled “bleedingOut”boolean
True to go down, false to get back up.
Returns
Section titled “Returns”boolean
False before the player stands in the world, while they are dead or held in place.
setClipAmmo()
Section titled “setClipAmmo()”setClipAmmo(
rounds):boolean
Loads rounds into the weapon in the player’s hands, as FiveM’s SetAmmoInClip does a ped’s. The rounds come from those the player carries, as a reload takes them: never more than they have; the server’s player.giveItem gives more.
Parameters
Section titled “Parameters”rounds
Section titled “rounds”number
The rounds to load, 0 to 100000; more than the weapon’s clip loads a full clip.
Returns
Section titled “Returns”boolean
False without a weapon that loads ammo in hand.
setCollision()
Section titled “setCollision()”setCollision(
enabled):void
Takes the player’s collision away or gives it back, as FiveM’s SetEntityCollision does a ped and the console’s tcl the player: without it they move along where they look, through walls and floors, without gravity. An admin’s noclip on foot. It comes back when the session ends.
Parameters
Section titled “Parameters”enabled
Section titled “enabled”boolean
False to take the player’s collision away, true to give it back.
Returns
Section titled “Returns”void
setInvulnerable()
Section titled “setInvulnerable()”setInvulnerable(
invulnerable):boolean
Makes the player a ghost, as Actor.SetGhost does: attacks in their own game pass through them, and their game refuses the hits other players’ games land on them.
Parameters
Section titled “Parameters”invulnerable
Section titled “invulnerable”boolean
The flag.
Returns
Section titled “Returns”boolean
False before the player exists.
setMapWaypoint()
Section titled “setMapWaypoint()”setMapWaypoint(
position):boolean
Drops the player’s own map marker, or takes it off, as they would on the Pip-Boy map: the server’s playerMapWaypoint hears of it and may put back what was there.
Parameters
Section titled “Parameters”position
Section titled “position”{ x: number; y: number; z: number; } | null
Where to, in the space the player stands in; null takes it off.
Returns
Section titled “Returns”boolean
False before the player stands in the world.
setPipboyLight()
Section titled “setPipboyLight()”setPipboyLight(
on):boolean
Turns the player’s Pip-Boy light on or off, as the light key does, without its sound.
Parameters
Section titled “Parameters”boolean
On or off.
Returns
Section titled “Returns”boolean
False before the player stands in the world.
setPipboyVisible()
Section titled “setPipboyVisible()”setPipboyVisible(
visible):void
Hides or shows the Pip-Boy on the player’s wrist, in first and third person and on every other player’s screen, without taking the item away: a character who owns none. Raising it still opens the menu; Controls.setEnabled("menu", false) keeps it shut. Held until shown again or the player disconnects.
Parameters
Section titled “Parameters”visible
Section titled “visible”boolean
Shown, or hidden.
Returns
Section titled “Returns”void
setRace()
Section titled “setRace()”setRace(
race):boolean
Rebuilds the player on another race, as the console’s setrace and Actor.SetRace do: a ghoul. Every other player sees their puppet rebuilt the same way; their head parts stay their own. Only human and ghoul are supported; any other race is refused. The race they had comes back with null, and when the session ends.
Parameters
Section titled “Parameters”string | number | null
0x13746 (HumanRace) or 0xEAFB6 (GhoulRace); null for the race the player had.
Returns
Section titled “Returns”boolean
False when the player is not standing in the world.
setRestrained()
Section titled “setRestrained()”setRestrained(
restrained):boolean
Holds the player in place, as Actor.SetRestrained does: they stand where they are and neither move nor act until let go. Cuffs, a stun, a cutscene.
Parameters
Section titled “Parameters”restrained
Section titled “restrained”boolean
Held, or let go.
Returns
Section titled “Returns”boolean
False before the player stands in the world, or while they are down or dead.
setWeaponDrawn()
Section titled “setWeaponDrawn()”setWeaponDrawn(
drawn):void
Holds the player’s weapon out or away, as FiveM’s SetCurrentPedWeapon forces a ped’s: drawn or holstered at once, then kept so against the ready-weapon key and the game. With no weapon in hand, out raises the fists. Controls.setEnabled("fighting", false) stops attacks too.
Parameters
Section titled “Parameters”boolean | null
True to hold the weapon out, false to keep it away, null to hand it back to the player.
Returns
Section titled “Returns”void
stopHolotape()
Section titled “stopHolotape()”stopHolotape():
boolean
Stops the player’s holotape and takes it out.
Returns
Section titled “Returns”boolean
False when there was none.
useFurniture()
Section titled “useFurniture()”useFurniture(
furniture):boolean
Puts the player into a piece of furniture at once, wherever they stand, as Actor.SnapIntoInteraction does: a chair seats them, a bed lays them down, once its animations are loaded. A seated player stands up by moving; one lying in a bed is there until leaveFurniture.
Parameters
Section titled “Parameters”furniture
Section titled “furniture”string | number
The furniture reference: a chair, a bed, a workbench.
Returns
Section titled “Returns”boolean
False before the player stands in the world, while they are down or dead, when the furniture is not loaded here or would not take them.