SixL client API / game/entity / GameEntityMp
Interface: GameEntityMp
Any entity: a question about its state (isDead, doesExist ...), its position and rotation, its health and appearance, and actions that change them.
Remarks
Every getter returns a Promise. Headings and rotations are in degrees here (RAGE MP scripts speak degrees too); the game's own radians are converted inside. An entity is given by its handle or an object with handle.
Methods
clearLastDamageEntity()
clearLastDamageEntity(entity):void
Forgets which entity last damaged an entity.
Parameters
entity
The entity.
Returns
void
Example
mp.game.entity.clearLastDamageEntity(ped.handle);
createModelHideExcludingScriptObjects()
createModelHideExcludingScriptObjects(x,y,z,radius,model,p5):void
Hides a model in a sphere, except the script's own objects, on this client only.
Parameters
x
number
Centre x, metres.
y
number
Centre y, metres.
z
number
Centre z, metres.
radius
number
Radius, metres.
model
The model's name, or its 32-bit hash.
p5
boolean
The game's flag (true or false).
Returns
void
Remarks
The hide applies to this client only. The model is given as a hash, not as the 64-bit model key.
Example
mp.game.entity.createModelHideExcludingScriptObjects(0, 0, 72, 10, 'prop_name', false);
createModelSwap()
createModelSwap(x,y,z,radius,from,to,p6):void
Replaces one model with another in a sphere, on this client only.
Parameters
x
number
Centre x, metres.
y
number
Centre y, metres.
z
number
Centre z, metres.
radius
number
Radius, metres.
from
The model to replace, its name or 32-bit hash.
to
The model to show instead, its name or 32-bit hash.
p6
boolean
The game's flag (true or false).
Returns
void
Remarks
The swap applies to this client only. The models are given as hashes, not as 64-bit model keys.
Example
mp.game.entity.createModelSwap(0, 0, 72, 10, 'old_prop', 'new_prop', false);
detach()
detach(entity,dynamic,collision):void
Detaches an entity from whatever it is attached to.
Parameters
entity
The entity.
dynamic
boolean
The game's flag for the entity after the detach (true or false).
collision
boolean
The game's flag for collision after the detach (true or false).
Returns
void
Example
mp.game.entity.detach(object.handle, true, true);
doesBelongToThisScript()
doesBelongToThisScript(entity,p1?):Promise<boolean>
Tells whether the entity belongs to this script (the one that created it or took it over).
Parameters
entity
The entity.
p1?
boolean
Accepted for RAGE MP compatibility; ignored.
Returns
Promise<boolean>
A Promise of true when the entity belongs to this script.
Example
const mine = await mp.game.entity.doesBelongToThisScript(ped.handle);
doesExist()
doesExist(entity):Promise<boolean>
Tells whether the entity exists.
Parameters
entity
The entity.
Returns
Promise<boolean>
A Promise of true when the entity exists.
Example
const exists = await mp.game.entity.doesExist(vehicle.handle);
doesHaveDrawable()
doesHaveDrawable(entity):Promise<boolean>
Tells whether the entity has something to draw (a model with a drawable part).
Parameters
entity
The entity.
Returns
Promise<boolean>
A Promise of true when the entity has a drawable.
Example
const drawable = await mp.game.entity.doesHaveDrawable(object.handle);
doesHavePhysics()
doesHavePhysics(entity):Promise<boolean>
Tells whether the entity has physics (it can move and collide).
Parameters
entity
The entity.
Returns
Promise<boolean>
A Promise of true when the entity has physics.
Example
const physics = await mp.game.entity.doesHavePhysics(object.handle);
forceAiAndAnimationUpdate()
forceAiAndAnimationUpdate(entity):void
Forces an update of an entity's AI and animation in this frame.
Parameters
entity
The entity.
Returns
void
Example
mp.game.entity.forceAiAndAnimationUpdate(ped.handle);
freezePosition()
freezePosition(entity,toggle):void
Freezes or unfreezes an entity's position.
Parameters
entity
The entity.
toggle
boolean
true to freeze it in place, false to let it move.
Returns
void
Example
mp.game.entity.freezePosition(vehicle.handle, true);
getAlpha()
getAlpha(entity):Promise<number>
The transparency of an entity.
Parameters
entity
The entity.
Returns
Promise<number>
A Promise of the alpha, 0 (invisible) to 255 (opaque).
Example
const alpha = await mp.game.entity.getAlpha(ped.handle);
getAnimCurrentTime()
getAnimCurrentTime(entity,animDict,animName):Promise<number>
The current time of an entity's animation.
Parameters
entity
The entity.
animDict
The animation dictionary's name, or its hash.
animName
The animation's name, or its hash.
Returns
Promise<number>
A Promise of the time into the animation, in the game's own unit.
Example
const t = await mp.game.entity.getAnimCurrentTime(ped.handle, 'dict_name', 'anim_name');
getBoneIndexByName()
getBoneIndexByName(entity,bone):Promise<number>
The index of a bone of an entity, by its name.
Parameters
entity
The entity.
bone
The bone's name, or its hash.
Returns
Promise<number>
A Promise of the bone's index (an integer).
Example
const index = await mp.game.entity.getBoneIndexByName(ped.handle, 'head');
getCollisionDisabled()
getCollisionDisabled(entity):Promise<boolean>
Tells whether the entity's collision is switched off.
Parameters
entity
The entity.
Returns
Promise<boolean>
A Promise of true when the collision is disabled.
Example
const off = await mp.game.entity.getCollisionDisabled(object.handle);
getCoords()
getCoords(entity,alive):Promise<IVector3>
The position of an entity.
Parameters
entity
The entity.
alive
boolean
true for the entity's position when it is alive (RAGE MP's flag), passed to the game as given.
Returns
Promise<IVector3>
A Promise of the position in metres (x east, y north, z up).
Example
const pos = await mp.game.entity.getCoords(ped.handle, true);
getForwardVector()
getForwardVector(entity):Promise<IVector3>
The direction an entity faces, as a unit vector.
Parameters
entity
The entity.
Returns
Promise<IVector3>
A Promise of the direction vector.
Example
const dir = await mp.game.entity.getForwardVector(vehicle.handle);
getHeading()
getHeading(entity):Promise<number>
The heading of an entity: the direction it faces, counter-clockwise from north.
Parameters
entity
The entity.
Returns
Promise<number>
A Promise of the heading in degrees, 0 up to 360.
Example
const heading = await mp.game.entity.getHeading(ped.handle);
getHealth()
getHealth(entity):Promise<number>
The health of an entity, in the game's health points (a ped dies at 0).
Parameters
entity
The entity.
Returns
Promise<number>
A Promise of the health, an integer.
Example
const hp = await mp.game.entity.getHealth(ped.handle);
getHeight()
getHeight(entity,x,y,z,atTop,inWorldCoords):Promise<number>
The height of an entity above a point.
Parameters
entity
The entity.
x
number
x of the point, metres.
y
number
y of the point, metres.
z
number
z of the point, metres.
atTop
boolean
true to measure from the top of the entity, false from its base.
inWorldCoords
boolean
true when the point is in world coordinates, false when it is relative to the entity.
Returns
Promise<number>
A Promise of the height, metres.
Example
const h = await mp.game.entity.getHeight(vehicle.handle, 0, 0, 0, false, true);
getHeightAboveGround()
getHeightAboveGround(entity):Promise<number>
The height of an entity above the ground.
Parameters
entity
The entity.
Returns
Promise<number>
A Promise of the height, metres.
Remarks
RAGE MP has no second argument here; the game's extra flag is passed as 0.
Example
const h = await mp.game.entity.getHeightAboveGround(vehicle.handle);
getLodDist()
getLodDist(entity):Promise<number>
The distance at which an entity's level of detail changes.
Parameters
entity
The entity.
Returns
Promise<number>
A Promise of the distance, metres.
Example
const dist = await mp.game.entity.getLodDist(object.handle);
getMaxHealth()
getMaxHealth(entity):Promise<number>
The maximum health of an entity.
Parameters
entity
The entity.
Returns
Promise<number>
A Promise of the maximum health, an integer.
Example
const max = await mp.game.entity.getMaxHealth(ped.handle);
getModel()
getModel(entity):Promise<number>
The model of an entity.
Parameters
entity
The entity.
Returns
Promise<number>
A Promise of the model's 32-bit hash.
Remarks
Whether the value matches the hash of the model's name is not verified in the game.
Example
const model = await mp.game.entity.getModel(vehicle.handle);
getPopulationType()
getPopulationType(entity):Promise<number>
The population type of an entity.
Parameters
entity
The entity.
Returns
Promise<number>
A Promise of the population type, an integer in the game's numbering.
Example
const population = await mp.game.entity.getPopulationType(ped.handle);
getQuaternion()
getQuaternion(entity):Promise<{w:number;x:number;y:number;z:number; }>
The rotation of an entity as a quaternion.
Parameters
entity
The entity.
Returns
Promise<{ w: number; x: number; y: number; z: number; }>
A Promise of the quaternion's four components x, y, z, w.
Example
const q = await mp.game.entity.getQuaternion(vehicle.handle);
getRotation()
getRotation(entity,order):Promise<IVector3>
The rotation of an entity.
Parameters
entity
The entity.
order
number
The rotation order, an integer (2 is the default).
Returns
Promise<IVector3>
A Promise of the rotation in degrees: x pitch, y roll, z yaw.
Example
const rot = await mp.game.entity.getRotation(vehicle.handle, 2);
getRotationVelocity()
getRotationVelocity(entity):Promise<IVector3>
How fast an entity is rotating.
Parameters
entity
The entity.
Returns
Promise<IVector3>
A Promise of the angular velocity (unit not verified in the game).
Example
const spin = await mp.game.entity.getRotationVelocity(vehicle.handle);
getSpeed()
getSpeed(entity):Promise<number>
The speed of an entity.
Parameters
entity
The entity.
Returns
Promise<number>
A Promise of the speed, metres per second (unit not verified in the game).
Example
const speed = await mp.game.entity.getSpeed(vehicle.handle);
getSpeedVector()
getSpeedVector(entity,relative):Promise<IVector3>
How fast an entity moves, as a vector.
Parameters
entity
The entity.
relative
boolean
true for the speed in the entity's own axes, false for the world's.
Returns
Promise<IVector3>
A Promise of the speed vector (metres per second, unit not verified in the game).
Example
const v = await mp.game.entity.getSpeedVector(vehicle.handle, false);
getSubmergedLevel()
getSubmergedLevel(entity):Promise<number>
How far an entity is under water.
Parameters
entity
The entity.
Returns
Promise<number>
A Promise of the submerged level: 0 out of the water, larger the deeper it is (unit not verified).
Example
const depth = await mp.game.entity.getSubmergedLevel(ped.handle);
getType()
getType(entity):Promise<number>
The kind of an entity.
Parameters
entity
The entity.
Returns
Promise<number>
A Promise of the kind, an integer in the game's numbering.
Example
const type = await mp.game.entity.getType(entity);
getUprightValue()
getUprightValue(entity):Promise<number>
How far an entity is from standing upright.
Parameters
entity
The entity.
Returns
Promise<number>
A Promise of the value (its unit is not verified in the game).
Example
const value = await mp.game.entity.getUprightValue(vehicle.handle);
hasAnimEventFired()
hasAnimEventFired(entity,action):Promise<boolean>
Tells whether an animation event fired on the entity.
Parameters
entity
The entity.
action
The action's name, or its hash.
Returns
Promise<boolean>
A Promise of true when the event fired.
Example
const fired = await mp.game.entity.hasAnimEventFired(ped.handle, 'footstep');
hasBeenDamagedByAnyObject()
hasBeenDamagedByAnyObject(entity):Promise<boolean>
Tells whether the entity has been damaged by any object.
Parameters
entity
The entity.
Returns
Promise<boolean>
A Promise of true when an object damaged it.
Example
const hit = await mp.game.entity.hasBeenDamagedByAnyObject(vehicle.handle);
hasBeenDamagedByAnyPed()
hasBeenDamagedByAnyPed(entity):Promise<boolean>
Tells whether the entity has been damaged by any ped.
Parameters
entity
The entity.
Returns
Promise<boolean>
A Promise of true when a ped damaged it.
Example
const hit = await mp.game.entity.hasBeenDamagedByAnyPed(vehicle.handle);
hasBeenDamagedByAnyVehicle()
hasBeenDamagedByAnyVehicle(entity):Promise<boolean>
Tells whether the entity has been damaged by any vehicle.
Parameters
entity
The entity.
Returns
Promise<boolean>
A Promise of true when a vehicle damaged it.
Example
const hit = await mp.game.entity.hasBeenDamagedByAnyVehicle(ped.handle);
hasBeenDamagedByEntity()
hasBeenDamagedByEntity(entity,other,p2):Promise<boolean>
Tells whether an entity has been damaged by another entity.
Parameters
entity
The damaged entity.
other
The entity that may have damaged it.
p2
boolean
The game's flag for this check (true or false).
Returns
Promise<boolean>
A Promise of true when other damaged entity.
Remarks
RAGE MP has no third flag here; the game's extra argument is passed as 0.
Example
const hit = await mp.game.entity.hasBeenDamagedByEntity(vehicle.handle, ped.handle, false);
hasCollidedWithAnything()
hasCollidedWithAnything(entity):Promise<boolean>
Tells whether the entity has collided with anything since the last check.
Parameters
entity
The entity.
Returns
Promise<boolean>
A Promise of true when a collision happened.
Example
const crashed = await mp.game.entity.hasCollidedWithAnything(vehicle.handle);
isAMissionEntity()
isAMissionEntity(entity):Promise<boolean>
Tells whether the entity is a mission entity (it is kept while the script needs it).
Parameters
entity
The entity.
Returns
Promise<boolean>
A Promise of true for a mission entity.
Example
const mission = await mp.game.entity.isAMissionEntity(vehicle.handle);
isAnEntity()
isAnEntity(handle):Promise<boolean>
Tells whether a handle is an entity that exists: a vehicle, a ped, an object or a player.
Parameters
handle
number
The entity's handle.
Returns
Promise<boolean>
A Promise of true for an existing entity.
Example
const exists = await mp.game.entity.isAnEntity(vehicle.handle);
isAnObject()
isAnObject(entity):Promise<boolean>
Tells whether the entity is an object (a prop).
Parameters
entity
The entity.
Returns
Promise<boolean>
A Promise of true for an object.
Example
const object = await mp.game.entity.isAnObject(entity);
isAPed()
isAPed(entity):Promise<boolean>
Tells whether the entity is a ped.
Parameters
entity
The entity.
Returns
Promise<boolean>
A Promise of true for a ped.
Example
const ped = await mp.game.entity.isAPed(entity);
isAtEntity()
isAtEntity(entity,other,xs,ys,zs,p5,p6,p7):Promise<boolean>
Tells whether an entity is at another entity, within a box around it.
Parameters
entity
The entity.
other
The entity the box is around.
xs
number
Half size of the box along x, metres.
ys
number
Half size of the box along y, metres.
zs
number
Half size of the box along z, metres.
p5
boolean
The game's first flag (true or false).
p6
boolean
The game's second flag (true or false).
p7
number
The game's integer argument.
Returns
Promise<boolean>
A Promise of true when entity is inside the box.
Example
const near = await mp.game.entity.isAtEntity(ped.handle, vehicle.handle, 2, 2, 2, false, false, 0);
isAttached()
isAttached(entity):Promise<boolean>
Tells whether the entity is attached to another entity or to a position.
Parameters
entity
The entity.
Returns
Promise<boolean>
A Promise of true when the entity is attached.
Example
const attached = await mp.game.entity.isAttached(object.handle);
isAttachedToAnyObject()
isAttachedToAnyObject(entity):Promise<boolean>
Tells whether the entity is attached to an object.
Parameters
entity
The entity.
Returns
Promise<boolean>
A Promise of true when it is attached to any object.
Example
const onObject = await mp.game.entity.isAttachedToAnyObject(ped.handle);
isAttachedToAnyPed()
isAttachedToAnyPed(entity):Promise<boolean>
Tells whether the entity is attached to a ped.
Parameters
entity
The entity.
Returns
Promise<boolean>
A Promise of true when it is attached to any ped.
Example
const onPed = await mp.game.entity.isAttachedToAnyPed(object.handle);
isAttachedToAnyVehicle()
isAttachedToAnyVehicle(entity):Promise<boolean>
Tells whether the entity is attached to a vehicle.
Parameters
entity
The entity.
Returns
Promise<boolean>
A Promise of true when it is attached to any vehicle.
Example
const onVehicle = await mp.game.entity.isAttachedToAnyVehicle(object.handle);
isAttachedToEntity()
isAttachedToEntity(entity,other):Promise<boolean>
Tells whether an entity is attached to another entity.
Parameters
entity
The entity.
other
The entity it may be attached to.
Returns
Promise<boolean>
A Promise of true when entity is attached to other.
Example
const onIt = await mp.game.entity.isAttachedToEntity(object.handle, vehicle.handle);
isAVehicle()
isAVehicle(entity):Promise<boolean>
Tells whether the entity is a vehicle.
Parameters
entity
The entity.
Returns
Promise<boolean>
A Promise of true for a vehicle.
Example
const vehicle = await mp.game.entity.isAVehicle(entity);
isDead()
isDead(entity,p1?):Promise<boolean>
Tells whether the entity is dead.
Parameters
entity
The entity.
p1?
boolean
Accepted for RAGE MP compatibility; ignored.
Returns
Promise<boolean>
A Promise of true when the entity is dead.
Example
const dead = await mp.game.entity.isDead(ped.handle);
isInAir()
isInAir(entity):Promise<boolean>
Tells whether the entity is in the air (it has no contact with the ground or water).
Parameters
entity
The entity.
Returns
Promise<boolean>
A Promise of true while the entity is airborne.
Example
const airborne = await mp.game.entity.isInAir(vehicle.handle);
isInArea()
isInArea(entity,x1,y1,z1,x2,y2,z2,p7,p8,p9):Promise<boolean>
Tells whether an entity is inside a box (two corners in the world).
Parameters
entity
The entity.
x1
number
One corner, x in metres.
y1
number
One corner, y in metres.
z1
number
One corner, z in metres.
x2
number
The opposite corner, x in metres.
y2
number
The opposite corner, y in metres.
z2
number
The opposite corner, z in metres.
p7
boolean
The game's first flag (true or false).
p8
boolean
The game's second flag (true or false).
p9
number
The game's integer argument.
Returns
Promise<boolean>
A Promise of true when the entity is inside the box.
Example
const inside = await mp.game.entity.isInArea(ped.handle, -10, -10, 70, 10, 10, 80, false, false, 0);
isInWater()
isInWater(entity):Promise<boolean>
Tells whether the entity is in water.
Parameters
entity
The entity.
Returns
Promise<boolean>
A Promise of true when the entity is in water.
Example
const wet = await mp.game.entity.isInWater(ped.handle);
isOccluded()
isOccluded(entity):Promise<boolean>
Tells whether the entity is occluded (something stands between it and the camera).
Parameters
entity
The entity.
Returns
Promise<boolean>
A Promise of true when the entity is occluded.
Example
const hidden = await mp.game.entity.isOccluded(ped.handle);
isOnScreen()
isOnScreen(entity):Promise<boolean>
Tells whether the entity is on the screen (in the view of the camera).
Parameters
entity
The entity.
Returns
Promise<boolean>
A Promise of true while the entity is visible on the screen.
Example
const onScreen = await mp.game.entity.isOnScreen(ped.handle);
isPlayingAnim()
isPlayingAnim(entity,animDict,animName,flag):Promise<boolean>
Tells whether an entity plays an animation.
Parameters
entity
The entity.
animDict
The animation dictionary's name, or its hash.
animName
The animation's name, or its hash.
flag
number
The task flag, an integer (0 for the animation alone).
Returns
Promise<boolean>
A Promise of true while the entity plays that animation.
Example
const playing = await mp.game.entity.isPlayingAnim(ped.handle, 'dict_name', 'anim_name', 0);
isStatic()
isStatic(entity):Promise<boolean>
Tells whether the entity is static (it does not move with physics).
Parameters
entity
The entity.
Returns
Promise<boolean>
A Promise of true when the entity is static.
Example
const fixed = await mp.game.entity.isStatic(object.handle);
isTouchingEntity()
isTouchingEntity(entity,other):Promise<boolean>
Tells whether two entities touch each other.
Parameters
entity
The first entity.
other
The second entity.
Returns
Promise<boolean>
A Promise of true while they are in contact.
Example
const touching = await mp.game.entity.isTouchingEntity(ped.handle, vehicle.handle);
isTouchingModel()
isTouchingModel(entity,model):Promise<boolean>
Tells whether the entity touches a model (an entity of that model is in contact with it).
Parameters
entity
The entity.
model
The model's name, or its 32-bit hash.
Returns
Promise<boolean>
A Promise of true while the entity touches a model of that kind.
Remarks
The model is looked up in the game's own key list; GTA V model names are not always found in VI.
Example
const touching = await mp.game.entity.isTouchingModel(vehicle.handle, 'prop_name');
isUpright()
isUpright(entity,angle):Promise<boolean>
Tells whether an entity stands upright, within a tolerance.
Parameters
entity
The entity.
angle
number
The tolerance, degrees.
Returns
Promise<boolean>
A Promise of true when the entity is upright within the tolerance.
Example
const upright = await mp.game.entity.isUpright(vehicle.handle, 10);
isUpsidedown()
isUpsidedown(entity):Promise<boolean>
Tells whether the entity is upside down.
Parameters
entity
The entity.
Returns
Promise<boolean>
A Promise of true when the entity is upside down.
Example
const flipped = await mp.game.entity.isUpsidedown(vehicle.handle);
isVisible()
isVisible(entity):Promise<boolean>
Tells whether the entity is visible (drawn).
Parameters
entity
The entity.
Returns
Promise<boolean>
A Promise of true when the entity is drawn.
Example
const visible = await mp.game.entity.isVisible(ped.handle);
isVisibleToScript()
isVisibleToScript(entity):Promise<boolean>
Tells whether the entity is visible to the script's own checks.
Parameters
entity
The entity.
Returns
Promise<boolean>
A Promise of true when the entity is visible to the script.
Example
const visible = await mp.game.entity.isVisibleToScript(ped.handle);
isWaitingForWorldCollision()
isWaitingForWorldCollision(entity):Promise<boolean>
Tells whether the entity is waiting for the world's collision to load under it.
Parameters
entity
The entity.
Returns
Promise<boolean>
A Promise of true while it waits.
Example
const waiting = await mp.game.entity.isWaitingForWorldCollision(vehicle.handle);
removeModelHide()
removeModelHide(x,y,z,radius,model,p5):void
Hides a model in a sphere, on this client only.
Parameters
x
number
Centre x, metres.
y
number
Centre y, metres.
z
number
Centre z, metres.
radius
number
Radius, metres.
model
The model's name, or its 32-bit hash.
p5
boolean
The game's flag (true or false).
Returns
void
Remarks
The hide applies to this client only. The model is given as a hash, not as the 64-bit model key.
Example
mp.game.entity.removeModelHide(0, 0, 72, 10, 'prop_name', false);
removeModelSwap()
removeModelSwap(x,y,z,radius,from,to,p6):void
Removes a model swap made with GameEntityMp.createModelSwap.
Parameters
x
number
Centre x, metres.
y
number
Centre y, metres.
z
number
Centre z, metres.
radius
number
Radius, metres.
from
The replaced model, its name or 32-bit hash.
to
The model shown instead, its name or 32-bit hash.
p6
boolean
The game's flag (true or false).
Returns
void
Example
mp.game.entity.removeModelSwap(0, 0, 72, 10, 'old_prop', 'new_prop', false);
resetAlpha()
resetAlpha(entity):void
Resets the transparency of an entity to opaque.
Parameters
entity
The entity.
Returns
void
Example
mp.game.entity.resetAlpha(ped.handle);
setAlpha()
setAlpha(entity,alpha,skin):void
Sets the transparency of an entity.
Parameters
entity
The entity.
alpha
number
The alpha, 0 (invisible) to 255 (opaque).
skin
boolean
true to apply it to the skin as well, false to the entity only.
Returns
void
Example
mp.game.entity.setAlpha(ped.handle, 128, false);
setAsMissionEntity()
setAsMissionEntity(entity,p1,p2):void
Marks an entity as a mission entity, so the game keeps it while the script needs it.
Parameters
entity
The entity.
p1
boolean
The game's first flag (true or false).
p2
boolean
The game's second flag (true or false).
Returns
void
Example
mp.game.entity.setAsMissionEntity(vehicle.handle, true, true);
setCanBeDamaged()
setCanBeDamaged(entity,toggle):void
Lets an entity take damage or not.
Parameters
entity
The entity.
toggle
boolean
true to allow damage, false to stop it.
Returns
void
Example
mp.game.entity.setCanBeDamaged(vehicle.handle, false);
setCanBeDamagedByRelationshipGroup()
setCanBeDamagedByRelationshipGroup(entity,toggle,group):void
Lets an entity take damage from a relationship group only, or from every group.
Parameters
entity
The entity.
toggle
boolean
true to allow damage from the group, false to refuse it.
group
The relationship group's name, or its hash.
Returns
void
Example
mp.game.entity.setCanBeDamagedByRelationshipGroup(ped.handle, false, 'group_name');
setCanBeTargetedWithoutLos()
setCanBeTargetedWithoutLos(entity,toggle):void
Lets an entity be targeted without a clear line of sight.
Parameters
entity
The entity.
toggle
boolean
true to allow it, false to refuse it.
Returns
void
Example
mp.game.entity.setCanBeTargetedWithoutLos(ped.handle, true);
setCollision()
setCollision(entity,toggle,keepPhysics):void
Switches an entity's collision on or off.
Parameters
entity
The entity.
toggle
boolean
true to enable the collision, false to disable it.
keepPhysics
boolean
true to keep the physics, false to drop them with it.
Returns
void
Remarks
The game's unexplained argument is passed as 0.
Example
mp.game.entity.setCollision(object.handle, false, true);
setCompletelyDisableCollision()
setCompletelyDisableCollision(entity,toggle,keepPhysics):void
Switches an entity's collision off completely.
Parameters
entity
The entity.
toggle
boolean
true to disable the collision, false to restore it.
keepPhysics
boolean
true to keep the physics, false to drop them with it.
Returns
void
Example
mp.game.entity.setCompletelyDisableCollision(object.handle, true, false);
setDynamic()
setDynamic(entity,toggle):void
Makes an entity dynamic (it moves with physics) or not.
Parameters
entity
The entity.
toggle
boolean
true for dynamic, false for static.
Returns
void
Example
mp.game.entity.setDynamic(object.handle, true);
setHasGravity()
setHasGravity(entity,toggle):void
Switches gravity on an entity on or off.
Parameters
entity
The entity.
toggle
boolean
true to apply gravity, false to float.
Returns
void
Example
mp.game.entity.setHasGravity(object.handle, false);
setHeading()
setHeading(entity,heading):void
Turns an entity to a heading.
Parameters
entity
The entity.
heading
number
The heading in degrees, counter-clockwise from north.
Returns
void
Example
mp.game.entity.setHeading(ped.handle, 90);
setHealth()
setHealth(entity,health,p2?):void
Sets the health of an entity.
Parameters
entity
The entity.
health
number
The health, an integer (a ped dies at 0).
p2?
number
Accepted for RAGE MP compatibility; ignored.
Returns
void
Remarks
The game's killer and flags are left empty.
Example
mp.game.entity.setHealth(ped.handle, 100);
setInvincible()
setInvincible(entity,toggle):void
Makes an entity invincible or not.
Parameters
entity
The entity.
toggle
boolean
true to make it invincible, false to make it take damage again.
Returns
void
Example
mp.game.entity.setInvincible(ped.handle, true);
setIsTargetPriority()
setIsTargetPriority(entity,toggle,p2?):void
Gives an entity priority as a target.
Parameters
entity
The entity.
toggle
boolean
true to make it a priority target, false to drop the priority.
p2?
number
Accepted for RAGE MP compatibility; ignored.
Returns
void
Example
mp.game.entity.setIsTargetPriority(ped.handle, true);
setLoadCollisionFlag()
setLoadCollisionFlag(entity,toggle,p2?):void
Sets whether an entity loads its collision with the world.
Parameters
entity
The entity.
toggle
boolean
true to load the collision, false to skip it.
p2?
number
Accepted for RAGE MP compatibility; ignored.
Returns
void
Example
mp.game.entity.setLoadCollisionFlag(object.handle, true);
setLodDist()
setLodDist(entity,value):void
Sets the distance at which an entity's level of detail changes.
Parameters
entity
The entity.
value
number
The distance, metres (an integer).
Returns
void
Example
mp.game.entity.setLodDist(object.handle, 500);
setMaxHealth()
setMaxHealth(entity,value):void
Sets the maximum health of an entity.
Parameters
entity
The entity.
value
number
The maximum health, an integer.
Returns
void
Example
mp.game.entity.setMaxHealth(ped.handle, 200);
setMaxSpeed()
setMaxSpeed(entity,speed):void
Sets the top speed of an entity.
Parameters
entity
The entity.
speed
number
The top speed, metres per second.
Returns
void
Example
mp.game.entity.setMaxSpeed(vehicle.handle, 30);
setNoCollisionEntity()
setNoCollisionEntity(a,b,frame):void
Makes two entities pass through each other (no collision between them).
Parameters
a
The first entity.
b
The second entity.
frame
boolean
true to apply it for the current frame only, false to keep it.
Returns
void
Example
mp.game.entity.setNoCollisionEntity(ped.handle, vehicle.handle, false);
setOnlyDamagedByPlayer()
setOnlyDamagedByPlayer(entity,toggle):void
Lets an entity be damaged only by the player, or by anyone.
Parameters
entity
The entity.
toggle
boolean
true to allow only the player's damage, false to allow everyone's.
Returns
void
Example
mp.game.entity.setOnlyDamagedByPlayer(ped.handle, true);
setOnlyDamagedByRelationshipGroup()
setOnlyDamagedByRelationshipGroup(entity,toggle,group):void
Lets an entity be damaged only by one relationship group.
Parameters
entity
The entity.
toggle
boolean
true to restrict damage to the group, false to lift the restriction.
group
The relationship group's name, or its hash.
Returns
void
Example
mp.game.entity.setOnlyDamagedByRelationshipGroup(ped.handle, true, 'group_name');
setRotation()
setRotation(entity,pitch,roll,yaw,order,p5):void
Turns an entity to a rotation.
Parameters
entity
The entity.
pitch
number
Pitch in degrees (positive looks up).
roll
number
Roll in degrees.
yaw
number
Yaw in degrees, counter-clockwise from north.
order
number
The rotation order, an integer (2 is the default).
p5
boolean
The game's flag (true or false).
Returns
void
Example
mp.game.entity.setRotation(vehicle.handle, 0, 0, 90, 2, false);
setVelocity()
setVelocity(entity,x,y,z):void
Gives an entity a velocity.
Parameters
entity
The entity.
x
number
Speed along x, metres per second.
y
number
Speed along y, metres per second.
z
number
Speed along z, metres per second.
Returns
void
Example
mp.game.entity.setVelocity(object.handle, 0, 0, 5);
setVisible()
setVisible(entity,toggle,unk?):void
Shows or hides an entity.
Parameters
entity
The entity.
toggle
boolean
true to show it, false to hide it.
unk?
boolean
Accepted for RAGE MP compatibility; ignored.
Returns
void
Example
mp.game.entity.setVisible(object.handle, false);
stopAnim()
stopAnim(entity,anim,group,p3):void
Stops an animation that an entity plays.
Parameters
entity
The entity.
anim
The animation's name, or its hash.
group
The animation dictionary's name, or its hash.
p3
number
The blend-out time, seconds (a float).
Returns
void
Example
mp.game.entity.stopAnim(ped.handle, 'anim_name', 'dict_name', 0.2);
wouldBeOccluded()
wouldBeOccluded(model,x,y,z,p4):Promise<boolean>
The same as GameEntityMp.wouldEntityBeOccluded.
Parameters
model
The model's name, or its 32-bit hash.
x
number
x in metres.
y
number
y in metres.
z
number
z in metres.
p4
boolean
The game's flag for this check (true or false).
Returns
Promise<boolean>
A Promise of true when the model would be occluded at that point.
Example
const hidden = await mp.game.entity.wouldBeOccluded('prop_name', 0, 0, 72, false);
wouldEntityBeOccluded()
wouldEntityBeOccluded(model,x,y,z,p4):Promise<boolean>
Tells whether a model would be occluded from a point by something in front of it.
Parameters
model
The model's name, or its 32-bit hash.
x
number
x in metres.
y
number
y in metres.
z
number
z in metres.
p4
boolean
The game's flag for this check (true or false).
Returns
Promise<boolean>
A Promise of true when the model would be occluded at that point.
Remarks
The model is looked up in the game's own key list; GTA V model names are not always found in VI.
Example
const hidden = await mp.game.entity.wouldEntityBeOccluded('prop_name', 0, 0, 72, false);