M MY Multiplayer: Wiki
Side
Kind

Scripting reference

Complete catalogue of MY Multiplayer (MYMP) Lua functions and events grouped by category, showing whether each runs on the client, server, or both.

Elements

NameSideDescription
addElementDataSubscriberServerSubscribes a player to an element data key set with the "subscribe" sync mode. The player receives the current value at once and every change after that.
createElementSharedCreates an element of a type the script makes up, with nothing in the world. It goes under the resource's dynamic element root.
destroyElementSharedDestroys an element and all of its children. Before it goes, each one fires onElementDestroy on the server or onClientElementDestroy on the client.
getAllElementDataSharedReads all of an element's data at once.
getElementAlphaSharedReads an element's alpha, from 0 (invisible) to 255 (opaque).
getElementAngularVelocitySharedReads how fast an element turns about each axis, per simulation step.
getElementBoundingBoxClientReads the collision box of an element's model, relative to the model's origin.
getElementByIDSharedFinds the first element with an ID, starting at an element and going down through its children.
getElementCastShadowClientTells whether an element casts a shadow.
getElementChildrenSharedLists an element's direct children, optionally only those of one type.
getElementChildrenCountSharedCounts an element's direct children.
getElementDataSharedReads a value stored on an element.
getElementDimensionSharedReads an element's dimension, from 0 to 65535.
getElementDistanceFromCentreOfMassToBaseOfModelClientReads the distance from an element's centre of mass to the base of its model.
getElementHealthSharedReads the health of a player, ped, vehicle or object.
getElementIDSharedReads an element's ID, the name getElementByID looks for.
getElementInteriorSharedReads the interior an element is in. Interior 0 is the outside world.
getElementMatrixSharedReads an element's 4x4 matrix, built from its position and rotation.
getElementModelSharedReads the name of an element's model.
getElementParentSharedReads an element's parent in the element tree.
getElementPositionSharedReads an element's position in the world.
getElementRadiusClientReads the radius of the collision sphere of an element's model.
getElementRotationSharedReads an element's rotation in degrees.
getElementsByTypeClientLists every element of a type below an element of the tree on this client.
getElementsByTypeServerLists every element of a type below an element of the tree on the server.
getElementsInRangeSharedLists the elements whose position is inside a sphere.
getElementSyncerServerTells which player syncs an element, that is, which client simulates it and sends its state to the server.
getElementTypeSharedReads an element's type, such as "player", "vehicle" or the type given to createElement.
getElementVelocitySharedReturns an element's velocity.
getRootElementSharedReturns the root element, the top of the element tree. It is the same value as the global root.
hasElementDataSubscriberServerTells whether a player is subscribed to an element data key.
isElementSharedTells whether a value is an element that still exists.
isElementFrozenSharedTells whether an element is frozen.
isElementInWaterClientTells whether a ped, player or vehicle is in the water.
isElementLocalClientTells whether an element was created by this client rather than by the server.
isElementOnFireSharedTells whether an element is on fire.
isElementOnScreenClientTells whether an element shows on screen.
isElementStreamableClientTells whether an element streams in and out with distance.
isElementStreamedInClientTells whether an element is loaded into this client's world.
isElementSyncerClientTells whether this client syncs a ped or vehicle for the server.
removeElementDataSharedDeletes a piece of data kept on an element.
removeElementDataSubscriberServerUnsubscribes a player from an element data key. The player stops receiving that data's changes.
setElementAlphaSharedSets the transparency of an element and of all its children.
setElementAngularVelocitySharedSets an element's turning speed.
setElementCastShadowClientTurns the shadow an element casts on or off.
setElementDataClientKeeps a piece of data on an element, on this client only.
setElementDataServerKeeps a piece of data on an element and, depending on sync, sends it to the players.
setElementDimensionSharedChanges the dimension of an element and of all its children.
setElementFrozenSharedFreezes or unfreezes an element and all its children.
setElementHealthSharedSets the health of a ped, player, vehicle or object.
setElementIDSharedGives an element an id (a name), to find it later with getElementByID.
setElementInteriorSharedChanges an element's interior.
setElementMatrixSharedPlaces and turns an element from a matrix.
setElementModelServerChanges the model of a ped or player, and of its children.
setElementOnFireClientSets an element on fire or puts it out on this client.
setElementOnFireServerSets an element and its children on fire, or puts them out, for every player.
setElementParentSharedMakes an element a child of another in the element tree.
setElementPositionSharedMoves an element to a position in the world.
setElementRotationSharedSets an element's 3D rotation in degrees.
setElementStreamableClientChooses whether an element streams in and out with distance or always stays loaded.
setElementSyncerServerChooses which player syncs a ped or vehicle.
setElementVelocitySharedSets an element's velocity.
onClientElementDataChangeClientFired when a piece of an element's data changes or is removed. Cancelling the event does not undo the change: this client's data keeps the new value.
onClientElementDestroyClientFired when an element is about to be destroyed, while it still exists.
onClientElementDimensionChangeClientFired after an element moves to another dimension. It does not fire when the dimension stays the same.
onClientElementInteriorChangeClientFired after an element moves to another interior. It does not fire when the interior stays the same.
onClientElementStreamInClientFired when an element streams in on this client and comes into the game world.
onClientElementStreamOutClientFired when an element streams out on this client and leaves the game world. The element still exists.
onElementDataChangeServerFired when a piece of an element's data changes or is removed. Cancelling the event puts the previous value back (or removes the key if it did not exist), and the change is not sent to the players.
onElementDestroyServerFired when an element is about to be destroyed, while it still exists.
onElementDimensionChangeServerFired after an element moves to another dimension. It does not fire when the dimension stays the same.
onElementInteriorChangeServerFired after an element moves to another interior. It does not fire when the interior stays the same.
onElementModelChangeServerFired after setElementModel changes an element's model. Cancelling the event puts the previous model back, and setElementModel returns false.
onElementStartSyncServerFired when a player starts syncing a ped or vehicle.
onElementStopSyncServerFired when a player stops syncing a ped or vehicle.

Attachments

NameSideDescription
attachElementsSharedHangs one element on another. From then on it follows the target until it is detached.
detachElementsSharedDetaches an element from the element it hangs on. It stays where it is.
getAttachedElementsSharedLists the elements attached directly to an element.
getElementAttachedOffsetsSharedReads the offset, rotation and socket an element is attached with.
getElementAttachedToSharedTells which element an element is attached to.
isElementAttachedSharedTells whether an element is attached to another.
setElementAttachedOffsetsSharedChanges the offset, the rotation and, if asked, the socket of an attached element.
onClientElementAttachClientFired when a client script calls attachElements, before the element is attached. Cancelling the event stops the attachment and makes attachElements return false.
onClientElementDetachClientFired before an element is detached by a client script, by detachElements or by attachElements moving it to another target. Cancelling the event keeps the element attached.
onElementAttachServerFired when the server calls attachElements, before the element is attached. Cancelling the event stops the attachment and makes attachElements return false.
onElementDetachServerFired before an element is detached on the server, by detachElements or by attachElements moving it to another target. Cancelling the event keeps the element attached.

Components and bones

NameSideDescription
getElementBoneMatrixClientReturns the world matrix of a ped's or object's bone.
getElementBonePositionClientReturns the world position of a ped's or object's bone.
getElementBoneQuaternionClientReturns the orientation of a ped's or object's bone relative to its parent bone, as a quaternion.
getElementBoneRotationClientReturns the rotation of a ped's or object's bone relative to its parent bone, in degrees.
getElementBoneScaleClientReturns the scale of a ped's or object's bone.
getElementComponentPositionClientReturns the position of a vehicle's or object's component.
getElementComponentRotationClientReturns the rotation of a vehicle's or object's component, in degrees.
getElementComponentsClientLists a vehicle's or object's components: the named frames of its model.
getElementComponentVisibleClientTells whether a vehicle's or object's component is visible.
getPedBonePositionClientReturns the world position of a ped's bone.
resetElementComponentPositionClientPuts a vehicle's or object's component back at the model's own position, undoing setElementComponentPosition.
resetElementComponentRotationClientPuts a vehicle's or object's component back at the model's own rotation, undoing setElementComponentRotation.
setElementBoneMatrixClientSets the world matrix of a ped's or object's bone: position, orientation and scale at once. The change applies on this client only.
setElementBonePositionClientMoves a ped's or object's bone to a world position, keeping its orientation. The change applies on this client only.
setElementBoneQuaternionClientSets the orientation of a ped's or object's bone relative to its parent bone, as a quaternion. The change applies on this client only.
setElementBoneRotationClientTurns a ped's or object's bone relative to its parent bone. The change applies on this client only.
setElementBoneScaleClientChanges the scale of a ped's or object's bone. The change applies on this client only.
setElementComponentPositionClientMoves a vehicle's or object's component. The change applies on this client only.
setElementComponentRotationClientTurns a vehicle's or object's component. The change applies on this client only.
setElementComponentVisibleClientShows or hides a vehicle's or object's component. The change applies on this client only.

Events

NameSideDescription
addEventSharedRegisters a new event under this name. Only then can handlers be added to it and can it be triggered.
addEventHandlerSharedMakes a function run whenever the event happens on the given element or, with propagate, on any of its descendants.
cancelEventSharedMarks the running event as cancelled. What cancelling prevents depends on the event.
cancelLatentEventClientStops a latent event this client is sending to the server. The server drops what it had received and the event is not triggered.
cancelLatentEventServerStops a latent event the server is sending to a player. The client drops what it had received and the event is not triggered there.
getCancelReasonSharedGives the reason passed to cancelEvent in the last event that finished running on this side.
getEventHandlersSharedLists the functions this resource put on an element's event with addEventHandler.
getLatentEventHandlesClientLists the latent events this client is still sending to the server.
getLatentEventHandlesServerLists the latent events the server is still sending to a player.
getLatentEventStatusClientTells how a latent event this client is sending to the server is going.
getLatentEventStatusServerTells how a latent event the server is sending to a player is going.
removeEventHandlerSharedTakes a function off an element's event, where addEventHandler put it.
triggerClientEventServerSends an event to the players' clients, which trigger it on source. The function returns before the clients receive it.
triggerEventSharedTriggers an event on this side, on source. The element's own handlers and its ancestors' propagating ones are called right away, before the function returns.
triggerLatentClientEventServerSends an event to the players' clients bit by bit, in the background, at no more than bandwidth bytes a second per player. Meant for large data that must not hold up the rest of the traffic.
triggerLatentServerEventClientSends an event to the server bit by bit, in the background, at no more than bandwidth bytes a second. Meant for large data that must not hold up the rest of the traffic.
triggerServerEventClientSends an event to the server, which triggers it on source there. The function returns before the server receives it.
wasEventCancelledSharedTells whether the last event that finished running on this side was cancelled.
onPlayerTriggerEventThresholdServerFired when a player calls triggerServerEvent or triggerLatentServerEvent too many times in an interval. The server does nothing else: what to do is up to the scripts.

Keyboard

NameSideDescription
addCommandHandlerSharedRegisters a function that runs when the command is typed in the console. The arguments arrive as space-separated strings.
bindKeySharedBinds a key to a function or a command. The function runs when the key is pressed, released or both.
executeCommandHandlerClientRuns the handlers client scripts registered for a command, as if it had been typed.
executeCommandHandlerServerRuns the handlers server scripts registered for a command, as if the player had typed it.
getBoundKeysClientLists the keys bound to a command on this client.
getCommandsBoundToKeyClientLists the commands bound to a key on this client.
getCursorPositionClientReads where the cursor is on the screen and the world point it points at.
getFunctionsBoundToKeySharedLists the functions this resource bound to a key.
getKeyBoundToCommandClientTells which key runs a command on this client.
getKeyBoundToFunctionSharedTells which key this resource bound a function to.
getKeyStateClientTells whether a key is held down right now.
isCursorShowingClientTells whether the mouse cursor is showing.
isKeyBoundSharedTells whether this resource bound a function to a key.
removeCommandHandlerSharedRemoves the handler this resource registered for a command.
setCursorAlphaClientChanges the mouse cursor's opacity.
setCursorPositionClientMoves the cursor to a point on the screen.
showCursorClientShows or hides the mouse cursor for this resource.
unbindKeySharedRemoves binds this resource made on a key.
onClientClickClientFired when a mouse button is pressed or released while the cursor is showing.
onClientCursorMoveClientFired when the mouse moves.
onClientDoubleClickClientFired when a mouse button is pressed twice in a row while the cursor is showing.
onClientKeyClientFired when a key or mouse button is pressed or released. Cancelling the event stops that key's binds and, on a press, hides the key from the game while it is held.
onPlayerCommandServerFired when a player sends a command to the server, before it runs. Cancelling the event stops the command.

Resources and modules

NameSideDescription
callSharedCalls a function another resource exports in its meta.xml and returns what it returns.
deleteResourceServerTakes a stopped resource out of the resource list and moves its folder or archive into the trash folder of the server's resource cache.
getResourceDynamicElementRootSharedReturns the element under which the elements the resource creates by script are placed. It is a child of the resource's element and is called dynamic.
getResourceExportedFunctionsSharedLists the names of the functions a resource exports in its meta.xml, on any side.
getResourceFilesSharedLists the files a resource declares with <file> in its meta.xml, with patterns already expanded, in alphabetical order.
getResourceFromNameSharedFinds a resource by name.
getResourceInfoServerReads an attribute of the <info> tag in a resource's meta.xml, such as author or version.
getResourceNameSharedReturns a resource's name.
getResourceRootElementSharedReturns a resource's root element, the same as that resource's resourceRoot global.
getResourcesSharedLists the resources running on this side.
getResourceStateSharedTells which state a resource is in.
getThisResourceSharedReturns the resource the script is running in.
importSharedRuns a resource's module in this script's Lua state, once per state, and gives back what it returned. The globals the module set become this script's.
refreshResourcesSharedReads the resources folder again: adds the new resources, removes the ones that are gone (stopping those that ran) and logs which running resources changed on disk.
restartResourceSharedAsks to stop and start again a running resource. It happens on the next resource pulse, not during the call, and the resource keeps its place in the start order.
startResourceSharedStarts a resource right away, after starting the resources it includes with <include> in its meta.xml.
stopResourceSharedAsks to stop a running resource. It stops on the next resource pulse, not during the call.
onClientResourceStartClientFired when a resource has finished starting, after its scripts have run.
onClientResourceStopClientFired when a resource is about to stop, while its scripts and elements still exist.
onResourcePreStartServerFired when a resource is starting, before its scripts run. Cancelling the event keeps the resource from starting.
onResourceStartServerFired when a resource has finished starting, after its scripts and maps have run.
onResourceStopServerFired when a resource is about to stop, while its scripts and elements still exist.

Timers and async

NameSideDescription
async.allSharedRuns every function in the list in its own thread, all at once, and makes the current thread wait until they have all ended.
async.cancelSharedStops an async thread of this resource. A paused thread ends at once; called from the thread itself, it stops right there.
async.mapSharedCalls handler(value, key) for every entry of the table, in pairs order, and gathers the results that are not nil into a list. The handler may pause with async.wait.
async.mutexSharedRuns a function in a new async thread, as async.thread does, but does not start while another thread started from the same line of code, with the same key, is still running.
async.promiseSharedRuns handler(resolve, reject) in a new thread and makes the current thread wait until it calls resolve or reject. Meant for waiting on a function that answers through a callback.
async.statusSharedTells what state an async thread of this resource is in.
async.threadSharedRuns a function in a new async thread, right away. The call returns when the function ends or first pauses, as with async.wait.
async.waitSharedPauses the current async thread for ms milliseconds. The rest of the game keeps running.
async.yieldSharedPauses the current async thread until the scripts' next update, to split long work into pieces.
getTimerDetailsSharedReads a timer's state: how long is left, how many repeats remain and its interval.
getTimersSharedLists the calling resource's active timers.
isTimerSharedTells whether a timer still exists in this resource.
killTimerSharedCancels a timer before it ends.
resetTimerSharedStarts a timer's countdown over, with the same interval. The repeats left do not change.
setTimerSharedCalls a function after an interval, once or repeatedly.
setTimerPausedSharedPauses or resumes a timer. While paused it keeps the time it had left and is not called.

Convars

NameSideDescription
getConvarSharedReads a convar as text. On a client, a convar the server syncs comes before the client's own.
getConvarIntSharedReads a convar as an integer.
setConvarClientSets a convar on this client only. It is never sent to the server. With persist, the value is kept for this server and comes back in the next session.
setConvarServerSets a convar on the server, creating it if it does not exist. With synced, the value goes to every client, including those who join later, and their getConvar reads it.

Files

NameSideDescription
fileCloseSharedCloses a file, writing what is left, and destroys its element.
fileCopySharedCopies a file, possibly from another resource, into the calling resource. Folders missing at the destination are created.
fileCreateSharedCreates an empty file and opens it for reading and writing. A file that already exists is wiped and made again; missing folders are created.
fileDeleteSharedDeletes a file of the calling resource.
fileExistsSharedTells whether a path is a file. It does the same as pathIsFile.
fileFlushSharedWrites to disk what was written to the file and is still in memory.
fileGetContentsSharedReads a whole file at once, without opening it.
fileGetPathSharedReturns an open file's path.
fileGetPosSharedReturns a file's current read and write position.
fileGetSizeSharedReturns an open file's size.
fileIsEOFSharedTells whether a file's position has reached its end.
fileOpenSharedOpens a file that already exists, with the position at its start.
fileReadSharedReads bytes from a file at the current position and moves the position on.
fileRenameSharedRenames or moves a file within the calling resource. Folders missing at the destination are created.
fileSetPosSharedChanges a file's read and write position.
fileWriteSharedWrites one or more texts to a file, at the current position.
pathIsDirectorySharedTells whether a path is a folder.
pathIsFileSharedTells whether a path is a file. It does the same as fileExists.
pathListDirSharedLists what a folder holds.

Data and utilities

NameSideDescription
decodeStringSharedDecodes or decrypts a text encodeString produced.
encodeStringSharedEncodes or encrypts a text with an algorithm: TEA, AES-128, RSA, Base64, Base32 or zlib.
fromJSONSharedTurns JSON text into a Lua value. It is the same function as json.decode.
getDistanceBetweenPoints2DSharedMeasures the distance between two points on the horizontal plane, ignoring height.
getDistanceBetweenPoints3DSharedMeasures the straight-line distance between two points in space.
getEasingValueSharedWorks out an easing curve's value at a point of the progress.
getRealTimeSharedReturns the computer's real date and time, in the local time zone.
getTickCountSharedReturns how many milliseconds have passed since scripts started running on this side.
getVersionSharedReturns information about the game's and Lua's versions.
hashSharedHashes a text: MD5, SHA-1, SHA-2 or an HMAC.
interpolateBetweenSharedInterpolates between two sets of three numbers along an easing curve.
isnanSharedTells whether a value is the special number NaN (not a number).
json.decodeSharedTurns JSON text into a Lua value. It is the same function as fromJSON.
json.encodeSharedTurns a Lua value into JSON text. It is the same function as toJSON.
rgbSharedPacks a colour's components into a single ARGB number. It is the same function as tocolor.
rgbaSharedPacks a colour's components into a single ARGB number, with the opacity from 0 to 1.
splitSharedSplits a text into pieces at the separators.
tocolorSharedPacks a colour's components into a single ARGB number. It is the same function as rgb.
toJSONSharedTurns a Lua value into JSON text. It is the same function as json.encode.

Output and debugging

NameSideDescription
createTrayNotificationClientShows a system notification in the Windows tray, while the game is not focused.
outputDebugStringSharedWrites a line to this side's script log, as an error, a warning or a message.
outputServerLogSharedWrites a message to this side's log, with the resource's name in front.
printSharedWrites the values given to the script log as a message, separated by tabs.
setClipboardClientCopies a text to the player's computer clipboard.
onClientDebugMessageClientFired on this client for every script line that goes to the log: errors, warnings and messages.
onDebugMessageServerFired on the server for every script line that goes to the log: errors, warnings and messages.

Players and accounts

NameSideDescription
getMaxPlayersServerReturns how many players the server takes at once.
getPlayerAccountServerReturns the MYMP account the player joined with.
getPlayerCountServerReturns how many players are on the server.
getPlayerFromNameServerFinds a player by exact name, case sensitive.
getPlayerIdentifierServerReturns one of the player's identifiers of a type, such as steam or discord.
getPlayerIdentifiersServerLists all of the player's identifiers, each as type:value, for example steam:110000112345678 and discord:80351110224678912.
getPlayerIPServerReturns the IP address the player is connected from, without the port.
getPlayerNameServerReturns the player's name. On a server with a server_key, it is the MYMP account name as Name#Tag.
getPlayerPingClientReturns a player's ping. For the local player, it is this client's ping to the server; for the others, what the server reported about them.
getPlayerPingServerReturns the player's ping to the server, as measured by the connection.
getPlayersServerLists every player on the server.
getQueuePriorityServerReads an account's priority in a full server's queue.
getRandomPlayerServerPicks a player on the server at random.
isPlayerSpawnedServerTells whether the player has been placed in the world by spawnPlayer.
kickPlayerServerDisconnects a player from the server with a reason.
playSoundFrontEndServerPlays a game interface sound for a player, or for every player inside an element, such as root.
setMaxPlayersServerChanges how many players the server takes at once.
setQueuePriorityServerSets an account's priority in a full server's queue. A higher priority goes first.
spawnPlayerServerPlaces the player in the world, with health at 100, no armour, in interior 0 and with no weapons.
onPlayerConnectServerFired when a connection is about to be admitted, before the player exists. Cancelling the event refuses it.
onPlayerJoinServerFired when a player has finished joining and has received the server's initial state.
onPlayerQueueServerFired when an account is about to join the queue of a full server. Cancelling the event refuses it.
onPlayerQuitServerFired when a player leaves the server, before their element is destroyed.
onPlayerSpawnServerFired after spawnPlayer spawns a player.

Peds

NameSideDescription
canPedBeKnockedOffBikeClientTells whether a ped can be knocked off a bike or motorbike in a crash.
createPedClientCreates a ped that exists on this client only.
createPedServerCreates a ped on the server, seen by every player.
getPedArmourServerGets the armour of a ped or player.
getPedBikeControlClientGets a ped's skill at riding bikes and motorbikes.
getPedCyclePowerClientGets how hard a ped pedals a bicycle.
getPedJumpPowerClientGets how strongly a ped jumps.
getPedMeleeStrengthClientGets how hard a ped hits in melee.
getPedMoveStateClientTells how a ped on foot is moving.
getPedOccupiedVehicleSharedGets the vehicle a ped or player is in.
getPedOccupiedVehicleSeatSharedGets the seat a ped or player takes in its vehicle.
getPedSimplestTaskClientGets the simplest task the ped is running right now.
getPedStrafePowerClientGets how a ped speeds up when strafing while fighting or aiming a gun.
getPedTaskClientGets the task a ped runs in a slot and all its subtasks.
getPedWeaponServerGets the weapon a ped or player is holding.
giveWeaponServerGives a weapon with ammo to a ped or player.
isPedDeadServerTells whether a ped or player is dead.
isPedDoingTaskClientTells whether a ped is running a task, in any slot and at any subtask level.
isPedDuckedSharedTells whether a ped or player is crouching.
isPedInVehicleSharedTells whether a ped or player is in a vehicle.
isPedInWaterSharedTells whether a ped or player is in the water.
isPedOnGroundSharedTells whether a ped or player is on the ground.
isPedUsingDoubleWeaponsClientTells whether a ped also holds a copy of its weapon in the left hand.
killPedTaskClientRemoves the task a ped runs in a slot.
removePedFromVehicleSharedTakes a ped or player out of its vehicle at once, with no animation.
setPedArmourServerSets the armour of a ped or player and sends it to the clients.
setPedBikeControlClientSets a ped's skill at riding bikes and motorbikes.
setPedCanBeKnockedOffBikeClientSets whether a ped can be knocked off a bike or motorbike in a crash.
setPedCyclePowerClientSets how hard a ped pedals a bicycle.
setPedDoubleWeaponsClientSets whether a ped also holds a copy of its weapon in the left hand.
setPedEnterVehicleClientMakes a ped walk to a vehicle and get in, as if the player pressed the enter key.
setPedExitVehicleClientMakes a ped get out of its vehicle through the door, with the exit animation.
setPedJumpPowerClientSets how strongly a ped jumps.
setPedMeleeStrengthClientSets how hard a ped hits in melee.
setPedStrafePowerClientSets how a ped speeds up when strafing while fighting or aiming a gun.
warpPedIntoVehicleSharedPuts a ped or player straight into a vehicle seat, with no animation.
onClientPedStepClientFired on each step of a ped or player, when the foot touches the ground.
onClientPedsProcessedClientFired every frame after peds and objects have been animated, before they are presented and drawn.

Controls

NameSideDescription
getControlStateClientTells whether one of a ped's controls is pressed, such as forwards, fire or accelerate.
getControlStateServerTells whether a player is pressing a control, going by the keys their client last sent.
getPedAnalogControlStateClientTells how far one of a ped's controls is pressed, from 0 to 1. It is meant for analog controls such as walking, steering and accelerating.
getPedCameraRotationClientTells where a ped's camera faces, in degrees. On the local player it is the game camera; on a remote player, the one that came over the network; on a ped, the one a script set.
getPedContactElementClientReturns the vehicle or object a ped is standing on.
getPedControlStateClientTells whether one of a ped's controls is pressed, such as forwards, fire or accelerate.
isControlEnabledClientTells whether one of the local player's controls is on.
isControlEnabledServerTells whether one of a player's controls is on, going by what the server sent to their client.
setControlStateClientPresses or releases one of a ped's controls as if it were a key, for example to make it walk, jump or shoot.
setControlStateServerPresses or releases one of a player's controls as if it were a key. The order goes to their client, which applies it as setControlState on the local player.
setPedAnalogControlStateClientPresses one of a ped's analog controls only partly, for example to make it walk slowly or steer gently.
setPedCameraRotationClientChanges where a ped's camera faces. On the local player it turns the game camera; on a ped it is the direction it looks and aims.
setPedControlStateClientPresses or releases one of a ped's controls as if it were a key, for example to make it walk, jump or shoot.
toggleAllControlsClientTurns all of the local player's controls on or off at once.
toggleAllControlsServerTurns all of a player's controls on or off at once. The order goes to their client.
toggleControlClientTurns one of the local player's controls on or off. A control that is off does not reach the game, even with its key held down.
toggleControlServerTurns one of a player's controls on or off. Their client stops passing that control to the game, even with its key held down.

Animations

NameSideDescription
getPedAnimationClientTells which setPedAnimation animation a ped is playing on this client.
getPedAnimationLengthClientTells the length of the animation the ped is playing, such as one from setPedAnimation.
getPedAnimationProgressClientTells how far along the animation the ped is playing is, such as one from setPedAnimation.
getPedAnimationSpeedClientTells the speed of the animation the ped is playing, such as one from setPedAnimation.
setPedAnimationClientMakes a ped play an animation from a block, or stops the animation it is playing. The animation applies on this client only.
setPedAnimationProgressClientJumps an animation the ped is playing to a point in it. Without anim, it stops the setPedAnimation animation.
setPedAnimationSpeedClientChanges the speed of an animation the ped is playing.

Appearance

NameSideDescription
addPedClothesSharedDresses a ped in a piece of clothing. The piece takes its slot and replaces whatever was in it.
getClothesVariantCountSharedCounts how many textures a piece of clothing has for a ped's model.
getPedBodyShapeSharedTells how much of a body shape a ped has.
getPedClothesSharedTells which clothes a ped wears, all of them or the one in a slot.
getPedHairColorSharedTells the colour of a ped's hair and of its highlights, if any.
getPedHeadBlendSharedTells how a ped's face blends its two parents.
getPedHeadShapeSharedTells how far a feature of a ped's face was adjusted.
getPedOverlaySharedTells which variant of an overlay a ped wears on its face.
getPedOverlayColorSharedTells the colour of an overlay the ped wears on its face.
removePedClothesSharedTakes off the piece of clothing a ped wears in a slot.
setPedBodyShapeSharedChanges a ped's body by a named shape, which enlarges the bones it declares.
setPedHairColorSharedTints a ped's hair and, if you want, its highlights.
setPedHeadBlendSharedBuilds a ped's face by blending the head and skin of two parents.
setPedHeadShapeSharedAdjusts a feature of a ped's face, such as the nose or the chin.
setPedOverlaySharedPuts an overlay on a ped's face or takes it off, such as a beard, eyebrows or make-up.
setPedOverlayColorSharedTints an overlay the ped wears on its face, by a palette row or by a colour.

Player environment

NameSideDescription
getLocalizationClientReturns the language the player is playing in, the one chosen in the launcher.
isStreamerModeClientTells whether streamer mode is on. In it, the console masks every IPv4 address it shows.
onClientStreamerModeChangeClientFired when streamer mode turns on or off.

Vehicles

NameSideDescription
addVehicleUpgradeSharedFits a tuning upgrade on a vehicle, replacing whatever is on the same slot.
createVehicleClientCreates a vehicle that exists on this client only.
createVehicleServerCreates a vehicle on the server, seen by every player.
fixVehicleSharedRepairs a vehicle completely: its health goes back to 1000 and its doors, wheels and lights to their initial state, with no dents or bullet holes.
getVehicleCompatibleUpgradesSharedReturns the tuning upgrades that fit a vehicle's model.
getVehicleControllerSharedReturns who is driving a vehicle, that is the occupant of seat 0.
getVehicleDoorOpenRatioSharedReturns how far one or more doors of a vehicle are open.
getVehicleDoorStateSharedReturns the state of one or more doors of a vehicle.
getVehicleEngineSoundClientReturns the engine and induction sounds setVehicleEngineSound put on a vehicle.
getVehicleEngineSoundsClientLists the engine sound sets the mounted packs bring.
getVehicleEngineStateSharedReturns whether a vehicle's engine is on.
getVehicleHeadLightColorSharedReturns the colour of a vehicle's headlights.
getVehicleHydraulicsSharedTells whether a vehicle has hydraulics fitted by setVehicleHydraulics.
getVehicleHydraulicsControlSharedReturns how far setVehicleHydraulicsControl told each wheel of a vehicle to rise.
getVehicleLightStateSharedReturns whether one or more lights of a vehicle are broken.
getVehicleMaxPassengersClientTells how many passengers fit in a vehicle, not counting the driver.
getVehicleMaxPassengersServerTells how many passengers fit in a vehicle, not counting the driver.
getVehicleOccupantSharedReturns the ped or player sitting in a seat of a vehicle.
getVehicleOccupantsSharedReturns every ped and player inside a vehicle.
getVehicleOverrideLightsSharedReturns whether a vehicle's lights are forced on or off.
getVehicleSuspensionHeightSharedReturns the suspension height setVehicleSuspensionHeight gave a vehicle.
getVehicleTowedByVehicleSharedReturns the trailer or vehicle this vehicle is towing.
getVehicleTowingVehicleSharedReturns the vehicle that is towing this vehicle.
getVehicleUpgradeOnSlotSharedReturns the upgrade fitted on one slot of a vehicle.
getVehicleUpgradesSharedReturns every tuning upgrade fitted on a vehicle.
getVehicleUpgradeSlotNameSharedReturns the name of an upgrade slot, from the slot's index or from an upgrade that goes on it.
getVehicleUpgradeSlotsSharedReturns the names of every upgrade slot the mounted packs declare.
getVehicleWheelCamberSharedReturns the camber of a vehicle's wheels.
getVehicleWheelFrictionStateClientTells how a vehicle's wheels are gripping the ground.
getVehicleWheelOffsetSharedReturns the offset of a vehicle's wheels.
getVehicleWheelScaleSharedReturns the radius factor of a vehicle's tyres.
getVehicleWheelStateSharedReturns the state of one or more wheels of a vehicle.
getVehicleWheelStatesSharedReturns the state of a vehicle's four wheels.
getVehicleWheelWidthSharedReturns the width factor of a vehicle's tyres.
isVehicleFullBeamSharedReturns whether a vehicle's high beams are on.
isVehicleLockedSharedReturns whether a vehicle's doors are locked.
isVehicleOnGroundSharedReturns whether a vehicle is resting on the ground.
isVehicleWheelOnGroundClientTells whether a vehicle's wheels are touching something.
removeVehicleUpgradeSharedTakes a tuning upgrade off a vehicle.
setVehicleDoorOpenRatioSharedOpens or closes one or more doors of a vehicle to a fraction, at once or over time.
setVehicleDoorStateSharedChanges the state of one or more doors of a vehicle: shut, open, damaged or missing.
setVehicleEngineSoundClientReplaces a vehicle's engine sound on this client with a sound set from the mounted packs.
setVehicleEngineStateSharedTurns a vehicle's engine on or off.
setVehicleFullBeamSharedTurns a vehicle's high beams on or off.
setVehicleHeadLightColorSharedChanges the colour of a vehicle's headlights.
setVehicleHydraulicsSharedFits or removes a vehicle's hydraulics.
setVehicleHydraulicsControlSharedRaises each wheel of a vehicle with its hydraulics, with nobody at the controls.
setVehicleLightStateSharedBreaks or repairs one or more lights of a vehicle.
setVehicleLockedSharedLocks or unlocks a vehicle's doors.
setVehicleOverrideLightsSharedForces a vehicle's lights on or off, or hands the choice back to the game.
setVehicleSuspensionHeightSharedRaises or lowers a vehicle's suspension.
setVehicleWheelCamberSharedTilts a vehicle's wheels in or out (camber).
setVehicleWheelOffsetSharedMoves a vehicle's wheels away from where the model places them.
setVehicleWheelScaleSharedMakes a vehicle's tyres bigger or smaller in radius.
setVehicleWheelStateSharedChanges the state of one or more wheels of a vehicle: inflated, flat, fallen off or without collision.
setVehicleWheelStatesSharedChanges the state of a vehicle's four wheels at once.
setVehicleWheelWidthSharedWidens or narrows a vehicle's tyres.
onClientPedVehicleEnterClientFired on the client when a ped (not a player) has finished getting into a vehicle.
onClientPedVehicleExitClientFired on the client when a ped (not a player) leaves a vehicle.
onClientPlayerVehicleEnterClientFired on the client when a player has finished getting into a vehicle.
onClientPlayerVehicleExitClientFired on the client when a player leaves a vehicle.
onClientTrailerAttachClientFired on the client when a trailer is hitched to a vehicle.
onClientTrailerDetachClientFired on the client when a trailer is unhitched from the vehicle towing it.
onClientVehicleEnterClientFired on the client when a ped has finished getting into a vehicle.
onClientVehicleExitClientFired on the client when a ped leaves a vehicle.
onClientVehicleStartEnterClientFired on the client when a ped starts getting into a vehicle. Cancelling the event stops it.
onClientVehicleStartExitClientFired on the client when a ped starts getting out of a vehicle. Cancelling the event stops it.
onPedVehicleEnterServerFired on the server when a ped (not a player) has finished getting into a vehicle.
onPedVehicleExitServerFired on the server when a ped (not a player) leaves a vehicle.
onPlayerVehicleEnterServerFired on the server when a player has finished getting into a vehicle.
onPlayerVehicleExitServerFired on the server when a player leaves a vehicle.
onTrailerAttachServerFired on the server when a trailer is hitched to a vehicle. Cancelling the event unhitches the trailer.
onTrailerDetachServerFired on the server when a trailer is unhitched from the vehicle towing it.
onVehicleEnterServerFired on the server when a ped has finished getting into a vehicle.
onVehicleExitServerFired on the server when a ped leaves a vehicle.
onVehicleStartEnterServerFired on the server when a ped starts getting into a vehicle. Cancelling the event stops it.
onVehicleStartExitServerFired on the server when a ped starts getting out of a vehicle or is about to be pulled out. Cancelling the event stops it.

Vehicle looks

NameSideDescription
areVehicleLightTrailsEnabledClientTells whether a vehicle leaves light trails behind its tail lamps.
getVehicleDirtColorSharedTells the colour of the dirt on a vehicle's paint.
getVehicleDirtLevelSharedTells how much dirt shows on a vehicle's paint.
getVehicleNeonColorSharedTells the colour of a vehicle's neon.
getVehicleNeonPowerSharedTells the brightness of a vehicle's neon.
getVehicleNeonStripsSharedLists the neon strips a vehicle's model has.
getVehicleWetnessLevelSharedTells how wet a vehicle was fixed to look.
isVehicleBackfireEnabledClientTells whether a vehicle lets out flames from its exhaust by itself.
isVehicleNeonEnabledSharedTells whether a vehicle's neon strips are on.
resetVehicleDirtColorSharedPuts a vehicle's dirt back to the default colour, 59, 57, 52.
resetVehicleWetnessLevelSharedMakes a vehicle get wet with the rain again, undoing setVehicleWetnessLevel.
setVehicleBackfireEnabledClientTurns on or off the flames that come out of a vehicle's exhaust by themselves when lifting off the throttle at high revs or shifting up.
setVehicleDirtColorSharedChanges the colour of the dirt on a vehicle's paint, such as mud or sand.
setVehicleDirtLevelSharedChanges how much dirt shows on a vehicle's paint.
setVehicleLightTrailsEnabledClientTurns on or off red light trails behind a vehicle's lit tail lamps, longer the faster it goes.
setVehicleNeonColorSharedChanges the colour of a vehicle's neon. The colour applies to every strip.
setVehicleNeonEnabledSharedTurns neon strips under a vehicle on or off.
setVehicleNeonPowerSharedChanges the brightness of a vehicle's neon.
setVehicleWetnessLevelSharedFixes how wet a vehicle looks, instead of following the rain.
triggerVehicleBackfireClientMakes a small flame come out of each of a vehicle's exhausts, once.

Handling

NameSideDescription
getModelHandlingServerReads a vehicle model's handling, which new vehicles of that model start with.
getOriginalHandlingClientReads a vehicle model's original handling, as the game loaded it, without any script's changes.
getOriginalHandlingServerReads a vehicle model's original handling, as the content packs declare it, without any script's changes.
getVehicleHandlingSharedReads a vehicle's handling: its mass, engine, traction, suspension and the rest of what decides how it drives.
setModelHandlingServerChanges a property of a vehicle model's handling, which new vehicles of that model start with.
setVehicleHandlingClientChanges a vehicle's handling on this client only.
setVehicleHandlingServerChanges a vehicle's handling for every player.

World and weather

NameSideDescription
createFireClientStarts a fire at a point, on this client only. It burns for 5 seconds.
createLadderClientCreates a ladder peds can climb, on this client only.
extinguishFireClientPuts out the fires within a radius of a point. Without arguments, it puts out every fire on this client.
getCloudsDensityClientReturns how much of the sky the clouds cover: the value setCloudsDensity set or, without it, the clouds' current one.
getFarClipDistanceClientReturns how far the world is being drawn right now.
getFiresInRangeClientLists the fires burning near a point. The distance is measured on the horizontal plane only.
getFogDistanceClientReturns how far the fog starts: the value setFogDistance set or, without it, the time cycle's.
getGroundPositionClientFinds the ground right below a point, up to 1000 m down. Only buildings and objects count.
getMinuteDurationClientReturns how much real time one game minute lasts on this client.
getMoonColorClientReturns the colour of the moon in use: the one setMoonColor set or, without it, the time cycle's.
getMoonSizeClientReturns the size of the moon's disc: the one setMoonSize set or, without it, the time cycle's.
getScreenFromWorldPositionClientProjects a world point onto the screen, with the current frame's camera.
getSkyColorClientReturns the sky gradient setSkyColor set.
getSunColorClientReturns the colour of the sun in use: the one setSunColor set or, without it, the time cycle's.
getSunSizeClientReturns the size of the sun's disc: the one setSunSize set or, without it, the time cycle's.
getTimeClientReturns the game time on this client.
getWeatherClientReturns this client's current weather. During a blend, it is the weather being blended to.
getWeatherNamesClientLists the weathers the loaded packs declare.
getWorldFromScreenPositionClientTurns a screen point, at a depth, into a world point, with the current frame's camera.
isLineOfSightClearClientTells whether nothing blocks the segment between two points. Only buildings and objects block it, not vehicles or peds.
isTimeFrozenClientTells whether the game clock is frozen on this client.
processLineOfSightClientCasts a ray between two points and returns the first thing it hits.
resetCloudsDensityClientUndoes setCloudsDensity: the cloud coverage follows the time cycle again.
resetFarClipDistanceClientUndoes setFarClipDistance: the draw distance follows the time cycle again.
resetFogDistanceClientUndoes setFogDistance: the fog follows the time cycle again.
resetMoonColorClientUndoes setMoonColor: the moon's colour follows the time cycle again.
resetMoonSizeClientUndoes setMoonSize: the moon's size follows the time cycle again.
resetSkyColorClientUndoes setSkyColor: the sky follows the time cycle again.
resetSunColorClientUndoes setSunColor: the sun's colour follows the time cycle again.
resetSunSizeClientUndoes setSunSize: the sun's size follows the time cycle again.
setCloudsDensityClientChanges how much of the sky the clouds cover, over the time cycle, until resetCloudsDensity restores it.
setFarClipDistanceClientChanges how far from the camera the world is drawn, over the time cycle, until resetFarClipDistance restores it.
setFogDistanceClientChanges how far from the camera the fog starts, over the time cycle, until resetFogDistance restores it.
setMinuteDurationClientSets how much real time one game minute lasts on this client.
setMoonColorClientChanges the colour of the moon, over the time cycle, until resetMoonColor restores it.
setMoonSizeClientChanges the size of the moon's disc in the sky, over the time cycle, until resetMoonSize restores it.
setSkyColorClientPaints the sky with a gradient from the top to the horizon, over the time cycle, until resetSkyColor restores it.
setSunColorClientChanges the colour of the sun, over the time cycle, until resetSunColor restores it.
setSunSizeClientChanges the size of the sun's disc in the sky, over the time cycle, until resetSunSize restores it.
setTimeClientChanges the game time on this client. The clock keeps running from there.
setTimeFrozenClientFreezes or unfreezes the game clock on this client. While frozen the time does not advance, but setTime still changes it.
setWeatherClientChanges this client's weather, at once or over a blend.

Objects

NameSideDescription
breakObjectSharedBreaks a breakable object at once.
createObjectClientCreates an object that exists on this client only.
createObjectServerCreates an object every player sees.
getObjectScaleSharedReturns an object's scale along each axis.
moveObjectSharedMoves an object smoothly to a position, turning it along the way.
setObjectBreakableSharedSets whether a breakable object can be broken. An object that cannot is immune to any damage.
setObjectScaleSharedChanges an object's size, evenly or along each axis.
stopObjectSharedStops an object's movement wherever it is.
onClientObjectMoveStartClientFired on this client when an object starts a moveObject movement, whether this client or the server made it.
onClientObjectMoveStopClientFired on this client when an object's movement ends: it arrived, stopObject stopped it or a new moveObject took over.

Collision shapes

NameSideDescription
createColCircleSharedCreates a circular collision shape with no height limit.
createColCuboidSharedCreates a box-shaped collision shape, aligned with the world's axes.
createColPolygonSharedCreates a collision shape shaped like a flat polygon, with no height limit until setColPolygonHeight gives it one.
createColRectangleSharedCreates a rectangular collision shape, aligned with the world's axes and with no height limit.
createColSphereSharedCreates a spherical collision shape.
createColTubeSharedCreates a collision shape shaped like an upright cylinder.
getColPolygonHeightSharedReturns between which heights a collision polygon detects elements.
getColShapeTypeSharedTells what shape a collision shape has.
getElementsWithinColShapeSharedLists the elements inside a collision shape.
isElementWithinColShapeSharedTells whether an element is inside a collision shape.
setColPolygonHeightSharedLimits between which heights a collision polygon detects elements.
onClientColShapeHitClientFired when a player, ped, vehicle or object enters a collision shape on this client.
onClientColShapeLeaveClientFired when a player, ped, vehicle or object leaves a collision shape on this client.
onClientElementColShapeHitClientFired on a player, ped, vehicle or object when it enters a collision shape on this client.
onClientElementColShapeLeaveClientFired on a player, ped, vehicle or object when it leaves a collision shape on this client.
onColShapeHitServerFired when a player, ped, vehicle or object enters a collision shape.
onColShapeLeaveServerFired when a player, ped, vehicle or object leaves a collision shape.
onElementColShapeHitServerFired on a player, ped, vehicle or object when it enters a collision shape.
onElementColShapeLeaveServerFired on a player, ped, vehicle or object when it leaves a collision shape.

Roads and paths

NameSideDescription
arePathNodesLoadedClientTells whether the path nodes of an area are loaded yet.
calculatePathRouteClientWorks out the shortest route along the path nodes between two points, starting from the node closest to each. For cars, it respects one-way streets.
getClosestPathNodeClientFinds the road or footpath node closest to a point.
getClosestStraightRoadClientFinds the stretch of road closest to a point: two linked car nodes and the heading between them. Switched-off nodes are left out.
getNthClosestPathNodeClientFinds the nth road or footpath node closest to a point.
getParkingNodeInAreaClientFinds a parking node inside a box. Each call returns the next one in the box, going back to the first at the end.
getPathNodeInfoClientReturns what is known about a path node.
getPathNodeNeighboursClientLists the nodes linked to a path node and what each link is like.
getPathNodePositionClientReturns a path node's position.
getPathNodesInRadiusClientLists the road or footpath nodes within a radius.
getRoadDensityClientMeasures how much road there is around a point: the lanes times the length of the car links starting within 80 m of it, scaled down.
getSafePedSpawnPositionClientPicks a random spot on a footpath near a point where a ped can appear, the way SA chooses where to create peds. The spot is on the ground.
releasePathNodesClientDrops the requestPathNodesInArea request. The areas far from the player can be unloaded again.
requestPathNodesInAreaClientAsks for the path nodes of an area to be loaded beyond those near the player. The area stays loaded until releasePathNodes.

Camera

NameSideDescription
attachCameraToElementClientAttaches the camera to an element: it follows the element's position and rotation until setCameraTarget gives it back to a ped.
fadeCameraClientFades the screen out to a colour or back in.
getCameraMatrixClientReturns where the camera is and where it looks.
getCameraTargetClientReturns the player or ped the camera is following.
setCameraMatrixClientFixes the camera at a point, looking at another, until setCameraTarget gives it back to a ped.
setCameraTargetClientMakes the camera follow a player or ped, as in normal play. It also undoes setCameraMatrix and attachCameraToElement.

Cinematics

NameSideDescription
castCinematicActorClientHas an actor played with the look and element data of a ped, player or vehicle of the session. It applies from the next playback.
createCinematicClientCreates a cinematic element, empty or from a saved cinematic. It belongs to the resource that created it and exists on this client only.
getCinematicActorClientReturns the local element (ped or vehicle) that plays an actor in the current playback.
getCinematicActorPoseClientReturns where an actor stands at a cinematic time. It needs no playback.
getCinematicActorsClientLists the cinematic's actors: the recorded ones and the placed ones.
getCinematicAdjustmentsClientReturns the shifts and animations laid over an actor's take.
getCinematicAudioClientReturns the cinematic's sounds.
getCinematicCameraClientReturns the cinematic's camera shots.
getCinematicCaptionsClientReturns the cinematic's captions.
getCinematicDataClientReturns the whole cinematic as .cine bytes, which createCinematic reads back.
getCinematicDurationClientReturns how long the cinematic lasts.
getCinematicPositionClientReturns which cinematic time the playback is at.
getCinematicShotViewClientReturns where a shot's camera stands and what it looks at, at a cinematic time, shake included.
getCinematicWorldClientReturns the cinematic's weather, hour and fade keys.
isCinematicPausedClientTells whether the cinematic's playback is paused.
playCinematicClientPlays the cinematic: the actors as local clones, plus the camera, weather, hour, fade, sounds and captions.
removeCinematicActorClientTakes an actor, with its take, out of the cinematic.
setCinematicActorTimingClientPlaces an actor's take in the cinematic's time, trims the part shown and sets its speed. Outside that part the actor leaves the scene.
setCinematicAdjustmentsClientLays shifts and animations over an actor's take. The take stays as recorded and moves with them. It replaces the actor's earlier adjustments.
setCinematicAudioClientSets the sounds the cinematic plays during playback. It replaces the earlier sounds.
setCinematicCameraClientSets the camera shots the cinematic directs during playback. It replaces the earlier shots.
setCinematicCameraEnabledClientTurns the cinematic's camera on or off. While off, playback does not move the camera and the shots of setCinematicCamera are ignored.
setCinematicCaptionsClientSets the captions the cinematic draws on screen during playback. It replaces the earlier captions.
setCinematicDurationClientFixes the cinematic's duration. Playback ends when it gets there.
setCinematicPausedClientPauses or resumes the cinematic's playback. While paused, the clones hold their animations, vehicles freeze and sounds pause.
setCinematicPositionClientJumps the playback to another time of the cinematic. The clones are kept; each is set back on its sample and in or out of its vehicle as its take has it.
setCinematicPropClientPlaces a vehicle or object that stands still over a part of the cinematic, or changes one already placed.
setCinematicWorldClientSets the weather, hour and screen fade keys the cinematic applies during playback. It replaces the earlier keys.
startCinematicRecordingClientStarts recording a ped, player or vehicle as an actor of the cinematic. Called again while it records, it adds another actor to the same recording.
stopCinematicClientStops the cinematic's playback. The clones go away and the weather, hour and fade go back to what the world had.
stopCinematicRecordingClientStops the cinematic's recording. The other actors that were playing during the recording stop too.
onClientCinematicFinishClientFired when a cinematic's playback reaches its end by itself.

Screen drawing

NameSideDescription
dxConvertPixelsClientConverts an image held in a string to another format, in the background, and hands the result to a function.
dxCreateFontClientCreates a font from a font file in the resource, for the text functions.
dxCreateRenderTargetClientCreates a render target: an image the dx functions can draw into and that can be used like any other image.
dxCreateScreenSourceClientCreates a screen source: an image that receives a copy of the game's screen on each dxUpdateScreenSource.
dxDrawCircleClientDraws a filled circle, or a slice of one, on the screen for one frame.
dxDrawImageClientDraws an image on the screen for one frame.
dxDrawImageSectionClientDraws part of an image on the screen for one frame.
dxDrawLineClientDraws a 2D line on the screen for one frame.
dxDrawLine3DClientDraws a line in the 3D world for one frame. The line faces the camera.
dxDrawMaterialLine3DClientDraws an image stretched along a line in the 3D world for one frame.
dxDrawMaterialPrimitiveClientDraws a 2D primitive with an image on the screen for one frame.
dxDrawMaterialPrimitive3DClientDraws a primitive with an image in the 3D world for one frame.
dxDrawMaterialSectionLine3DClientDraws part of an image stretched along a line in the 3D world for one frame.
dxDrawPrimitiveClientDraws a 2D primitive (points, lines or triangles) on the screen for one frame.
dxDrawRectangleClientDraws a filled rectangle on the screen for one frame.
dxDrawTextClientDraws text on the screen for one frame, inside a box.
dxGetBlendModeClientReturns the blend mode of the 2D dx functions.
dxGetFontHeightClientReturns the height of one line of text in a font.
dxGetMaterialSizeClientReturns the size of an image in pixels.
dxGetPixelColorClientReads the colour of one pixel of a plain image.
dxGetPixelsFormatClientDetects the format of an image held in a string.
dxGetPixelsSizeClientReturns the width and height of an image held in a string (plain, png, jpeg or dds).
dxGetStatusClientReturns information about the video card and the video memory used by scripts.
dxGetTextSizeClientMeasures the width and height a text takes on the screen.
dxGetTexturePixelsClientReads an image's pixels and hands them to a function, a few frames later.
dxGetTextWidthClientMeasures how wide a text is on the screen, at its widest line.
dxSetBlendModeClientChooses how the next 2D dx functions mix with what is already drawn.
dxSetPixelColorClientChanges the colour of one pixel of a plain image, in the string itself.
dxSetRenderTargetClientChooses where the next dx functions draw: into a render target or, without one, on the screen.
dxSetTextureEdgeClientChooses what an image shows when it is read outside its edges.
dxSetTexturePixelsClientWrites pixels into a texture made by a script or into a render target.
dxUpdateScreenSourceClientCopies the game's screen into a screen source.
getScreenSizeClientReturns the size of the game's screen in pixels.
onClientHUDRenderClientFired every frame, right before onClientRender.
onClientPreRenderClientFired every frame, after the world is simulated and before the world is drawn.
onClientRenderClientFired every frame, when that frame's dx drawing should be done.

Web interface

NameSideDescription
createDuiClientOpens a web page off screen, with a transparent background, and gives it back as an image that can be drawn.
drawDuiClientDraws a dui on the screen for one frame, in coordinates relative to the screen.
isDuiReadyClientTells whether a dui's page has finished loading.
isNuiFocusedClientTells whether any interface page has focus.
registerNuiCallbackClientRegisters a function the calling resource's interface page calls with a fetch to /name on its own address.
sendDuiMessageClientSends a message to a dui's page. The page receives it in the window's message event.
sendDuiMouseButtonClientPresses or releases a mouse button over a dui's page.
sendDuiMouseMoveClientMoves the mouse pointer over a dui's page.
sendDuiMouseWheelClientScrolls a dui's page with the mouse wheel.
sendNuiMessageClientSends a message to the interface page of the calling resource. The page receives it in the window's message event.
setDuiUrlClientTakes a dui to another address.
setNuiFocusClientGives or takes focus from the calling resource's interface page. With focus, the page gets the mouse and the keyboard.
setNuiKeepInputClientChooses whether the game keeps getting the mouse and the keyboard while an interface page has focus.

Lights

NameSideDescription
createPointLightClientCreates a light that shines in every direction from a point. The light exists on this client only.
createRectLightClientCreates a light that comes from a rectangle, like a panel or a lit window. The light exists on this client only.
createSpotLightClientCreates a light that shines inside a cone, like a spotlight. The light exists on this client only.
dxDrawPointLightClientLights a point in every direction for a single frame, without creating an element.
dxDrawRectLightClientLights from a rectangle for a single frame, without creating an element.
dxDrawSpotLightClientLights a cone for a single frame, without creating an element.
getLightBarnDoorClientReads a rect light's barn doors.
getLightCastShadowClientTells whether a light casts shadows.
getLightColorClientReads a light's colour.
getLightConeClientReads the opening and the edge hardness of a spot light's cone.
getLightDirectionClientReads where a spot or rect light points.
getLightFalloffClientReads a light's fade exponent.
getLightIntensityClientReads a light's brightness.
getLightRadiusClientReads a light's range.
getLightSizeClientReads a rect light's width and height.
getLightSourceRadiusClientReads the size of a spot light's bulb.
getLightTangentClientReads where a rect light's width points.
getLightTypeClientTells a light's type.
isLightEnabledClientTells whether a light is on.
setLightBarnDoorClientChanges a rect light's barn doors, which limit where the light leaves the rectangle.
setLightCastShadowClientTurns a light's shadows on or off.
setLightColorClientChanges a light's colour.
setLightConeClientChanges the opening and the edge hardness of a spot light's cone.
setLightDirectionClientChanges where a spot or rect light points.
setLightEnabledClientTurns a light on or off without destroying it.
setLightFalloffClientChanges how a light fades toward the end of its range.
setLightIntensityClientChanges a light's brightness.
setLightRadiusClientChanges a light's range.
setLightSizeClientChanges a rect light's width and height.
setLightSourceRadiusClientChanges the size of a spot light's bulb. A larger bulb makes highlights and shadows softer.
setLightTangentClientChanges where a rect light's width points, turning the rectangle about its normal.

Effects

NameSideDescription
createEffectSharedCreates a particle effect in the world. On the server every client sees it; on a client, only that client does.
engineAddEffectsClientRegisters the particle effects in a file of the resource, so createEffect can use them by name.
engineGetEffectsClientLists the particle effects loaded on this client.
engineRemoveEffectsClientRemoves the effects this resource added from a file with engineAddEffects.
getEffectColorSharedReads an effect's colour.
getEffectEvolutionSharedReads the level of one of an effect's evolutions.
getEffectScaleSharedReads an effect's size.
setEffectColorSharedTints an effect with a colour.
setEffectEvolutionSharedChanges the level of one of an effect's evolutions, a parameter the effect itself declares to vary its look.
setEffectScaleSharedChanges an effect's size.
stopEffectSharedStops an effect: it stops emitting and the particles already out finish.

Textures

NameSideDescription
engineCreateTextureClientCreates a texture from an image file in the resource or from image bytes in memory. The texture exists on this client only.
engineCreateTxdClientCreates an empty texture dictionary under a name. Fill it with engineSetTxdTexture. It exists on this client only.
engineGetModelTxdsClientLists the txds a model takes its textures from, in the order it searches them.
engineGetTxdsClientLists every texture dictionary this client knows, with where each one comes from.
engineGetTxdTextureClientGives a texture element that shows what a txd shows under a texture name, to draw it or use it as a source.
engineGetTxdTexturesClientLists the names of the textures a txd gives, links included.
engineIsAssetLoadedClientTells whether an asset a script made is ready to use.
engineLoadTxdClientLoads a texture dictionary (.ktd) from a resource file under a name. It exists on this client only.
engineRestoreElementTextureClientRemoves the texture swaps this resource set on one element with engineSetElementTexture.
engineRestoreModelTextureClientRemoves the texture swaps this resource set on a model with engineSetModelTexture.
engineRestoreModelTxdClientTakes away the txds this resource put in front of a model with engineSetModelTxd.
engineRestoreTxdTextureClientRemoves the links this resource made in a txd with engineSetTxdTexture, so it gives its own textures again.
engineRestoreTxdTextureSamplingClientRemoves the sampling override this resource set on a txd's texture with engineSetTxdTextureSampling.
engineRestoreWorldTextureClientRemoves the world texture swaps this resource set with engineSetWorldTexture.
engineSetElementTextureClientSwaps a texture on one vehicle, ped, player or object alone. Other instances of the same model keep their textures.
engineSetModelTextureClientSwaps a texture on every instance of a model. Only that model's materials change, not the txd the texture comes from.
engineSetModelTxdClientPuts a txd in front of a model's own, so the model finds its textures there first and falls back to its own for the rest.
engineSetTxdTextureClientPuts an image in a txd under a texture name, replacing the texture of that name or adding a new one. Everything that reads the txd follows: models, peds, landscapes, roads, particles, water and sky.
engineSetTxdTextureSamplingClientOverrides how the world samples a txd's texture: what happens past its edges and how it is filtered. It takes the place of the material's own addressing.
engineSetWorldTextureClientSwaps a texture on every model of the chosen kinds that uses it. Only the models' materials change, not the txd the texture comes from.
onClientAssetLoadClientFired once when an asset a script started loading in the background is ready, or has failed.

Materials and shaders

NameSideDescription
engineAddPostProcessClientTurns on a post process on the screen: a material whose shader is #type post.
engineCreateMaterialClientCreates a material: a shader with parameter values, which then replaces or overlays the materials of models.
engineCreateShaderClientCreates a shader from a .shader file or from its source text. The shader compiles in the background.
engineGetElementStencilClientGives the stencil value a vehicle, ped or object is marked with.
engineGetMaterialAlphaClipClientGives whether the material cuts pixels out by their alpha, and below which alpha.
engineGetMaterialParametersClientLists the parameters of the shader a material uses.
engineGetMaterialShaderClientGives the shader a material uses.
engineGetMaterialSwitchesClientLists the static switches of a material's shader, with the value each one has in it.
engineGetMaterialValueClientReads a value the material sets: a parameter, a static switch or a TARGET_n output.
engineGetModelMaterialsClientLists the loaded model's materials, in the order the model keeps them.
engineGetModelStencilClientGives the stencil value a model is marked with.
engineGetPostImageClientGives the image a post process step produces, to draw it or use it in another material.
engineGetShaderErrorsClientLists the errors from the last compile of a shader made with engineCreateShader.
engineGetShaderGlobalClientReads a shader global's current value.
engineGetShaderGlobalsClientLists every shader global, from packs and scripts.
engineGetShaderParametersClientLists the parameters a shader or preset declares.
engineGetShaderQualityClientGives this client's current material quality.
engineGetShadersClientLists every loaded shader and preset, from packs and scripts.
engineGetShaderSwitchesClientLists the static switches (bool parameters) of a shader or preset, with each one's default.
engineRemovePostProcessClientTurns off a post process this resource turned on with engineAddPostProcess.
engineResetMaterialValueClientDrops a value the material set, or all of them, going back to what its base gives.
engineResetShaderGlobalClientDrops the value this resource gave a shader global, so the global goes back to the next one's value.
engineRestoreElementMaterialClientUndoes what this resource's engineSetElementMaterial did of a single vehicle, ped or object.
engineRestoreElementOverlayClientUndoes what this resource's engineSetElementOverlay did of a single vehicle, ped or object.
engineRestoreElementStencilClientRemoves the stencil mark this resource set with engineSetElementStencil.
engineRestoreModelMaterialClientUndoes what this resource's engineSetModelMaterial did of every instance of a model.
engineRestoreModelOverlayClientUndoes what this resource's engineSetModelOverlay did of every instance of a model.
engineRestoreModelStencilClientRemoves the stencil mark this resource set with engineSetModelStencil.
engineRestoreWorldMaterialClientUndoes what this resource's engineSetWorldMaterial did of every model in the world.
engineRestoreWorldOverlayClientUndoes what this resource's engineSetWorldOverlay did of every model in the world.
engineSetElementMaterialClientReplaces the chosen materials of a single vehicle, ped or object with a material.
engineSetElementOverlayClientDraws a material as an extra layer over the chosen materials of a single vehicle, ped or object.
engineSetElementStencilClientMarks a vehicle, ped or object with a stencil value, which post shaders read for outlines, highlights and similar effects.
engineSetMaterialAlphaClipClientMakes the material cut out pixels whose alpha is below a threshold, or stop cutting out.
engineSetMaterialShaderClientChanges a material's shader, keeping the values it already has.
engineSetMaterialValueClientSets a material's value: a shader parameter, a static switch or the render target of a TARGET_n output.
engineSetModelMaterialClientReplaces the chosen materials of every instance of a model with a material.
engineSetModelOverlayClientDraws a material as an extra layer over the chosen materials of every instance of a model.
engineSetModelStencilClientMarks every instance of a model with a stencil value, which post shaders read for outlines, highlights and similar effects.
engineSetShaderGlobalClientSets a shader global, a value every shader reads. A new name creates the global.
engineSetShaderQualityClientChanges this client's material quality. Shaders that read QUALITY are compiled for the new level.
engineSetWorldMaterialClientReplaces the chosen materials of every model in the world with a material.
engineSetWorldOverlayClientDraws a material as an extra layer over the chosen materials of every model in the world.

Models

NameSideDescription
engineCreateModelClientMakes a new model under a name, on this client only. It is used by its name, like any other model.
engineGetModelsClientLists the models this client knows, with where each comes from.
engineLoadColClientLoads a collision file (.kbn) from the resource so it can be given to a model.
engineLoadDrawableClientLoads a drawable (.kdr) from a resource file so it can be given to a model.
engineRestoreModelColClientTakes away the collision this resource gave a model with engineSetModelCol, so it collides as it did before.
engineRestoreModelDrawableClientTakes away the drawable this resource gave a model with engineSetModelDrawable, so it draws what it drew before.
engineSetModelColClientMakes a model collide with a collision loaded with engineLoadCol instead of its own.
engineSetModelDrawableClientMakes a model draw a drawable loaded with engineLoadDrawable instead of its own.

Graphics settings

NameSideDescription
engineGetAmbientOcclusionClientReturns how many samples ambient occlusion takes.
engineGetAntiAliasingClientReturns the anti-aliasing in use.
engineGetBloomClientReturns how many blur levels bloom uses.
engineGetCloudsClientReturns how clouds are drawn.
engineGetDecalsClientReturns how many decals can exist at once and how long they last.
engineGetLocalLightShadowsClientTells whether local lights cast shadows.
engineGetMotionBlurClientTells whether motion blur is on.
engineGetParticleDensityClientReturns the fraction of effect particles that are emitted.
engineGetParticleScaleClientReturns the fraction of the resolution particles are drawn at.
engineGetReflectionsClientReturns the reflection settings.
engineGetRenderResolutionClientReturns the size in pixels the scene is rendered at and the size of the final image in the window.
engineGetRenderScaleClientReturns the fraction of the window's resolution the 3D scene is rendered at.
engineGetShadowsClientReturns the sun's shadow settings.
engineGetSharpnessClientReturns how much the final image is sharpened.
engineGetSunShaftsClientReturns the fraction of the resolution sun shafts are computed at.
engineGetVolumetricFogClientTells whether volumetric fog is on.
engineHasCollisionLoadedAtClientTells whether the world around a point is solid yet: its collision, buildings and landscapes loaded.
engineHasModelLoadedClientTells whether a model is loaded in memory.
engineReleaseModelClientDrops the model request this resource made with engineRequestModel.
engineRequestCollisionAtClientAsks for the collision around a point to be loaded. The request stays until it has finished loading.
engineRequestModelClientAsks the streamer to load a model and keeps it loaded for this resource until it is released.
engineSetAmbientOcclusionClientSets how many samples ambient occlusion takes. More samples darken corners and crevices more precisely.
engineSetAntiAliasingClientChooses the image's anti-aliasing.
engineSetBloomClientSets how many blur levels bloom uses. More levels spread the glow further.
engineSetCloudsClientChooses how clouds are drawn.
engineSetDecalsClientSets how many decals (bullet holes, blood, tyre marks) can exist at once and how long they last.
engineSetLocalLightShadowsClientTurns the shadows of local lights (point, spot and rect lights) on or off.
engineSetMotionBlurClientTurns motion blur on or off. It starts on on PC.
engineSetParticleDensityClientSets the fraction of effect particles that are emitted. The rest are dropped at random.
engineSetParticleScaleClientSets the fraction of the resolution particles are drawn at.
engineSetReflectionsClientSets up reflections: the size of the environment probe and the screen-space reflections.
engineSetRenderScaleClientSets the fraction of the window's resolution the 3D scene is rendered at. The image is then scaled up to the window's size.
engineSetShadowsClientSets up the sun's shadows: how many cascades, their resolution and whether their edges are soft.
engineSetSharpnessClientSets how much the final image is sharpened.
engineSetSunShaftsClientSets the fraction of the resolution sun shafts are computed at, or turns them off.
engineSetVolumetricFogClientTurns volumetric fog on or off. It starts off.

Sound

NameSideDescription
engineAddSoundClientRegisters an audio file under a name, which playSound and playSound3D then play by that name.
engineGetSoundsClientLists the named sounds in effect now: the game's, the packs' and the resources'.
engineRemoveSoundClientRemoves a sound this resource registered with engineAddSound. If another registration of the same name exists, it takes over again.
getSFXStatusClientTells whether a GTA San Andreas audio container is available to playSFX and playSFX3D.
getSoundBPMClientDetects the sound's tempo in beats per minute, rounded down.
getSoundBufferLengthClientKept for MTA compatibility, where it gives the buffer length of an internet stream.
getSoundEffectParametersClientReturns the current parameters of an audio effect that is on, on a sound or a player's voice.
getSoundEffectsClientLists the audio effects of a sound or a player's voice and tells which are on.
getSoundFFTDataClientReturns the frequency spectrum of what the sound is playing right now, for building visualisers.
getSoundLengthSharedReturns the sound's length.
getSoundLevelDataClientReturns the peak level of each channel over the sound's last 20 ms.
getSoundMaxDistanceSharedReturns the distance at which a 3D sound goes silent.
getSoundMetaTagsClientReads the audio file's tags (MP3's ID3, OGG's and FLAC's comments, WAV's INFO).
getSoundMinDistanceSharedReturns how far a 3D sound plays at full volume.
getSoundPanClientReturns the pan of a sound with no position.
getSoundPositionSharedReturns the point in the track the sound is playing.
getSoundPropertiesClientReturns a sound's sample rate, tempo and pitch, and whether it plays backwards.
getSoundSpeakerClientReturns the ped who speaks a sound.
getSoundSpeedSharedReturns a sound's speed.
getSoundVolumeSharedReturns a sound's volume, not counting how it falls with distance.
getSoundWaveDataClientReturns the waveform of what the sound just played, for drawing oscilloscopes.
isShowSoundEnabledClientTells whether showSound is on.
isSoundLoopedSharedTells whether a sound plays again when it reaches its end.
isSoundPanningEnabledClientTells whether a 3D sound has stereo panning on.
isSoundPausedSharedTells whether a sound is paused.
isWorldSoundEnabledClientTells whether a world sound, or a group of them, is on.
playSFXClientPlays a sound from GTA San Andreas's audio banks, with no position in the world.
playSFX3DClientPlays a sound from GTA San Andreas's audio banks at a position in the world.
playSoundClientPlays a sound with no position in the world, on this client only. Fires onClientSoundStarted with the reason play.
playSoundServerCreates a sound with no position in the world that every client plays together. Changes made to it on the server reach everyone.
playSound3DClientPlays a sound at a position in the world, on this client only. Its volume falls with distance between setSoundMinDistance (5 m) and setSoundMaxDistance (20 m). Fires onClientSoundStarted with play.
playSound3DServerCreates a sound at a position in the world that every client plays together. Changes made to it on the server reach everyone.
playSoundFrontEndClientPlays one of GTA San Andreas's interface sounds, such as the menu and mission ones.
resetWorldSoundsClientTurns back on every world sound turned off with setWorldSoundEnabled.
setSoundEffectEnabledClientTurns an audio effect on or off on a sound or a player's voice. When turned on, the effect starts with its default parameters.
setSoundEffectParameterClientChanges a parameter of an audio effect that is on, on a sound or a player's voice.
setSoundLoopedSharedTurns looping on or off for a sound. On the server, the change is sent to every client.
setSoundMaxDistanceSharedSets the distance at which a 3D sound goes silent. The default is 20 m. On the server, the change is sent to every client.
setSoundMinDistanceSharedSets how far a 3D sound plays at full volume. The default is 5 m. On the server, the change is sent to every client.
setSoundPanClientMoves a sound with no position towards the left or the right.
setSoundPanningEnabledClientTurns stereo panning on or off for a 3D sound. When on, the sound leans left or right depending on the camera. It starts on.
setSoundPausedSharedPauses or resumes a sound. On the server, the change is sent to every client.
setSoundPositionSharedJumps to a point in the track. The value is kept between 0 and the sound's length. On the server, the change is sent to every client.
setSoundPropertiesClientChanges a sound's sample rate, tempo and pitch, and whether it plays backwards.
setSoundSpeakerClientHas a ped speak a sound: its mouth moves with the sound's level and, if the sound is 3D, it comes from the ped's head every frame.
setSoundSpeedSharedChanges a sound's speed. The pitch changes with it. On the server, the change is sent to every client.
setSoundVolumeSharedChanges a sound's volume. On a 3D sound, it still falls with distance. On the server, the change is sent to every client.
setWorldSoundEnabledClientTurns the game world's sounds (footsteps, gunfire, collisions and more) on or off by group or one by one.
showSoundClientWrites the group and index of every world sound that plays to the debug console. Works only in development mode.
stopSoundClientStops a sound this client created and destroys the element. Fires onClientSoundStopped with the reason destroyed.
stopSoundServerStops a sound the server created and destroys the element on every client.
onClientSoundStartedClientFired when a sound starts playing on this client or leaves a pause.
onClientSoundStoppedClientFired when a sound stops playing on this client: paused, stopped or finished.
onClientWorldSoundClientFired when the game is about to play a world sound. Cancelling the event keeps the sound from playing.

Voice

NameSideDescription
addPlayerToVoiceChannelServerPuts a player in a voice channel. From then on they hear and are heard by the others in the channel.
createVoiceChannelServerCreates a voice channel. Players only hear each other through the channels they are in.
deleteVoiceChannelServerDestroys a voice channel. The players who were in it stop hearing each other through it.
isPlayerTalkingClientTells whether a player is speaking on voice chat, as this client sees it.
isPlayerTalkingServerTells whether a player is speaking on voice chat.
removePlayerFromVoiceChannelServerTakes a player out of a voice channel.
setPlayerDeafInVoiceChannelServerDeafens a player in a voice channel: the others still hear them, but they hear nobody through that channel.
setPlayerMutedInVoiceChannelServerMutes a player in a voice channel: they still hear the channel, but nobody hears them through it.
setPlayerVoiceIgnoreFromServerMakes a player stop hearing the voice of certain elements, in every channel.
onClientPlayerVoiceStartClientFired on this client when a player starts speaking on voice chat: the local player when they press the talk key, or another player when their voice arrives.
onClientPlayerVoiceStopClientFired on this client when a player stops speaking on voice chat.
onPlayerVoiceStartServerFired when a player starts speaking on voice chat. Cancelling the event makes nobody hear that speech.
onPlayerVoiceStopServerFired when a player stops speaking on voice chat.

Server

NameSideDescription
getDevelopmentModeClientTells whether development mode is on on this client.
getServerIPServerReturns the machine's public IPv4 address, read from its network interfaces at start.
getServerNameServerReturns the server's name, from the server_name convar.
getServerPasswordServerReturns the password a player has to give to join.
setDevelopmentModeClientTurns development mode on or off on this client. While it is on, the showcol and showsound console commands draw the collision shapes and the world sounds.
setServerPasswordServerChanges the password to join the server. Players already in stay.
shutdownServerShuts the server down. It fires onShutdown first.
onShutdownServerFired when a script calls shutdown, right before the server shuts down.

Database

NameSideDescription
dbConnectServerOpens a connection to an SQLite or MySQL database. Queries run on the connection's own thread.
dbExecServerRuns an SQL statement without waiting for an answer.
dbFreeServerDiscards a dbQuery query whose answer will not be read.
dbPollServerReads the answer of a dbQuery query, waiting for it if needed.
dbPrepareStringServerFills an SQL's placeholders with escaped values, without running it.
dbQueryServerSends an SQL query whose answer is read later with dbPoll.

Network and HTTP

NameSideDescription
fetchRemoteServerMakes an HTTP or HTTPS request and hands the response to a function when it arrives.
getServerIpClientReturns the address of the server this client is connected to.