SixL client API / game/player / GamePlayerMp
Interface: GamePlayerMp
The local player functions. Only the local player is addressable through mp.game.player.
Remarks
Getters are asynchronous: they return a Promise. Setters and actions take effect on the next game frame.
Example
const wanted = await mp.game.player.getWantedLevel();
Methods
clearWantedLevel()
clearWantedLevel(): void
Clears the local player's wanted level.
Returns
void
Example
mp.game.player.clearWantedLevel();
disableFiring()
disableFiring(toggle):void
Disables or enables the local player's firing.
Parameters
toggle
boolean
true to disable firing, false to enable it again.
Returns
void
Example
mp.game.player.disableFiring(true);
getIndex()
getIndex():Promise<number>
The index of the local player in the session.
Returns
Promise<number>
A Promise of the player index, 0 for the local player.
Example
const index = await mp.game.player.getIndex();
getMaxWantedLevel()
getMaxWantedLevel():Promise<number>
The highest wanted level the local player can reach.
Returns
Promise<number>
A Promise of the highest level, an integer from 0 to 5.
Example
const max = await mp.game.player.getMaxWantedLevel();
getPed()
getPed():Promise<number>
The ped of the local player, as a handle that scripts can pass to the ped functions.
Returns
Promise<number>
A Promise of the local player's ped handle.
Example
const ped = await mp.game.player.getPed();
getPlayersLastVehicle()
getPlayersLastVehicle():Promise<number>
The vehicle the local player was last in.
Returns
Promise<number>
A promise of the vehicle's handle; 0 when there is none this client has.
Remarks
Partial: not yet confirmed in the game.
Example
const last = await mp.game.player.getPlayersLastVehicle();
getTargetEntity()
getTargetEntity():Promise<number>
The entity the local player targets.
Returns
Promise<number>
A promise of the entity's handle; 0 when it targets nothing or nothing this client has.
Remarks
Partial: not yet confirmed in the game.
Example
const target = await mp.game.player.getTargetEntity();
getWantedLevel()
getWantedLevel():Promise<number>
The local player's current wanted level.
Returns
Promise<number>
A Promise of the wanted level, an integer from 0 (no stars) to 5.
Example
const stars = await mp.game.player.getWantedLevel();
getWantedLevelThreshold()
getWantedLevelThreshold(wantedLevel):Promise<number>
The wanted level that a given level of wanted stars means: the threshold the game compares against.
Parameters
wantedLevel
number
The wanted level, as an integer (0 to 5 stars).
Returns
Promise<number>
A Promise of the threshold, as an integer.
Example
const threshold = await mp.game.player.getWantedLevelThreshold(3);
giveRagdollControl()
giveRagdollControl(toggle):void
Gives or takes the control of the local player's ragdoll (the state where the body goes limp).
Parameters
toggle
boolean
true to give the ragdoll control to the game, false to take it back.
Returns
void
Example
mp.game.player.giveRagdollControl(true);
isDead()
isDead():Promise<boolean>
Whether the local player is dead.
Returns
Promise<boolean>
A Promise of true when the player is dead.
Example
const dead = await mp.game.player.isDead();
isFreeAiming()
isFreeAiming():Promise<boolean>
Whether the local player is aiming freely (with a weapon, not at a particular target).
Returns
Promise<boolean>
A Promise of true while the player aims freely.
Example
const aiming = await mp.game.player.isFreeAiming();
isFreeAimingAtEntity()
isFreeAimingAtEntity(entity):Promise<boolean>
Whether the local player is aiming freely at an entity.
Parameters
entity
number | { handle: number; }
The entity, or its handle.
Returns
Promise<boolean>
A Promise of true when the player aims at the entity.
Example
const aimingAt = await mp.game.player.isFreeAimingAtEntity(ped);
isOnline()
isOnline():Promise<boolean>
Whether the local player is online (in a session).
Returns
Promise<boolean>
A Promise of true when the local player is online.
Example
const online = await mp.game.player.isOnline();
isPlaying()
isPlaying():Promise<boolean>
Whether the local player is playing (the player is in control of a character).
Returns
Promise<boolean>
A Promise of true while the player plays.
Example
const playing = await mp.game.player.isPlaying();
isSpecialAbilityActive()
isSpecialAbilityActive(p1?):Promise<boolean>
Whether a special ability of the local player is active.
Parameters
p1?
number
The ability type, as an integer; 0 by default.
Returns
Promise<boolean>
A Promise of true while the ability is active.
Example
const active = await mp.game.player.isSpecialAbilityActive(0);
isSpecialAbilityEnabled()
isSpecialAbilityEnabled(p1?):Promise<boolean>
Whether a special ability of the local player is enabled.
Parameters
p1?
number
The ability type, as an integer; 0 by default.
Returns
Promise<boolean>
A Promise of true while the ability is enabled.
Example
const enabled = await mp.game.player.isSpecialAbilityEnabled(0);
isTargettingAnything()
isTargettingAnything():Promise<boolean>
Whether the local player is targeting anything.
Returns
Promise<boolean>
A Promise of true when the player targets something.
Example
const targeting = await mp.game.player.isTargettingAnything();
isTargettingEntity()
isTargettingEntity(entity):Promise<boolean>
Whether the local player is targeting an entity (aiming at it with a weapon or a lock-on).
Parameters
entity
number | { handle: number; }
The entity, or its handle.
Returns
Promise<boolean>
A Promise of true when the player targets the entity.
Example
const targeting = await mp.game.player.isTargettingEntity(ped);
isTeleportActive()
isTeleportActive():Promise<boolean>
Whether a teleport of the local player is in progress.
Returns
Promise<boolean>
A Promise of true while a teleport runs.
Example
const teleporting = await mp.game.player.isTeleportActive();
isWantedLevelGreater()
isWantedLevelGreater(wantedLevel):Promise<boolean>
Whether the local player's wanted level is greater than a level.
Parameters
wantedLevel
number
The wanted level, as an integer (0 to 5 stars).
Returns
Promise<boolean>
A Promise of true when the current wanted level is greater than wantedLevel.
Example
const greater = await mp.game.player.isWantedLevelGreater(2);
pedId()
pedId():Promise<number>
The same handle as getPed.
Returns
Promise<number>
A Promise of the local player's ped handle.
Example
const ped = await mp.game.player.pedId();
resetArrestState()
resetArrestState(): void
Resets the arrest state of the local player (the state the police set when arresting).
Returns
void
Example
mp.game.player.resetArrestState();
resetInputGait()
resetInputGait(): void
Stops the simulated gait input started by simulateInputGait.
Returns
void
Example
mp.game.player.resetInputGait();
resetWantedLevelDifficulty()
resetWantedLevelDifficulty(): void
Resets the wanted level difficulty to the game's default.
Returns
void
Example
mp.game.player.resetWantedLevelDifficulty();
restoreStamina()
restoreStamina(amount):void
Restores the local player's stamina by a percentage of the stamina bar.
Parameters
amount
number
The percentage to restore, 0..100.
Returns
void
Example
mp.game.player.restoreStamina(100);
setAirDragMultiplierForPlayersVehicle()
setAirDragMultiplierForPlayersVehicle(multiplier):void
Sets the air drag of the local player's vehicle.
Parameters
multiplier
number
The multiplier as a float; 1.0 is the default.
Returns
void
Example
mp.game.player.setAirDragMultiplierForPlayersVehicle(1.0);
setAllRandomPedsFleeThisFrame()
setAllRandomPedsFleeThisFrame(): void
Makes all random peds flee on this frame.
Returns
void
Example
mp.game.player.setAllRandomPedsFleeThisFrame();
setDisableAmbientMeleeMove()
setDisableAmbientMeleeMove(toggle):void
Disables or enables the ambient melee moves of the local player's ped.
Parameters
toggle
boolean
true to disable the ambient melee moves, false to enable them.
Returns
void
Example
mp.game.player.setDisableAmbientMeleeMove(true);
setForcedAim()
setForcedAim(toggle):void
Forces the local player to aim (or stop forcing it).
Parameters
toggle
boolean
true to force the aim, false to stop.
Returns
void
Example
mp.game.player.setForcedAim(false);
setHealthRechargeMultiplier()
setHealthRechargeMultiplier(regenRate):void
Sets the health recharge rate of the local player (how fast health regenerates).
Parameters
regenRate
number
The rate as a float; the game's own scale.
Returns
void
Example
mp.game.player.setHealthRechargeMultiplier(2.0);
setMaxWantedLevel()
setMaxWantedLevel(maxWantedLevel):void
Sets the highest wanted level the local player can reach.
Parameters
maxWantedLevel
number
The highest level, an integer from 0 to 5.
Returns
void
Example
mp.game.player.setMaxWantedLevel(3);
setModel()
setModel(model):void
Sets the model (the appearance) of the local player's ped.
Parameters
model
string | number
The model: its name, or its hash (mp.joaat of the name).
Returns
void
Example
mp.game.player.setModel(mp.joaat('<model name>'));
setSimulateAiming()
setSimulateAiming(toggle):void
Turns the simulated aiming of the local player on or off.
Parameters
toggle
boolean
true to simulate aiming, false to stop.
Returns
void
Example
mp.game.player.setSimulateAiming(true);
setTargetingMode()
setTargetingMode(targetMode):void
Sets the targeting mode of the local player.
Parameters
targetMode
number
The mode, as an integer of the game's targeting modes.
Returns
void
Example
mp.game.player.setTargetingMode(0);
setWantedLevelDifficulty()
setWantedLevelDifficulty(difficulty):void
Sets how hard the police react to the wanted level.
Parameters
difficulty
number
The difficulty as a float; the game's own scale.
Returns
void
Example
mp.game.player.setWantedLevelDifficulty(0.5);
setWeaponDefenseModifier()
setWeaponDefenseModifier(modifier):void
Sets the local player's weapon defense modifier: the multiplier of the damage the player takes from weapons.
Parameters
modifier
number
The multiplier; 1.0 is the default, below 1.0 takes less damage.
Returns
void
Example
mp.game.player.setWeaponDefenseModifier(0.5);
simulateInputGait()
simulateInputGait(amount,gaitType,speed,p4,p5):void
Simulates the player walking or running with input, for a while.
Parameters
amount
number
The amount of input, as a float from 0.0 to 1.0.
gaitType
number
The gait, as an integer: the game's own gait numbers.
speed
number
The speed, as a float.
p4
boolean
A flag of the game, a bool.
p5
boolean
A flag of the game, a bool.
Returns
void
Example
mp.game.player.simulateInputGait(1.0, 1, 1.0, false, false);
stopTeleport()
stopTeleport(): void
Stops a teleport of the local player that is in progress.
Returns
void
Example
mp.game.player.stopTeleport();