SixL client API / game/misc / GameMiscMp
Interface: GameMiscMp
The miscellaneous game functions: the time scale, weather and wind, the game's timer and frames, hashes.
Remarks
Getters are asynchronous: they return a Promise (getHashKey, the maths, strings and random numbers are synchronous).
Example
const wind = await mp.game.misc.getWindSpeed();
Methods
absf()
absf(value):number
The absolute value of a number.
Parameters
value
number
The number.
Returns
number
The absolute value.
Remarks
Computed by the client (the same result as the game's script function), synchronously.
Example
const a = mp.game.misc.absf(-2.5);
absi()
absi(value):number
The absolute value of an integer.
Parameters
value
number
The integer (a fraction is dropped).
Returns
number
The absolute value.
Remarks
Computed by the client (the same result as the game's script function), synchronously.
Example
const a = mp.game.misc.absi(-5);
acos()
acos(p0):number
The arccosine, in degrees.
Parameters
p0
number
The cosine, from -1 to 1.
Returns
number
The angle in degrees, from 0 to 180.
Remarks
Computed by the client (the same result as the game's script function), synchronously.
Example
const deg = mp.game.misc.acos(0.5);
areStringsEqual()
areStringsEqual(string1,string2):boolean
Whether two strings are equal (case matters).
Parameters
string1
string
The first string.
string2
string
The second string.
Returns
boolean
True when they are equal.
Remarks
Computed by the client (the same result as the game's script function), synchronously.
Example
const same = mp.game.misc.areStringsEqual(a, b);
asin()
asin(p0):number
The arcsine, in degrees.
Parameters
p0
number
The sine, from -1 to 1.
Returns
number
The angle in degrees, from -90 to 90.
Remarks
Computed by the client (the same result as the game's script function), synchronously.
Example
const deg = mp.game.misc.asin(0.5);
atan()
atan(p0):number
The arctangent, in degrees.
Parameters
p0
number
The tangent.
Returns
number
The angle in degrees, from -90 to 90.
Remarks
Computed by the client (the same result as the game's script function), synchronously.
Example
const deg = mp.game.misc.atan(1);
atan2()
atan2(p0,p1):number
The angle of the point (p1, p0) from the x axis, in degrees.
Parameters
p0
number
The y.
p1
number
The x.
Returns
number
The angle in degrees, from -180 to 180.
Remarks
Computed by the client (the same result as the game's script function), synchronously.
Example
const deg = mp.game.misc.atan2(dy, dx);
clearOverrideWeather()
clearOverrideWeather(): void
Clears an overridden weather, so the game's own weather comes back.
Returns
void
Remarks
Partial: in this client's game only; the server's world weather (mp.world) sets the weather again when it changes.
Example
mp.game.misc.clearOverrideWeather();
clearWeatherTypePersist()
clearWeatherTypePersist(): void
Stops keeping the weather that was set to persist.
Returns
void
Remarks
Partial: in this client's game only; the server's world weather (mp.world) sets the weather again when it changes.
Example
mp.game.misc.clearWeatherTypePersist();
compareStrings()
compareStrings(str1,str2,matchCase,maxLength):number
Compares two strings.
Parameters
str1
string
The first string.
str2
string
The second string.
matchCase
boolean
False to ignore case.
maxLength
number
How many characters to compare; -1 for all.
Returns
number
0 when equal, -1 when the first comes before the second, 1 when after.
Remarks
Computed by the client (the same result as the game's script function), synchronously.
Example
const order = mp.game.misc.compareStrings(a, b, false, -1);
deleteIncident()
deleteIncident(incidentId):void
Deletes a dispatch incident.
Parameters
incidentId
number
The incident, as the game numbers it.
Returns
void
Remarks
Partial: in this client's game only; not yet confirmed in the game.
Example
mp.game.misc.deleteIncident(incident);
disableAutomaticRespawn()
disableAutomaticRespawn(toggle):void
Holds the game's own respawn after death (the same as pauseDeathArrestRestart).
Parameters
toggle
boolean
True to hold it.
Returns
void
Remarks
Partial: in this client's game only; through a game function that is likely, not certain, to be this one; not yet confirmed in the game.
Example
mp.game.misc.disableAutomaticRespawn(true);
enableDispatchService()
enableDispatchService(dispatchService,toggle):void
Turns a dispatch service (police, ambulance, fire and the like) on or off.
Parameters
dispatchService
number
The service, as the game numbers it.
toggle
boolean
False to turn it off.
Returns
void
Remarks
Partial: in this client's game only; through a game function that is likely, not certain, to be this one; not yet confirmed in the game.
Example
mp.game.misc.enableDispatchService(1, false);
enableMpDlcMaps()
enableMpDlcMaps(toggle):void
Sets which map content the game loads first (the older name of setInstancePriorityMode, true for 1).
Parameters
toggle
boolean
True for the multiplayer mode.
Returns
void
Remarks
Partial: in this client's game only; through a game function that is likely, not certain, to be this one; not yet confirmed in the game.
Example
mp.game.misc.enableMpDlcMaps(true);
forceLightningFlash()
forceLightningFlash(): void
Makes a lightning flash.
Returns
void
Remarks
Partial: in this client's game only; not yet confirmed in the game.
Example
mp.game.misc.forceLightningFlash();
getAngleBetween2dVectors()
getAngleBetween2dVectors(x1,y1,x2,y2):number
The angle between two 2D vectors.
Parameters
x1
number
The first vector's x.
y1
number
The first vector's y.
x2
number
The second vector's x.
y2
number
The second vector's y.
Returns
number
The angle in degrees, from 0 to 180 (0 when a vector is zero).
Remarks
Computed by the client (the same result as the game's script function), synchronously.
Example
const deg = mp.game.misc.getAngleBetween2dVectors(1, 0, 0, 1);
getAngleBetween2DVectors()
getAngleBetween2DVectors(x1,y1,x2,y2):number
The angle between two 2D vectors (the same as getAngleBetween2dVectors).
Parameters
x1
number
The first vector's x.
y1
number
The first vector's y.
x2
number
The second vector's x.
y2
number
The second vector's y.
Returns
number
The angle in degrees, from 0 to 180 (0 when a vector is zero).
Remarks
Computed by the client (the same result as the game's script function), synchronously.
Example
const deg = mp.game.misc.getAngleBetween2DVectors(1, 0, 0, 1);
getBitsInRange()
getBitsInRange(variable,rangeStart,rangeEnd):number
The bits of a 32-bit integer from one bit to another, as a number.
Parameters
variable
number
The integer.
rangeStart
number
The lowest bit, from 0.
rangeEnd
number
The highest bit, up to 31.
Returns
number
The bits, shifted down to bit 0 (0 when the range is wrong).
Remarks
Computed by the client (the same result as the game's script function), synchronously.
Example
const part = mp.game.misc.getBitsInRange(flags, 4, 7);
getDistanceBetweenCoords()
getDistanceBetweenCoords(x1,y1,z1,x2,y2,z2,useZ):number
The distance between two points.
Parameters
x1
number
The first point's x.
y1
number
The first point's y.
z1
number
The first point's z.
x2
number
The second point's x.
y2
number
The second point's y.
z2
number
The second point's z.
useZ
boolean
False to measure on the ground plane only.
Returns
number
The distance in metres.
Remarks
Computed by the client (the same result as the game's script function), synchronously.
Example
const d = mp.game.misc.getDistanceBetweenCoords(a.x, a.y, a.z, b.x, b.y, b.z, true);
getFrameCount()
getFrameCount():Promise<number>
The number of frames the game has drawn.
Returns
Promise<number>
A Promise of the frame count.
Remarks
Partial: not yet confirmed in the game.
Example
const frames = await mp.game.misc.getFrameCount();
getFrameTime()
getFrameTime():Promise<number>
The time the last frame took, in seconds.
Returns
Promise<number>
A Promise of the seconds, a float.
Remarks
Partial: not yet confirmed in the game.
Example
const dt = await mp.game.misc.getFrameTime();
getGameTimer()
getGameTimer():Promise<number>
The time since the game started, in milliseconds.
Returns
Promise<number>
A Promise of the milliseconds.
Remarks
Partial: not yet confirmed in the game.
Example
const now = await mp.game.misc.getGameTimer();
getHashKey()
getHashKey(string):number
The hash of a name, as the game hashes names (joaat).
Parameters
string
string
The name.
Returns
number
The hash, an unsigned 32-bit number.
Remarks
Synchronous, as in RAGE MP: the hash is made by the client, with the same function the game uses.
Example
const hash = mp.game.misc.getHashKey('weather');
getHeadingFromVector2d()
getHeadingFromVector2d(dx,dy):number
The heading a 2D direction points to, as the game measures headings.
Parameters
dx
number
The direction's x.
dy
number
The direction's y.
Returns
number
The heading in degrees, from 0 to 360: 0 is north (+y), 90 west.
Remarks
Computed by the client (the same result as the game's script function), synchronously.
Example
const heading = mp.game.misc.getHeadingFromVector2d(to.x - from.x, to.y - from.y);
getHeadingFromVector2D()
getHeadingFromVector2D(dx,dy):number
The heading a 2D direction points to (the same as getHeadingFromVector2d).
Parameters
dx
number
The direction's x.
dy
number
The direction's y.
Returns
number
The heading in degrees, from 0 to 360: 0 is north (+y), 90 west.
Remarks
Computed by the client (the same result as the game's script function), synchronously.
Example
const heading = mp.game.misc.getHeadingFromVector2D(to.x - from.x, to.y - from.y);
getNextWeatherTypeHashName()
getNextWeatherTypeHashName():Promise<number>
The weather the game is changing to, as a hash of its name.
Returns
Promise<number>
A Promise of the weather's hash.
Remarks
Partial: not yet confirmed in the game.
Example
const to = await mp.game.misc.getNextWeatherTypeHashName();
getPrevWeatherTypeHashName()
getPrevWeatherTypeHashName():Promise<number>
The weather the game is changing from, as a hash of its name.
Returns
Promise<number>
A Promise of the weather's hash.
Remarks
Partial: not yet confirmed in the game.
Example
const from = await mp.game.misc.getPrevWeatherTypeHashName();
getRainLevel()
getRainLevel():Promise<number>
How hard it rains.
Returns
Promise<number>
A Promise of the rain level, a float (0 for none).
Remarks
Partial: not yet confirmed in the game.
Example
const rain = await mp.game.misc.getRainLevel();
getRandomFloatInRange()
getRandomFloatInRange(startRange,endRange):number
A random number.
Parameters
startRange
number
The smallest value.
endRange
number
The largest value.
Returns
number
A number from startRange to endRange.
Remarks
Computed by the client (the same result as the game's script function), synchronously.
Example
const f = mp.game.misc.getRandomFloatInRange(0, 1);
getRandomIntInRange()
getRandomIntInRange(startRange,endRange):number
A random integer.
Parameters
startRange
number
The smallest value.
endRange
number
The end of the range, not included.
Returns
number
An integer from startRange to endRange - 1 (startRange when the range is empty).
Remarks
Computed by the client (the same result as the game's script function), synchronously.
Example
const dice = mp.game.misc.getRandomIntInRange(1, 7);
getRandomIntInRange2()
getRandomIntInRange2(startRange,endRange):number
A random integer (the same as getRandomIntInRange).
Parameters
startRange
number
The smallest value.
endRange
number
The end of the range, not included.
Returns
number
An integer from startRange to endRange - 1 (startRange when the range is empty).
Remarks
Computed by the client (the same result as the game's script function), synchronously.
Example
const dice = mp.game.misc.getRandomIntInRange2(1, 7);
getSnowLevel()
getSnowLevel():Promise<number>
How hard it snows.
Returns
Promise<number>
A Promise of the snow level, a float (0 for none).
Remarks
Partial: not yet confirmed in the game.
Example
const snow = await mp.game.misc.getSnowLevel();
getWindSpeed()
getWindSpeed():Promise<number>
The wind speed.
Returns
Promise<number>
A Promise of the speed, a float.
Remarks
Partial: not yet confirmed in the game.
Example
const wind = await mp.game.misc.getWindSpeed();
isBitSet()
isBitSet(address,offset):boolean
Whether a bit of a 32-bit integer is set.
Parameters
address
number
The integer.
offset
number
The bit, from 0 to 31.
Returns
boolean
True when the bit is 1.
Remarks
Computed by the client (the same result as the game's script function), synchronously.
Example
const on = mp.game.misc.isBitSet(flags, 3);
isIncidentValid()
isIncidentValid(incidentId):Promise<boolean>
Whether a dispatch incident exists.
Parameters
incidentId
number
The incident, as the game numbers it.
Returns
Promise<boolean>
A Promise of true when it exists.
Remarks
Partial: not yet confirmed in the game.
Example
const valid = await mp.game.misc.isIncidentValid(incident);
isPositionOccupied()
isPositionOccupied(x,y,z,range,p4,checkVehicles,checkPeds,p7,p8,ignoreEntity,p10):Promise<boolean>
Whether something is within a distance of a point.
Parameters
x
number
The X coordinate, in metres.
y
number
The Y coordinate, in metres.
z
number
The Z coordinate, in metres.
range
number
The distance, in metres.
p4
boolean
A flag of the game, a bool.
checkVehicles
boolean
Whether vehicles count.
checkPeds
boolean
Whether peds count.
p7
boolean
A flag of the game, a bool.
p8
boolean
A flag of the game, a bool.
ignoreEntity
number | { handle: number; }
An entity that does not count, or its handle; 0 for none.
p10
boolean
A flag of the game, a bool.
Returns
Promise<boolean>
A Promise of true when something is there.
Remarks
Partial: not yet confirmed in the game.
Example
const busy = await mp.game.misc.isPositionOccupied(0, 0, 70, 2, false, true, true, false, false, 0, false);
isStringNull()
isStringNull(string):boolean
Whether a string is null or undefined.
Parameters
string
string
The string.
Returns
boolean
True when there is no string.
Remarks
Computed by the client (the same result as the game's script function), synchronously.
Example
const none = mp.game.misc.isStringNull(text);
isStringNullOrEmpty()
isStringNullOrEmpty(string):boolean
Whether a string is null, undefined or empty.
Parameters
string
string
The string.
Returns
boolean
True when there is no text.
Remarks
Computed by the client (the same result as the game's script function), synchronously.
Example
const empty = mp.game.misc.isStringNullOrEmpty(text);
pauseDeathArrestRestart()
pauseDeathArrestRestart(toggle):void
Holds the game's own restart after the local player dies or is arrested, so a script can respawn the player.
Parameters
toggle
boolean
True to hold it.
Returns
void
Remarks
Partial: in this client's game only; through a game function that is likely, not certain, to be this one; not yet confirmed in the game.
Example
mp.game.misc.pauseDeathArrestRestart(true);
populateNow()
populateNow(): void
Fills the area around the player with its usual peds and vehicles at once.
Returns
void
Remarks
Partial: in this client's game only; through a game function that is likely, not certain, to be this one; not yet confirmed in the game.
Example
mp.game.misc.populateNow();
removeDispatchSpawnBlockingArea()
removeDispatchSpawnBlockingArea(p0):void
Removes an area where the dispatch does not spawn.
Parameters
p0
number
The area, as the game numbers it.
Returns
void
Remarks
Partial: in this client's game only; not yet confirmed in the game.
Example
mp.game.misc.removeDispatchSpawnBlockingArea(area);
setFadeOutAfterDeath()
setFadeOutAfterDeath(toggle):void
Whether the screen fades out when the local player dies.
Parameters
toggle
boolean
False to keep the screen visible.
Returns
void
Remarks
Partial: in this client's game only; through a game function that is likely, not certain, to be this one; not yet confirmed in the game.
Example
mp.game.misc.setFadeOutAfterDeath(false);
setGravityLevel()
setGravityLevel(level):void
Sets the gravity level.
Parameters
level
number
The level, an integer as the game numbers it (0 is normal).
Returns
void
Remarks
Partial: in this client's game only; not yet confirmed in the game.
Example
mp.game.misc.setGravityLevel(0);
setInstancePriorityMode()
setInstancePriorityMode(p0):void
Sets which map content the game loads first.
Parameters
p0
number
The mode, as the game numbers it.
Returns
void
Remarks
Partial: in this client's game only; through a game function that is likely, not certain, to be this one; not yet confirmed in the game.
Example
mp.game.misc.setInstancePriorityMode(1);
setMissionFlag()
setMissionFlag(toggle):void
Sets the game's mission flag (whether a mission is running).
Parameters
toggle
boolean
True when a mission runs.
Returns
void
Remarks
Partial: in this client's game only; not yet confirmed in the game.
Example
mp.game.misc.setMissionFlag(true);
setRandomSeed()
setRandomSeed(seed):void
Seeds the random numbers of getRandomIntInRange and getRandomFloatInRange, so they repeat.
Parameters
seed
number
The seed.
Returns
void
Remarks
Computed by the client (the same result as the game's script function), synchronously.
Example
mp.game.misc.setRandomSeed(42);
setRandomWeatherType()
setRandomWeatherType(): void
Lets the game pick a random weather.
Returns
void
Remarks
Partial: in this client's game only; the server's world weather (mp.world) sets the weather again when it changes.
Example
mp.game.misc.setRandomWeatherType();
setRiotModeEnabled()
setRiotModeEnabled(toggle):void
Turns riot mode on or off: the peds fight each other.
Parameters
toggle
boolean
True to turn it on.
Returns
void
Remarks
Partial: in this client's game only; through a game function that is likely, not certain, to be this one; not yet confirmed in the game.
Example
mp.game.misc.setRiotModeEnabled(false);
setStuntJumpsCanTrigger()
setStuntJumpsCanTrigger(toggle):void
Lets the game's stunt jumps trigger, or not.
Parameters
toggle
boolean
True to let them trigger.
Returns
void
Remarks
Partial: in this client's game only; not yet confirmed in the game.
Example
mp.game.misc.setStuntJumpsCanTrigger(false);
setTimeScale()
setTimeScale(timeScale):void
Sets the speed the game runs at: 1 is normal, less is slow motion.
Parameters
timeScale
number
The time scale, from 0 to 1.
Returns
void
Remarks
Partial: in this client's game only; not yet confirmed in the game.
Example
mp.game.misc.setTimeScale(0.5);
setWindDirection()
setWindDirection(direction):void
Sets the direction the wind blows from.
Parameters
direction
number
The direction, a float, as the game measures it.
Returns
void
Remarks
Partial: in this client's game only; the server's world weather (mp.world) sets the weather again when it changes.
Example
mp.game.misc.setWindDirection(1.5);
setWindSpeed()
setWindSpeed(speed):void
Sets the wind speed.
Parameters
speed
number
The speed, a float.
Returns
void
Remarks
Partial: in this client's game only; the server's world weather (mp.world) sets the weather again when it changes.
Example
mp.game.misc.setWindSpeed(5);
shouldUseMetricMeasurements()
shouldUseMetricMeasurements():Promise<boolean>
Whether the game shows metric units (the player's setting).
Returns
Promise<boolean>
A Promise of true for metric units.
Remarks
Partial: not yet confirmed in the game.
Example
const metric = await mp.game.misc.shouldUseMetricMeasurements();
tan()
tan(p0):number
The tangent of an angle in degrees.
Parameters
p0
number
The angle in degrees.
Returns
number
The tangent.
Remarks
Computed by the client (the same result as the game's script function), synchronously.
Example
const t = mp.game.misc.tan(45);
waterOverrideSetStrength()
waterOverrideSetStrength(strength):void
Sets how strongly the water's waves are overridden.
Parameters
strength
number
The strength, a float (0 for none).
Returns
void
Remarks
Partial: in this client's game only; not yet confirmed in the game.
Example
mp.game.misc.waterOverrideSetStrength(0.5);