- Documentation
- Client functions
Client functions
Functions available in type="client" scripts. They run in each player's game separately: drawing, keys, interface.
Shared functions work here too. For example setTimer and getElementPosition are in Shared functions.
New functions and events! 4
createNewLays an image on the ground - a track, a stain or a place marker. The image follows slopes and kerbs instead of hanging flat above them. It is drawn up to 150 m from the camera, and with a lifetime set the last second fades out smoothly. The decal stays until destroyGroundDecal or until the resource stops.Ground Decal destroyNewRemoves a decal made with createGroundDecal.Ground Decal setNewChanges the colour of a decal made with createGroundDecal.Ground Decal Color getNewFinds a San Andreas map model without collision that the segment passes through: graffiti, car wash brushes, meshes with transparency.World Model On Line processLineOfSightdoes not see such models because it passes through them. When the segment crosses several of them, the smallest one wins (e.g. graffiti on a building wall). Models with collision are skipped, sinceprocessLineOfSightfinds those. The result fitsremoveWorldModeldirectly.
Audio 9
getReturns the sound's balance between speakers (-1 to 1).Sound Pan getReturns the world point where a 3D sound plays.Sound Position3 D getElementPositionon the sound returns the same.isChecks whether the game's in-vehicle radio is on.Radio Enabled isChecks whether a sound loops.Sound Looped playPlays a built-in game interface sound by number (menu clicks, purchase, checkpoint and so on). Numbers 0-30 are gameplay sounds, 31-39 are menu sounds. The numbering is our own, because the Definitive Edition has a different set of sounds than the old San Andreas.Sound Front End setTurns the game's in-vehicle radio on or off. Off gives silence instead of GTA stations, for example for your own radio viaRadio Enabled playSound. From the server:setPlayerRadioEnabled.setSets whether a sound loops. The simplest way is to set it on creation:Sound Looped playSound(file, true).setSets the sound's balance between speakers:Sound Pan -1left,0centre,1right.setMoves a 3D sound to a new point in the world.Sound Position3 D setElementPositionon the sound does the same.
Blips 1
Browser 45
canChecks whether the browser history has a previous page.Browser Navigate Back canChecks whether the browser history has a next page.Browser Navigate Forward createCreates a browser: an HTML page rendered into a texture. Draw it withBrowser dxDrawImageand load the address only in theonClientBrowserCreatedevent.evaluateRuns JavaScript on a local page and returns its result to Lua. If the code returns a Promise, the function waits for it.Browser Javascript executeRuns JavaScript on the page. Works on local browsers only.Browser Javascript focusGives the keyboard to a browser. Typing goes to the page when one of its text fields is active and the cursor is shown.Browser nilremoves focus from all browsers.getReturns how many times per second the page is redrawn.Browser Frame Rate getReturns the opacity of a page pixel. Useful for letting clicks on transparent parts of a HUD go through to the game.Browser Pixel Alpha getReturns a browser property.Browser Property "mobile"(phone view) is supported.getReturns every browser created by scripts.Browsers getReturns the browser settings chosen by the player (ESC, Settings, Browser).Browser Settings getReturns the browser size in pixels.Browser Size getFetches the HTML of the current page and passes it to a function.Browser Source getReturns the page title (fromBrowser Title <title>).getReturns the page's current address.Browser URL getReturns one browser's volume or, with no argument, the volume of all browsers.Browser Volume getReturns the page zoom (Browser Zoom 1is 100%).injectTypes text into the page's active field, character by character (Browser Character keypress/inputevents), including accented letters and other UTF-8 characters.injectSends a key press or release to the page (e.g. Enter, Backspace, arrows), as if the player pressed it on the keyboard. The page gets normalBrowser Key keydown/keyupevents. UseinjectBrowserCharacterto type text.injectPresses a mouse button on the page at the position of the lastBrowser Mouse Down injectBrowserMouseMove. Two presses at the same spot within 0.5 s reach the page as a double click, three as a triple click (paragraph selection), like in Windows.injectMoves the mouse cursor on the page.Browser Mouse Move injectReleases a mouse button on the page.Browser Mouse Up injectScrolls the page with the mouse wheel. Negative values scroll down and right.Browser Mouse Wheel isChecks whether a domain (or address) is unavailable to web browsers: because of the blacklist, missing player consent or disabled remote pages.Browser Domain Blocked isChecks whether the browser has keyboard focus.Browser Focused isChecks whether pages are drawn by the graphics card.Browser GPUEnabled isChecks whether the page is still loading.Browser Loading isChecks whether the browser is local (resource files) rather than remote (internet).Browser Local isChecks whether page rendering is paused.Browser Rendering Paused isChecks whether the game can create browsers.Browser Supported loadLoads an address in the browser. A local browser opens resource files, a remote one opens pages from allowed domains.Browser URL navigateGoes to the previous page in the history.Browser Back navigateGoes to the next page in the history.Browser Forward reloadReloads the current page.Browser Page requestAsks the player for permission to open pages from the given domains. A domain must be on the server's list (Browser Domains browser_domainsinserver-config.json); others are rejected without asking. Consent is remembered.resizeChanges the browser size.Browser setAnswers page requests to a path from Lua, e.g.Browser Ajax Handler fetch("http://trilogy/local/api"). The function returns the response body and optionally a MIME type. With no function the handler is removed.setSets how many times per second the page redraws (1-240, default 60). Fewer frames mean less CPU work, for example for a HUD that rarely changes; more frames give smoother animations on monitors above 60 Hz.Browser Frame Rate setExposes a Lua function to a local page. In JavaScript you call it withBrowser Function await trilogy.call("name", ...)and get its result.setSets a browser property.Browser Property "mobile"is supported:"1"turns on the phone view.setPauses or resumes page rendering. A paused page does not load the CPU while it is hidden.Browser Rendering Paused setSets the volume of one browser or, when you pass just a number, of all browsers.Browser Volume setSets the page zoom (0.25-5,Browser Zoom 1is 100%).toggleOpens or closes the page's developer tools. RequiresBrowser Dev Tools setDevelopmentMode(true, true)and"browser_devtools": trueinserver-config.json.triggerSends an event from Lua to a local page. In JavaScript you receive it withBrowser Event trilogy.on("name", fn), without building code in a string.
Camera 13
getReturns the player's camera element, e.g. for attaching other elements or data.Camera getReturns whether the camera clips objects and vehicles (theCamera Clip setCameraClipsetting).getReturns the camera sway level (0-255).Camera Drunk Level getReturns the field of view stored withCamera Field Of View setCameraFieldOfView.getReturns the camera filter:Camera Goggle Effect "normal","nightvision"or"thermalvision".getReturns the current in-vehicle camera view, read from the game:Camera View Mode 0= bumper (view from inside),1= close,2= medium,3= far. It also reflects a view change made by the player with the key.resetStops the camera shake.Shake Camera setStores whether the camera should clip objects and vehicles.Camera Clip setSways the camera as when drunk in the game (0 = none, 255 = strongest). At higher levels the ped controls also lag slightly.Camera Drunk Level setStores the camera field of view (10-120 degrees).Camera Field Of View setTurns on a game image filter: night vision (a green, brightened image) or thermal vision (warm peds and vehicles in red, the rest in blue).Camera Goggle Effect "normal"turns the filter off. It is the same effect as the goggles in the game.setChanges the in-vehicle camera view, like the view change key in the game:Camera View Mode 0= bumper (view from inside),1= close,2= medium,3= far. The player can still change the view with the key afterwards.shakeShakes the camera for a moment, e.g. on an explosion. Strength 0-255.Camera
Chat and console 1
Clothes 3
getReturns the model names the game has for a clothing part.Clothes Models getReturns the list of clothes and tattoos the game knows: a part ->Clothes Table { nazwa, tatuaz, modele }table and their count. Useful for a clothes shop.getReturns what the game actually put on the local ped: a part ->Worn Clothes "texture|model"table. Useful to check whether clothing from the server arrived.
Collision shapes 3
createCreates a client box zone centred at (x, y, z), rotated around the vertical axis - more convenient thanCol Box createColCuboidwhen a building stands at an angle.createCreates a client cube zone centred at (x, y, z) with the given side length.Col Cube getReturns all collision zones created by scripts on this client.Col Shapes
Cursor 5
getReturns the cursor alpha (0-255).Cursor Alpha getReturns the current cursor shape: the name set withCursor Type setCursorType, or the shape the cursor took by itself over a browser.setSets the in-game cursor alpha (0 = invisible, 255 = opaque). The cursor shown withCursor Alpha showCursoris drawn by the game, above the HUD, GUI and browsers, so the alpha also shows on screenshots.setSwaps the game cursor for your own image: a PNG file from the resource or a texture fromCursor Image dxCreateTextureordxCreateRenderTarget. Calling it with no argument or withfalsereturns to the built-in cursor.setChanges the game cursor shape. Without an argument the cursor goes back to changing shape by itself: over a link in a browser it turns into a hand, over a text field into an I-beam.Cursor Type
Discord 10
resetClears everything scripts have set in the player's Discord status (texts, images, times, party, buttons, own application) and restores the default Trilogy Hub status: "Playing on: server name / As nickname". The status is also cleared automatically when the player connects, disconnects or leaves.Discord Rich Presence Data setSwitches the player's Discord status to your server's own Discord application (the Application ID from the Discord Developer Portal). The status then shows your server's name instead of "Trilogy Hub", and you can use your own images from that application's Rich Presence → Art Assets tab. Changing the application requires reconnecting to Discord, so previously set images are cleared. An empty string goes back to the Trilogy Hub application.Discord Application ID setSets the large image in the player's Discord status and the caption shown when hovering over it. The image is the key (name) of artwork uploaded in the Discord Developer Portal to the application set withDiscord Rich Presence Asset setDiscordApplicationID. Without your own application Trilogy Hub shows its logo. An empty key removes the script-set image.setAdds a link button under the player's Discord status, e.g. "Join our Discord" or "Server website". There can be two buttons (number 1 and 2). Discord shows the buttons to other people viewing the player's profile, not to the player themselves. An empty label removes the button.Discord Rich Presence Button setSets the top line of the player's Discord "Playing" status (rich presence), e.g. "On police duty" or "Race: Grove Street". The status is shown by the Trilogy Hub launcher, so it works when the player has the Discord app running on their computer. Changes reach Discord at most once every 15 seconds (Discord's limit), so more frequent calls are merged and the latest value is shown. An empty string restores the default text "Playing on: server name".Discord Rich Presence Details setSets the "remaining" timer in the Discord status: Discord counts down to the given moment (e.g. the end of a round). Pass a Unix timestamp in seconds. 0 turns the countdown off.Discord Rich Presence End Time setSets the party size in the Discord status, shown as "(2 of 4)", e.g. the number of people in a team or mission. By default the launcher shows the server's player count; 0, 0 restores that. The size must be at least 1 and no more than the maximum.Discord Rich Presence Party Size setSets the small round image in the corner of the large Discord status image, e.g. a faction or rank icon, with a hover caption. The image must be in the Art Assets of the application set withDiscord Rich Presence Small Asset setDiscordApplicationID. An empty key removes it.setSets the "elapsed" timer in the Discord status: Discord counts time from the given moment (e.g. the start of a mission or a shift). Pass the time as a Unix timestamp in seconds, e.g. fromDiscord Rich Presence Start Time getRealTime().timestamp. 0 restores the timer counting from when the player joined the game.setSets the bottom line of the player's Discord status, usually what they are doing right now (e.g. "Patrolling Idlewood", "On the map: 12/32 players"). It works likeDiscord Rich Presence State setDiscordRichPresenceDetails: through the launcher, with at most one change every 15 seconds. An empty string restores the default "As nickname".
Drawing (dx) 91
attachAttaches the camera to an element (a vehicle, a player, a ped, an object, a model object). The position and target are in metres in the element's frame (x right, y forward, z up); the target defaults to 10 m in front of the camera. A rear-view mirror is a camera at the back of the car looking backwards plusCamera Render setCameraRenderMirrored.createCreates a second camera that renders the world into a texture: a car mirror, CCTV, a screen showing a drone view. Draw the texture withCamera Render dxDrawImage,dxDrawMaterialLine3Dor pass it to a shader. Size 16-2048 pixels, 0-60 shots per second (0 = only on request withrenderCameraMatrix/updateCameraRender). Every shot is an extra scene render, so it costs performance.createNewLays an image on the ground - a track, a stain or a place marker. The image follows slopes and kerbs instead of hanging flat above them. It is drawn up to 150 m from the camera, and with a lifetime set the last second fades out smoothly. The decal stays until destroyGroundDecal or until the resource stops.Ground Decal createCreates a recording from AVI (MJPEG) data: fromRecording From Data getRecordingData, a file or another player.createCreates a recording player that is a texture: you draw it like any texture, also in the world withRecording Player dxDrawMaterialLine3D. The recording can be deleted afterwards; the player keeps its own frames.destroyNewRemoves a decal made with createGroundDecal.Ground Decal detachDetaches the camera from an element; it stays at the spot of the last shot.Camera Render dxConverts pixels to another format:Convert Pixels plain,pngorjpeg(with quality 1-100).dxCreates a font from a resource TTF/OTF file or from a system typeface (pass its name). The size is in points. Pass the font toCreate Font dxDrawTextandguiSetFont.dxCreates an off-screen drawing surface. AfterCreate Render Target dxSetRenderTarget(rt)everydxDraw*draws on it, and then you draw it like a texture. Without an alpha channel every pixel is opaque.dxCreates a screen source of a given size.Create Screen Source dxUpdateScreenSourcewrites the game image into it (scaled), which you then draw or process with a shader.dxCreates a texture: from a resource image file, from pixels (Create Texture plain,png,jpeg,dds) or an empty one of a given size. The texture is a material fordxDrawImage,dxDrawMaterial*3Dand shaders.dxDraws a rectangle with a fill and a border of a given thickness in one call.Draw Bordered Rectangle dxDraws a circle, an ellipse or a pie slice with centre (x, y) and a radius in pixels. The short form takes just a colour as the fourth argument.Draw Circle dxDraws a rectangle with a vertical blend from the top colour to the bottom one.Draw Gradient Rectangle dxDraws an image (a resource PNG/JPG file, a texture, a render target, a browser or a camera) in a screen rectangle, with optional rotation and tint.Draw Image dxDraws a section of an image (u, v, section width and height in image pixels) in a screen rectangle. Useful for icon sheets and progress bars.Draw Image Section dxDraws a line between two screen points.Draw Line dxDraws a line between two world points: projects them onto the screen and joins them. It only draws when both ends are on screen and is not hidden by buildings.Draw Line3 D dxDraws a material (an image, a texture, a browser, a camera or a shader) as a strip in the 3D world: from the start point (top of the image) to the end, with a given width. The strip faces the camera or theDraw Material Line3 D faceX, faceY, faceZpoint. The drawing is part of the world: buildings hide it and it glows (a screen is visible at night). This is how you make a billboard, a cinema screen or a sign above a building.dxDraws a triangle shape in the 3D world covered with a material. Vertices areDraw Material Primitive3 D {x, y, z, color, u, v}, where u and v (0-1) tell which image point lands on the vertex. The colour of the whole shape comes from the first vertex.dxLikeDraw Material Section Line3 D dxDrawMaterialLine3D, but draws only a section of the material (u, v, section width and height in pixels).dxDraws a game object model at a spot for one frame: without collision, hidden by the world. It does not work for peds and vehicles. The first frame of a new model waits until the game loads it. At most 64 objects at once.Draw Model3 D dxDraws a 2D shape from a list ofDraw Primitive {x, y [, color]}vertices: points, lines or triangles. The colour is blended smoothly between vertices.dxDraws a shape made of triangles in the 3D world fromDraw Primitive3 D {x, y, z, color}vertices. The whole shape has the colour of the first vertex.dxDraws a filled rectangle on the screen for one frame. Call it inDraw Rectangle onClientRenderto keep it visible.dxDraws a rectangle with rounded corners. The radius is in pixels and never exceeds half of the shorter side.Draw Rounded Rectangle dxDraws text on the screen for one frame. Call it inDraw Text onClientRenderto keep it visible.dxDraws a wire sphere in the world (for debugging, e.g. a zone range). It is drawn on the screen, so it shows through walls.Draw Wired Sphere dxReturns the mode set withGet Blend Mode dxSetBlendMode("blend"by default).dxReturns the font set withGet Default Font dxSetDefaultFontin this resource or"default".dxReturns the current resource'sGet Draw Priority dxSetDrawPrioritysetting:"overHud"(the default) or"underHud".dxReturns the height of one line of text in pixels for a scale and a font.Get Font Height dxReturns a font description: the typeface (Get Font Info family), the size in pixels (px) and points (size), style settings and the source.dxReturns the names of the built-in fonts:Get Font List default,default-bold,clear,arial,sans,pricedown,bankgothic,diploma,beckett,unifont,inter,inter-medium,inter-semibold,inter-bold.dxReturns the width and height of a material: a texture, a render target, a browser or a shader.Get Material Size dxReturns the colour of pixel (x, y) from pixels inGet Pixel Color plainformat.dxTells which format pixels are in:Get Pixels Format "plain","png","jpeg","dds"orfalse.dxReturns the width and height of an image stored in pixels (any format).Get Pixels Size dxReturns the drawing state: the test mode, the resolution, the number of script textures, render targets and screen sources, and texture memory. Useful for finding texture leaks.Get Status dxReturns the width and height of a block of text, also when wrapped to a given width.Get Text Size dxReads the pixels of a texture, a render target or a screen source inGet Texture Pixels plain,pngorjpegformat, whole or from a section (x, y, width, height). For example for a screenshot.dxReturns the width of text in pixels for a given scale and font (like inGet Text Width dxDrawText). Useful for centring and boxes fitted to text.dxReturns the size of a resource image file in pixels, without creating a texture.Image Size dxReturns the setting fromIs Aspect Ratio Adjustment Enabled dxSetAspectRatioAdjustmentEnabled.dxTurns on drawing aspect ratio correction on wide screens. The value is stored for compatibility with existing scripts (Set Aspect Ratio Adjustment Enabled dxIsAspectRatioAdjustmentEnabled) but does not change drawing; compute positions fromguiGetScreenSize.dxSets the colour blending mode for drawing (Set Blend Mode blend,add,modulate_add,overwrite). The value is stored for compatibility with existing scripts (dxGetBlendMode), but drawing always uses normal blending.dxSets the fontSet Default Font dxDrawTextuses when none is given, only in the current resource.nilrestores the default.dxSets whether the resource's normal 2D drawings (Set Draw Priority dxDrawRectangle,dxDrawText,dxDrawImage,dxDrawLineand others withoutpostGUI) are drawn above the game HUD and radar ("overHud", the default) or below them ("underHud"). The setting applies to the resource's nextdxDraw*calls and stays until changed; every resource has its own. You can switch inside oneonClientRender: some drawings below the HUD, some above it. Drawings withpostGUI = trueare always on top of everything.dxChanges the style of a font fromSet Font Style dxCreateFont:bold,italic,underline,strike,weight,spacing,widthScale,shadow,outline,outlineColor,gradient,lineSpacing,size. Pass one key or a table.dxSets the colour of pixel (x, y) inSet Pixel Color plainpixels and changes the passed string. Images smaller than 4x4 are rejected.dxSets where theSet Render Target dxDraw*functions draw: on a render target (optionally clearing it first) or, without an argument, on the screen. It only works inonClientRenderandonClientPreRender; after the event drawing goes back to the screen.dxTurns on a test mode to check that a script handles failures:Set Test Mode "no_mem"(creating textures fails),"low_mem"(no effect),"no_shader"(dxCreateShaderfails),"none"(off).dxSets what a texture shows outside its image in sections (Set Texture Edge dxDrawImageSection): repeat (wrap), mirror (mirror), stretched edge (clamp) or a border colour (border).dxWrites pixels (Set Texture Pixels plain,png,jpeg) into a texture or a render target, whole or into a section.dxRefreshes a screen source with the game image (without the script overlay). The image arrives 1-2 frames later.Update Screen Source getReturns the element the camera is attached to.Camera Render Attached To getReturns the camera's current brightness multiplier and whether it is automatic.Camera Render Exposure getReturns the set number of shots per second (Camera Render Frame Rate getCameraRenderInfogives the measured one).getReturns the camera state:Camera Render Info state, the number of frames in the texture (frames), measured shots per second (fps), whether the image arrives (ready), whether the attached element disappeared (attachLost) and an error (error).getReturns the camera placement: x, y, z, the target, roll and field of view. For a camera attached to an element it gives the spot of the last shot.Camera Render Matrix getReturns the camera view distance in metres (0 = like the game).Camera Render View Distance getReturns the whole recording as an AVI (MJPEG) file in a string, e.g. forRecording Data fileWrite, sending to the server orcreateRecordingFromData.getReturns the pixels of one recording frame (number from 1) inRecording Frame jpeg(default),pngorplainformat, e.g. fordxCreateTextureor saving a photo.getReturns recording information: whether it runs (Recording Info recording), the frame count, frames per second, the length in ms (duration), the image size, the data size in bytes (size) and the stop reason (stopReason).getReturns the player position and the recording length in milliseconds.Recording Player Position getReturns the occlusion check state: whether it is on (World Point Occlusion Info enabled), whether the game answers (available), the number of checks (checks), the queue (queue) and stored points (cached).isChecks whether the recording is still running (it stops by itself after the maximum time, a memory limit or when the camera is removed).Camera Recording isChecks whether a value is a working camera fromCamera Render createCameraRender.isChecks whether the camera image is mirrored.Camera Render Mirrored isChecks whether the player is playing (not paused and not at the end without a loop).Recording Player Playing isChecks whetherWorld Point Occlusion Enabled isWorldPointVisiblechecks occlusion.isChecks whether a world point is on screen and not hidden by a building or terrain. Occlusion is checked in the background, so the result for a new point arrives after a moment. For 3D labels and markers that should not show through walls.World Point Visible loadLoads a recording from a resource AVI (MJPEG) file.Recording renderTakes one shot from the given spot (likeCamera Matrix setCameraRenderMatrixandupdateCameraRenderat once). The image appears in the texture 1-2 frames later; it also works at 0 shots per second.saveSaves a recording to an AVI file in the resource (overwrites an existing one, likeRecording fileCreate).setHides an element only in this camera's image, e.g. your own car in the mirror or the player holding a phone. The element's shadow stays. Up to 64 elements per camera.Camera Render Element Hidden setSets the camera image brightness:Camera Render Exposure "auto"(default, picks a 0.5-4 multiplier from the frame brightness like a camera) or a fixed 0.05-16 multiplier. The camera image has lifted shadows so it looks similar to the game at night.setSets how many shots per second the camera takes (0-60; 0 = only on request).Camera Render Frame Rate setPlaces the camera likeCamera Render Matrix setCameraMatrix: the position, the point it looks at, roll and field of view (5-170, 70 by default). It detaches the camera from an element.setMirrors the camera image horizontally (a mirror). Also applies to recordings from this camera.Camera Render Mirrored setSets the camera view distance in metres (0 = like the game). A shorter distance means a cheaper render, e.g. for a mirror.Camera Render View Distance setNewChanges the colour of a decal made with createGroundDecal.Ground Decal Color setTurns looped playback on or off.Recording Player Looped setPauses or resumes a player. Resuming after the end starts from the beginning.Recording Player Paused setSeeks the player to a given millisecond of the recording.Recording Player Position setSets the playback speed 0-16 (1 = normal, 0.5 = slow motion).Recording Player Speed setTurns occlusion checks inWorld Point Occlusion isWorldPointVisibleon or off (false= points visible through walls, for debugging).startRecords the image of a camera fromCamera Recording createCameraRenderinto memory (no sound). Returns a recording element. 1-60 frames per second, up to 600 seconds, JPEG quality 1-100. The camera should take at least as many shots per second as the recording, otherwise frames repeat.stopStops recording. The recording stays available for playback and saving. ReturnsCamera Recording falseif it was no longer recording.updateRequests one camera shot in the next frame (the image is in the texture 1-2 frames later).Camera Render
Effects 21
createCreates a persistent game particle effect (e.g. smoke, fire, a fountain) at a point in the world.Effect destroyRemoves an effect created byEffect createEffect.fxA one-shot particle effect: blood (a splash in a direction).Add Blood fxA one-shot particle effect: a bullet impact (smoke and sparks).Add Bullet Impact fxA one-shot particle effect: a splash from a shot into water.Add Bullet Splash fxA one-shot particle effect: debris.Add Debris fxA one-shot particle effect: a footstep splash.Add Foot Splash fxA one-shot particle effect: glass shards.Add Glass fxA one-shot particle effect: a muzzle flash.Add Gunshot fxA one-shot particle effect: a punch impact.Add Punch Impact fxA one-shot particle effect: sparks.Add Sparks fxA one-shot particle effect: a tank shot.Add Tank Fire fxA one-shot particle effect: a tyre burst.Add Tyre Burst fxA one-shot particle effect: a hydrant water jet.Add Water Hydrant fxA one-shot particle effect: a water splash.Add Water Splash fxA one-shot particle effect: wood splinters.Add Wood fxCreates particles with a given colour, size and lifetime.Create Particle getReturns the effect's particle density.Effect Density getReturns the effect speed.Effect Speed setSets the effect's particle density (0-2, 1 by default).Effect Density setSets the effect speed (1 by default).Effect Speed
Elements 14
getReturns a ped bone's position in the world.Element Bone Position getReturns the box surrounding the element's model, relative to its centre.Element Bounding Box getReturns the distance from the element's centre of mass to the bottom of its model. Useful for placing elements on the ground.Element Distance From Centre Of Mass To Base Of Model getReturns the glow set withElement Highlight setElementHighlight.getReturns how strongly the element is lit (0 dark, 1 bright).Element Lighting isChecks whether two elements can collide.Element Collidable With isChecks whether an element exists only for this player (created by a client script, unknown to the server).Element Local isChecks whether an element is visible on the player's screen.Element On Screen isChecks whether an element may disappear when the player moves away (streaming).Element Streamable isChecks whether an element is loaded for this player.Element Streamed In isChecks whether the local player computes the element's physics.Element Syncer isChecks whether an element is waiting for the ground below to load (it is held in the air meanwhile).Element Waiting For Ground To Load setTurns collision between two elements on or off, only for this player and both ways. Handy for a ghost mode: your car passes through other players' cars but still hits walls, barrels and the rest of the map.Element Collidable With setTints an element's whole model with a glow colour for this player only: an NPC, a player (including your own character), a vehicle or an object. Called withElement Highlight falseinstead of a colour it removes the glow.
Events 1
Game engine 82
callCalls a game script command by number and returns the result and variables. Developer mode only; it returnsGame Command falsefor players.createCreates a preview of an element (a vehicle, a player, a ped, an object, a model object) as an image forElement Preview dxDrawImage, e.g. for a car shop or a wardrobe.falseas the target = the scene from the camera. By default the camera orbits the target so that it fits in the frame.createPlaces a model fromMesh Object engineLoadMeshin the world, only for this player: position, rotation and scale. Control the object with thesetMeshObject*functions.destroyRemoves a preview fromElement Preview createElementPreview.destroyRemoves a model object from the world.Mesh Object engineFrees a model fromFree Mesh engineLoadMesh; objects placed from it disappear.engineCreates a COL3 collision from a model fromGenerate COL engineLoadMeshwhen the author did not supply a.colfile. You set the triangle count (QEM simplification keeps the shape), the mode (mesh, convex hull, boxes, sphere) and the surface. Pass the result toengineReplaceCOL.engineReturns data about a collision fromGet COLInfo engineLoadCOL: the version, the name, the number of spheres, boxes, faces and vertices and theboxbounds.engineReturns the list of animations in a loaded IFP block: a table ofGet IFPAnimations { name, duration, bones }(duration in seconds, bone count).engineReturns the model file formatsGet Mesh Formats engineLoadMeshcan load.engineReturns a model's collision box: the minimum and maximum x, y, z relative to the model centre, and finally the radius of the collision sphere. The data comes from the collision loaded by the game, so it works for cars, peds and objects. Useful for placing things on the ground, measuring size and framing the camera.Get Model Bounding Box engineReturns the model flags set withGet Model Flags engineSetModelFlagas a name ->true/falsetable.engineReturns a model's draw distance in metres: set withGet Model LODDistance engineSetModelLODDistanceor from the San Andreas files.engineReturns a model's San Andreas texture names (number or name), also the vehicle wheels. A model that is not loaded is pulled in for a moment. Useful for shaders that replace textures.Get Model Texture Names engineReturns the model's visible hours set withGet Model Visible Time engineSetModelVisibleTime(0 and 24 by default).engineReturns how the bones of a model from a file map to the game skeleton bones: a list ofGet Ped Model Bones { hid, bone, occurrence }. Game animations drive the model through these bones.engineReturns the capacity of a game pool, e.g.Get Pool Capacity "building","ped","object","vehicle","col-model","task". Trilogy Hub enlarges the pools when the game starts.engineReturns the default pool capacity in the Definitive Edition, before Trilogy Hub enlarged it.Get Pool Default Capacity engineReturns how many places in a game pool are used now.Get Pool Used Capacity engineReturns every replaced model: a number -> asset path table.Get Replaced Models engineAssigns textures fromImport TXD engineLoadTXDto a model number.engineLoads a game engine (Unreal) asset by path, e.g. a model or a material from the game files. Pass the handle toLoad Asset engineReplaceModel.engineLoads a collision from a resource file (COLL, COL2, COL3, COL4 formats; from an archive it takes the first model) or from file bytes.Load COL engineLoads a model from a resourceLoad DFF .dfffile (likeengineLoadMesh). It takes textures from a.txdassigned earlier withengineImportTXDfor that number or from a.txdwith the same name. A path other than a.dfffile means an engine asset.engineLoads an IFP animation library (ANPK from Vice City, ANP2/ANP3 from San Andreas) from a file or data under your own block name (preferablyLoad IFP "resource.block"). Play animations withsetPedAnimation(ped, block, animation)or substitute them withengineReplaceAnimation. Stopping the resource frees the block.engineLoads a 3D model from a resource file:Load Mesh .obj,.stl,.ply,.gltf,.glb,.fbx,.3dsand.dfffrom GTA SA (textures from a.txdnext to it). Place the model withcreateMeshObjector put it under a number withengineReplaceModel.engineLoads a resourceLoad TXD .txdfile with textures forengineImportTXDandengineLoadDFF. Another path means a texture as an engine asset.engineMakes a game animation (block and name) play on this ped as an animation from a loaded IFP file. It works only for this player; if it is your own ped, others see the effect in the streamed pose.Replace Animation engineReplaces the image of a game blip icon (number 0-63, e.g. 40) with your own image. The image is a resource file (PNG, JPG, BMP or GIF, listed inReplace Blip Icon meta.xmlas<file>, also:resource/file.png) or image data, e.g. read withfileRead. The new icon shows everywhere the game draws that number: on the radar, on the ESC menu map and in its legend. Blips with that icon keep working the same way (mouse hover, names, ordering). A square image with a transparent background works best; anything larger than 256 px is scaled down. When the resource stops, the game icon comes back.engineReplaces an object model's collision with one fromReplace COL engineLoadCOLorengineGenerateCOL(also for map objects with that number and the day/night pair model). Objects only, not peds and vehicles. If the model does not exist in the game yet (a newengineRequestModelmodel while the player joins or a resource restarts), the collision waits and applies as soon as the model appears; a model number that does not exist givesfalse.engineReplaces the look of a model number: with an engine asset (Replace Model engineLoadAsset) or a model from a file (engineLoadMesh). Objects, vehicles and peds (skins 0-312; a file model without a skeleton is static) with that number show the new model. An object without its own collision gets one from the.dffor from the model triangles;engineReplaceCOLgives a custom collision. It works for this player, so call it in a client script. Replacing a newengineRequestModelmodel that the game has not created yet (the player is just joining, a resource restart) waits for it; a model number that does not exist givesfalse.engineClears all model flags set withReset Model Flags engineSetModelFlag.engineRestores the draw distance of a model's objects set by the game.Reset Model LODDistance engineUndoes animation replacements fromRestore Animation engineReplaceAnimationon a ped: all, one game block's or one animation.engineRestores the game icon afterRestore Blip Icon engineReplaceBlipIcon. Without an argument it restores every icon replaced by this resource.engineRestores a model's original collision.Restore COL engineRestores the original look of a model number.Restore Model engineRestores a model's original textures.Restore TXD engineAnother name forRestream engineRestreamWorld: reloads the world around the player.engineMakes the game reload the world around the player, e.g. after replacing many models.Restream World engineBackground model loading. In the Definitive Edition it is always on (Unreal streaming):Set Asynchronous Loading truechanges nothing,falsereturnsfalsewith a warning.engineSets a model flag (Set Model Flag is_road,draw_last,additive,is_treeand others). In the Definitive Edition Unreal does the drawing, so the flag is only stored (read withengineGetModelFlags) and does not change the image.engineSets from which distance (0-1400 m) objects of this model fromSet Model LODDistance createObjectstop being drawn, also shorter than the default. It changes the model's draw distance in the game (like the San Andreas IDE distance, 40-300 m by default), so editor maps are visible from far away; a distance above 300 m also makes these objects load further away. It does not change map objects (buildings, plants), because they are part of the Unreal levels.engineSets the game hours (0-24) when objects of this model fromSet Model Visible Time createObjectare visible; outside them they are hidden. From > to means across midnight (e.g. 20 and 6 = at night), 0 and 24 = always.engineAlways returnsSet Pool Capacity falsein Trilogy Hub: the game pools are enlarged when the game starts, and their size cannot be changed safely while it runs.engineAsks the game to free streaming memory.Streaming Free Up Memory engineTells whether a model is loaded:Streaming Get Model Load State "loaded","loading"or"notloaded".engineReturns how much memory loaded models use (bytes).Streaming Get Used Memory engineTells the game the model is no longer needed and it may free the memory.Streaming Release Model engineAsks the game to load a model into memory (e.g. before creating many objects at once).Streaming Request Model engineChecks whether a model from a file (a pedValidate Ped Model .dff) works as a skin: bone weights, hierarchy and required bones. Returns the result and a report with errors and warnings, orfalsewhen the model has no skeleton (it will be static).findSearches game engine objects by a name or path fragment and returns a list of hits. Developer mode only; it returnsEngine Object falsefor players.getReturns the path of a shot saved in the persistent preview store byElement Preview Cache setElementPreviewCacheKey. Pass the path todxDrawImageordxCreateTexture. The shot stays between game sessions.getReturns the path of the preview PNG file (forElement Preview Image dxDrawImageanddxCreateTexture) orfalsewhen there is no first shot yet.getReturns the preview state (Element Preview State "czeka"waiting,"gotowy"ready,"czeka na cel"waiting for the target,"blad: ..."error) and the number of shots taken.getReturns what the client knows about the game engine: the version, addresses and reflection readiness. Developer mode only; it returnsEngine Info falsefor players.getReturns data about a model fromMesh Info engineLoadMesh: the format, the number of vertices and triangles and the bounds{ minX, minY, minZ, maxX, maxY, maxZ }in metres.getReturns a model object's colour orMesh Object Color falsewhen it has the default material.getReturns a model object's position.Mesh Object Position getReturns a model object's rotation in degrees.Mesh Object Rotation getReturns a model object's scale on three axes.Mesh Object Scale getReturns the object state in the game:Mesh Object State "czeka"(waiting),"gotowy"(ready) or"blad:..."(error).getReturns the path of the asset put under a model (Model Asset false= original).isChecks whether the blip icon with this number has a custom image fromBlip Icon Replaced engineReplaceBlipIcon.isChecks whether a value is an existing preview fromElement Preview createElementPreview.isChecks whether the client can call game script commands (the base of some functions, e.g.Game Script Available dxDrawModel3DandcreateExplosionon the client).isChecks whether a value is an existing object fromMesh Object createMeshObject.isChecks whether a model object is visible.Mesh Object Visible setThe next preview shot is also saved in the persistent preview store under the given key. The store stays after leaving the game, so next time you can show the image right away withElement Preview Cache Key getElementPreviewCache, without creating a preview. Saving applies to one shot; after it the key is cleared. An empty key turns saving off.setSets a fixed preview camera: the position, the target and the field of view (San Andreas metres).Element Preview Camera setA ped preview shows only what the ped holds in its hand (a weapon), without the body. The camera orbits the item alone, e.g. in a gun shop.Element Preview Held Only setSets a model preview without an element in the world (e.g. a list of cars or skins in a shop): the kind (Element Preview Model "vehicle","ped","object") and the model number. The model only exists for this player, for the shots.setSets a camera orbiting the target: the horizontal angle (Element Preview Orbit yaw, 0 = from the north), the vertical angle (pitch), the distance (0 = the whole target in frame), the height and the field of view.setSets how often in milliseconds the preview takes a new shot (at least 50; 0 = only after a change andElement Preview Refresh updateElementPreview). One shot costs about 10 ms of a frame.setChanges the preview target (an element, a model object orElement Preview Target false= the scene).setGives a model object a solid colour (r, g, b 0-255) with lighting; without a colour the default material comes back.Mesh Object Color setMoves a model object (metres).Mesh Object Position setRotates a model object (degrees, Z, X, Y order).Mesh Object Rotation setScales a model object: with one number or separately on three axes.Mesh Object Scale setPuts a PNG/JPG image from the resource on a model object (by the UV coordinates in the file);Mesh Object Texture falseremoves the image.setShows or hides a model object.Mesh Object Visible updateRequests a new preview shot in the next frame.Element Preview
Input and controls 11
createShows a Windows system notification next to the clock (useful when the game is minimised). In the current client version the function is not wired to the game yet and returnsTray Notification falsewith a console warning;isTrayNotificationEnabledtells whether it works already.executeSends a command to the server as if the player typed it in chat (without the leading slash).Command getReturns the player's keyboard layout (name and identifier). In the current client version the function is not wired to the game yet and returnsKeyboard Layout falsewith a console warning.getChecks whether a key is held down right now. Works withoutKey State bindKeytoo, e.g. inonClientRender.getReturns the player's language (the same one chosen in the launcher and game settings) as a table with a code and a name. Codes:Localization pl,en,de,es,fr,it,pt,ru,uk,tr,cs,ro. The server knows the same language throughgetPlayerLocalization.isChecks whether Caps Lock is on (e.g. to warn while typing a password).Caps Lock Enabled isChecks whether the F11 key minimises the game. ReturnsMinimize Key Enabled falsewhen any resource turned it off withsetMinimizeKeyEnabled.isChecks whether the client supports system notifications (Tray Notification Enabled createTrayNotification). It returnsfalsein the current version.setPuts text into the player's system clipboard (e.g. an invite code or a server address). In the current client version the function is not wired to the game yet and returnsClipboard falsewith a console warning.setTurns minimising the game with the F11 key on or off. When it is off, F11 does not minimise the game but still works inMinimize Key Enabled bindKey, so the server can bind its own function to it (e.g. a custom map).setFlashes the game icon on the taskbar, e.g. when the player got a private message while the window is in the background. In the current client version the function is not wired to the game yet and returnsWindow Flashing falsewith a console warning.
Interface (GUI) 145
guiRemoves focus from a control, so typing no longer goes to it.Blur guiBrings a window or control to the front.Bring To Front guiChecks whether a check box is checked.Check Box Get Selected guiChecks or unchecks a check box.Check Box Set Selected guiAdds an item to a drop-down list.Combo Box Add Item guiRemoves all items from a drop-down list.Combo Box Clear guiReturns the number of items in a drop-down list.Combo Box Get Item Count guiReturns the text of a drop-down item.Combo Box Get Item Text guiReturns the selected item index (from 0), orCombo Box Get Selected -1when nothing is selected.guiChecks whether a drop-down list is open.Combo Box Is Open guiRemoves an item from a drop-down list.Combo Box Remove Item guiChanges the text of a drop-down item.Combo Box Set Item Text guiOpens or closes a drop-down list.Combo Box Set Open guiSelects a drop-down item.Combo Box Set Selected -1clears the selection.guiCreates a browser as a GUI control. Mouse, wheel and keyboard go to the page by themselves. Get the browser element forCreate Browser loadBrowserURLwithguiGetBrowser.guiCreates a button. A click firesCreate Button onClientGUIClick.guiCreates a check box (yes/no).Create Check Box guiCreates a drop-down list. Choosing an item firesCreate Combo Box onClientGUIComboBoxAccepted.guiCreates a single-line text field. Changing the text firesCreate Edit onClientGUIChanged, Enter firesonClientGUIAccepted.guiCreates a font from a resource TTF file forCreate Font guiSetFont. Size in points.guiCreates a list with columns (a table). Add columns withCreate Grid List guiGridListAddColumnand rows withguiGridListAddRow.guiCreates a text label.Create Label guiCreates a multi-line text field.Create Memo guiCreates a progress bar (0-100).Create Progress Bar guiCreates a radio button for choosing one option of a group. Buttons with the same parent form a group.Create Radio Button guiCreates a scroll bar (0-100). Moving it firesCreate Scroll Bar onClientGUIScroll.guiCreates a scrollable area. Child controls that do not fit can be scrolled.Create Scroll Pane guiCreates a value slider 0-100. Changing it firesCreate Slider onClientGUIChanged.guiCreates an image from a resource file (PNG, JPG). The file must be listed inCreate Static Image meta.xml.guiAdds a tab to a panel. The tab is the parent of its controls.Create Tab guiCreates a tab panel. Add tabs withCreate Tab Panel guiCreateTab.guiCreates a window with a title bar. The window can be dragged and resized and has a close button (theCreate Window onClientGUICloseevent). Add other controls as its children.guiRemoves a tab from a panel together with its controls.Delete Tab guiReturns the text cursor position in a field (number of characters before it).Edit Get Caret Index guiReturns the maximum number of characters that can be typed in a field.Edit Get Max Length guiChecks whether a field hides its text with asterisks.Edit Is Masked guiChecks whether a field is read-only.Edit Is Read Only guiSets the text cursor position in a field.Edit Set Caret Index guiHides the typed text with asterisks, e.g. for a password.Edit Set Masked guiSets the maximum number of characters in a field.Edit Set Max Length guiMakes a field read-only (it cannot be typed into).Edit Set Read Only guiFocuses a control, so typing goes to it.Focus guiReturns a control's alpha (0-1).Get Alpha guiReturns the browser element from aGet Browser guiCreateBrowsercontrol.guiReturns the cursor type matching the control under the mouse:Get Cursor Type "default","text"or"sizing".guiChecks whether a control responds to mouse and keyboard.Get Enabled guiReturns the focused control (the one that receives typing).Get Focus guiReturns a control's font (a name or a handle fromGet Font guiCreateFont).guiChecks whether the interface takes the keyboard from the game.Get Input Enabled guiReturns the interface input mode:Get Input Mode "allow_binds","no_binds"or"no_binds_when_editing".guiReturns a control's position relative to its parent.Get Position guiReturns all control properties, including built-in ones (kind, text, position, size...). Useful for debugging.Get Properties guiReturns a custom control property set withGet Property guiSetProperty.guiReturns the current GUI scale.Get Scale guiReturns the screen size in pixels.Get Screen Size guiReturns the selected tab of a panel.Get Selected Tab guiReturns a control's size.Get Size guiReturns a control's text (label, button, field, window title).Get Text guiReturns the current theme name and, as a second result, its drawing colours.Get Theme guiReturns one colour of the current theme.Get Theme Color guiReturns the names of available themes (sorted).Get Theme Names guiChecks whether a control is visible.Get Visible guiReturns all top-level controls (windows and controls without a parent). Useful for debugging.Get Widgets guiAdds a column to a list. Width is a fraction of the list width.Grid List Add Column guiAdds a row. You can pass the texts of the following cells right away as extra arguments.Grid List Add Row guiFits a column's width to its longest cell.Grid List Auto Size Column guiRemoves all rows from a list (columns stay).Grid List Clear guiReturns the number of list columns.Grid List Get Column Count guiReturns a column header.Grid List Get Column Title guiReturns a column's width.Grid List Get Column Width guiReturns how far the list is scrolled horizontally (0-100).Grid List Get Horizontal Scroll Position guiReturns a cell's text colour.Grid List Get Item Color guiReturns the value attached to a cell withGrid List Get Item Data guiGridListSetItemData.guiReturns a cell's text.Grid List Get Item Text guiReturns the number of list rows.Grid List Get Row Count guiReturns the number of selected rows (0 or 1; the list selects one row).Grid List Get Selected Count guiReturns the selected row (from 0) and column (from 1). When nothing is selected:Grid List Get Selected Item -1, -1.guiReturns the selected cells asGrid List Get Selected Items {row = ..., column = ...}tables.guiReturns the row selection mode stored withGrid List Get Selection Mode guiGridListSetSelectionMode.guiReturns how far the list is scrolled vertically (0-100).Grid List Get Vertical Scroll Position guiInserts a row after the given one.Grid List Insert Row After -1inserts at the top.guiChecks whether clicking a header sorts the list (yes by default).Grid List Is Sorting Enabled guiRemoves a column together with its cells.Grid List Remove Column guiRemoves a row.Grid List Remove Row guiChanges a column header.Grid List Set Column Title guiSets a column's width.Grid List Set Column Width guiScrolls the list horizontally (0-100).Grid List Set Horizontal Scroll Position guiSets a cell's text colour.Grid List Set Item Color guiAttaches any value invisible to the player to a cell, e.g. an element or a model number.Grid List Set Item Data guiSets a cell's text. WithGrid List Set Item Text section = truethe row becomes a section header.guiSets whether the list shows scroll bars.Grid List Set Scroll Bars guiSelects a list row.Grid List Set Selected Item -1clears the selection. FiresonClientGUIChanged.guiStores the selection mode (a number). The list always selects one row.Grid List Set Selection Mode guiTurns sorting by clicking a header on or off.Grid List Set Sorting Enabled guiScrolls the list vertically (0-100).Grid List Set Vertical Scroll Position guiSorts the list by a column. Numbers are compared as numbers, the rest as text. Clears the selection.Grid List Sort By Column guiReturns a label's colour.Label Get Color guiReturns a label's font height in pixels.Label Get Font Height guiReturns the width of a label's text in pixels.Label Get Text Extent guiSets a label's colour.Label Set Color guiAligns a label's text horizontally and optionally wraps lines.Label Set Horizontal Align guiAligns a label's text vertically.Label Set Vertical Align guiReturns the cursor position in a multi-line field. Another name forMemo Get Caret Index guiEditGetCaretIndex.guiReturns how far a multi-line field is scrolled (0-100).Memo Get Vertical Scroll Position guiChecks whether a multi-line field is read-only. Another name forMemo Is Read Only guiEditIsReadOnly.guiSets the cursor position in a multi-line field. Another name forMemo Set Caret Index guiEditSetCaretIndex.guiMakes a multi-line field read-only. Another name forMemo Set Read Only guiEditSetReadOnly.guiScrolls a multi-line field (0-100).Memo Set Vertical Scroll Position guiShows a dialog with buttons. On click it firesMessage Box onClientGUIAccepted(source: the window, arguments: the button text and its number), then the window closes.guiMoves a window behind the others.Move To Back guiShows a short notification in the bottom-right corner of the screen. At most 6 are shown at once.Notify guiReturns a progress bar's progress (0-100).Progress Bar Get Progress guiSets a progress bar's progress (0-100).Progress Bar Set Progress guiChecks whether a radio button is selected.Radio Button Get Selected guiSelects a radio button in its group (the others are deselected).Radio Button Set Selected guiAdds your own theme. Missing colours are taken from the current theme.Register Theme guiReturns a scroll bar's position (0-100).Scroll Bar Get Scroll Position guiSets a scroll bar's position (0-100).Scroll Bar Set Scroll Position guiReturns how far an area is scrolled horizontally (0-100).Scroll Pane Get Horizontal Scroll Position guiReturns how far an area is scrolled vertically (0-100).Scroll Pane Get Vertical Scroll Position guiScrolls an area horizontally (0-100).Scroll Pane Set Horizontal Scroll Position guiSets whether an area shows scroll bars.Scroll Pane Set Scroll Bars guiScrolls an area vertically (0-100).Scroll Pane Set Vertical Scroll Position guiSets a control's alpha (0 invisible, 1 opaque).Set Alpha guiEnables or disables a control. A disabled one is greyed out and does not respond.Set Enabled guiSets a control's font: a built-in name (Set Font "default-normal","default-small","default-bold-small","default-bold","clear-normal","sa-header","sa-gothic") or a handle fromguiCreateFont.guiGives the keyboard to the interface instead of the game (the character ignores keys and binds do not fire).Set Input Enabled guiSets the input mode:Set Input Mode "allow_binds"(binds work),"no_binds"(they do not) or"no_binds_when_editing"(they do not while typing in a field).guiMoves a control. FiresSet Position onClientGUIMove.guiSets a control property. Supported:Set Property "CloseButtonEnabled"(the window close button) and"AlwaysOnTop"; other names are stored for the script.guiSets the scale of the whole GUI (0.5-4, default 1): fonts, the title bar, list and tab rows. Control positions and sizes stay in script pixels.Set Scale guiSelects a panel tab.Set Selected Tab guiResizes a control. FiresSet Size onClientGUISize.guiChanges a control's text.Set Text guiChanges the theme of the whole interface: a name (Set Theme default,sunset,midnight,ocean,emerald,crimson,grape,slate,lightor your own fromguiRegisterTheme) or a table of colours.guiChanges one colour of the current theme. Keys:Set Theme Color accent,accentBright,accentDim,accentText,windowBg,windowBorder,titleBg,titleBgActive,panelBg,fieldBg,fieldBorder,text,textDim,textDisabled,hover,press,shadow,scrollTrack,scrollThumb.guiShows or hides a control together with its children.Set Visible guiReturns a slider's value (0-100).Slider Get Value guiSets a slider's value (0-100).Slider Set Value guiReturns the real pixel size of the image file.Static Image Get Native Size guiReplaces the image file of the control.Static Image Load Image guiChecks whether a window can be dragged.Window Is Movable guiChecks whether a window can be resized.Window Is Sizable guiSets whether a window can be dragged with the mouse.Window Set Movable guiSets whether a window can be resized by dragging its edge.Window Set Sizable
Miscellaneous 15
areChecks whether the built-in nametags above heads are on for the local player.Nametags Enabled downloadDownloads a resource file marked inFile meta.xmlas<file src="..." download="false"/>only when it is needed (e.g. a large music file). The result arrives in theonClientFileDownloadCompleteevent, always asynchronously, also when the file was already downloaded.":resource/file"downloads another resource's file.getTurns a screen point (e.g. the cursor) into a pixel of a browser page drawn in the world withBrowser Position From Screen dxDrawMaterialLine3DordxDrawMaterialPrimitive3D. This lets you click on screens and billboards with a browser standing in the world.getReturns the cursor position as a fraction of the screen 0-1 (x, y). Works only while the cursor is shown. The next three results (a world point) are zeros for now;Cursor Position getWorldFromScreenPositiongives the world point under the cursor.getReturns the cursor position in screen pixels (while the cursor is shown).Cursor Position Absolute getReturns the current look of the built-in nametags for the local player (a table with fields as inNametag Style setNametagStyle).getTurns a world point into a screen point (pixels). ReturnsScreen From World Position falsewhen the point is behind the camera or off screen. The third result is the distance from the camera. Useful for text above heads.getReturns the game screen size in pixels. The same asScreen Size guiGetScreenSize.isChecks whether the player is typing in chat right now.Chat Box Input Active isChecks whether the game console is open.Console Active isChecks whether the game menu (pause) is open.Main Menu Active isChecks whether the client is downloading resource files right now (a resource start orTransfer Box Active downloadFile).setMoves the cursor to a spot in the game window (pixels). ReturnsCursor Position falsewhen the game window is not active or is minimised.setTurns the built-in nametags above other players' heads on or off for the local player. A shortcut forNametags Enabled setNametagStyle({ enabled = ... }); useful when a resource draws its own nametags.setSets the look of the built-in nametags above other players' heads for the local player. Fields as inNametag Style setPlayerNametagStyle:enabled,distance,showDistance,scale,color,background; pass only the ones to change.
Particles 1
Peds 7
getReturns the number of skeleton bones a ped has in this version of the game (the Definitive Edition skeleton has more than the classic one). Returns 0 when the game has not shown any ped yet. Together withPed Bone Count getPedBoneNameit lets you list every bone.getConverts a game skeleton bone name to its index, which you can then pass toPed Bone Index By Name getPedBonePositionand similar functions. Some names repeat in the skeleton (there are e.g. two "Spine" bones); the second argument picks which occurrence to return.getTranslates a bone number used by existing scripts (e.g. 8 = head, 25 = right hand) into a bone index in the Definitive Edition skeleton. Useful when porting existing scripts that use bone numbers. ReturnsPed Bone Index For Mta falsewhen the bone has no counterpart in the new skeleton.getReturns a ped bone's 4x4 matrix for this frame, in the same layout asPed Bone Matrix getElementMatrix: row 1 = the bone's X axis, 2 = Y axis, 3 = Z axis, 4 = position. These are the same axes in whichattachElementToBoneapplies its offset and rotation, so the attach point isposition + X*dx + Y*dy + Z*dz. It is computed straight from the bone rotation in the engine, without Euler angles, so it keeps its precision at 90° turns.getReturns the name of the game skeleton bone with the given index (e.g.Ped Bone Name "Head","R_Hand"). The index is the bone's position in the Definitive Edition skeleton (0 togetPedBoneCount() - 1), not a number fromgetBoneIDs.getReturns the world rotation of a chosen skeleton bone of a ped, in degrees, exactly as it looks in the current animation frame. Works for peds visible in this game. Useful for attaching objects to a hand or the head so they rotate with it.Ped Bone Rotation getReturns both the position and rotation of a ped's bone at once (x, y, z, rx, ry, rz), which is faster than callingPed Bone Transform getPedBonePositionandgetPedBoneRotationseparately every frame. Values come from the current animation frame in this game.
Players 2
getReturns how loud a player is talking right now:Player Voice Level -1when silent, and while talking a level from0(quiet) to3(loud). Useful for your own talk indicators.getReturns the local player's talk key: their own from the ESC menu or, if they did not pick one, the server's default key. The second value is a name to show on screen.Voice Push To Talk Key
Shaders 9
dxCreates a shader from a resource .fx file or from code given as a string. In Trilogy Hub a shader performs texture replacement: the image set withCreate Shader dxSetShaderValueunder a texture parameter replaces the world textures chosen withengineApplyShaderToWorldTexture(e.g. custom billboards, signs on buildings, car wraps). The game material stays (lighting, reflections); only the image changes. Pixel and vertex effects from HLSL code are not executed.dxSets the mesh density for a shader's vertex effects. In Trilogy Hub it has no effect, because shaders only perform texture replacement.Set Shader Tessellation dxRotates a shader image drawn withSet Shader Transform dxDrawImagein 3D. Not supported - always returnsfalse.dxSets a shader parameter. When the parameter is a texture declared in the .fx code (or the shader has none) and the value is a texture (Set Shader Value dxCreateTexture, render target, browser) or an image path, that image becomes the new texture swapped into the world. Numbers and vectors are stored for compatibility with existing scripts.engineReplaces a San Andreas world texture with the given name with the shader's image. The name may containApply Shader To World Texture *and?(e.g."vehiclegrunge*"). Without an element the replacement applies to all objects with that texture, including those loaded later; with an element (vehicle, object, ped) - only to it. The names of textures currently visible in the game are returned byengineGetVisibleTextureNames.engineReplaces a world texture with a script texture without writing a shader: a texture fromApply Texture To World Texture dxCreateTexture, a render target, a screen source or a browser is enough. Works likeengineApplyShaderToWorldTexture(*and?patterns, optional element). A render target or browser gives a live image, e.g. an in-game TV showing a web page.engineReturns the names of San Andreas textures currently loaded in the game (around the player), with an optionalGet Visible Texture Names *and?filter. Helps find a texture name to replace: stand next to an object and print the list. The second argument (model) is ignored.engineRemoves a texture replacement made withRemove Shader From World Texture engineApplyShaderToWorldTexture- you must pass the same name pattern and the same element. The original game texture comes back.engineRemoves a replacement made withRemove Texture From World Texture engineApplyTextureToWorldTexture(the same texture, pattern and element). The original comes back.
Sound (client) 27
getWithout a bank number it returns the number of banks in the container. With a bank number it returns the number of sounds in that bank.SFXBank Sound Count getChecks whether a game audio container exists. The sound files are always in the game; whether a given bank will play is told bySFXStatus isSFXBankLoaded.getReturns an effect's current parameters: name → value.Sound Effect Parameters getReturns a table of all of a sound's effects: effect name →Sound Effects true/false.getReturns the volume the player actually hears: after distance from the camera and after the volume slider in the settings.Sound Heard Volume getReturns the sound length in seconds.Sound Length getReturns the distance from which a 3D sound can no longer be heard.Sound Max Distance getReturns a 3D sound's full-volume distance.Sound Min Distance getReturns the current playback position in seconds.Sound Position getReturns all playing sounds created by scripts.Sounds getReturns the playback speed.Sound Speed getReturns the volume set by script (ignores distance and the player's slider).Sound Volume isChecks whether the game has a sound bank loaded right now. Only such a bank plays throughSFXBank Loaded playSFXandplaySFX3D.isChecks whether a sound is paused.Sound Paused playPlays a sound from San Andreas' own sound banks (footsteps, weapons, collisions, vehicles, mission sounds) with no position in the world. The game's sound engine plays it, so it follows the game's effects volume.SFX playPlays a sound from the game's banks at a point in the world. The game's sound engine handles fading with distance and panning.SFX3 D playPlays an MP3 or WAV file from a resource with no position in the world (it sounds the same everywhere). The file must be listed inSound meta.xmlas a<file>.playPlays a sound at a point in the world. It fades with distance from the camera: full volume up to 5 m, silent from 20 m. It is panned left-right.Sound3 D setTurns an effect on or off for a sound fromSound Effect Enabled playSound/playSound3D. Available effects:chorus,compressor,distortion,echo,flanger,gargle,i3dl2reverb,parameq,reverb(as in MTA) andbandpass(a pass band, e.g. a voice over the phone).setSets a parameter of an effect, even one that is off. Names and ranges are as in MTA (e.g.Sound Effect Parameter echo:wetDryMix,feedback,leftDelay,rightDelay,panDelay;reverb:inGain,reverbMix,reverbTime,highFreqRTRatio);bandpass:lowCut,highCut,gain.setSets the distance from which a 3D sound can no longer be heard (20 m by default).Sound Max Distance setSets the distance up to which a 3D sound plays at full volume (5 m by default). The maximum distance grows if needed.Sound Min Distance setPauses or resumes a sound.Sound Paused setSeeks the sound to the given second.Sound Position setSets the playback speed.Sound Speed 1is normal; a higher value speeds up and raises the pitch.setSets the sound volume.Sound Volume 1is normal, up to2amplifies.stopStops a sound and removes it. FiresSound onClientSoundStoppedwith the reason"destroyed".
Vehicles 1
Weapons 2
isChecks whether the weapon wheel is enabled.Weapon Wheel Enabled setCompletely disables or restores the game's weapon wheel. A disabled wheel never opens: no menu, no slow motion and no grey background. Switching weapons with the mouse wheel still works. The wheel is enabled by default. The setting applies to this game only; if the wheel was open, it closes right away.Weapon Wheel Enabled
World 10
getReturns the value of an image effect set withPost Effect setPostEffector by the server (the colour filter as"tint", grain as"grain").getReturns the list of image effect names accepted byPost Effect Names setPostEffect.getConverts a point on the screen into a point in the 3D world at the given distance from the camera. Useful e.g. for placing objects with the mouse cursor.World From Screen Position getNewFinds a San Andreas map model without collision that the segment passes through: graffiti, car wash brushes, meshes with transparency.World Model On Line processLineOfSightdoes not see such models because it passes through them. When the segment crosses several of them, the smallest one wins (e.g. graffiti on a building wall). Models with collision are skipped, sinceprocessLineOfSightfinds those. The result fitsremoveWorldModeldirectly.getReturns a copy of all world settings the server sent to this player (weather, wind, settings stored with world functions, etc.) as a key → value table. Useful for diagnostics and your own effects that depend on server settings.World Settings isChecks whether the Trilogy Hub loading screen has gone and the player stands in the game world. Useful to show a welcome window or a camera shot only when the player can actually see it.World Loaded resetEnds the local minute length set withMinute Duration setMinuteDurationin a client script: the clock goes back to the server's time and pace.resetRemoves one image effect set withPost Effect setPostEffect. If the server also sets this effect (colour filter, grain), the server value comes back.resetRemoves all image effects set withPost Effects setPostEffectin this game.setSets an image effect for this player, computed by the game engine over the whole world image (without script texts and windows). The effect stays untilPost Effect resetPostEffector leaving the server. Available effects:"saturation"(0-2, 1 = unchanged, 0 = black and white),"contrast"(0-2),"gamma"(0.1-4),"gain"(colour brightness gain, 0-4),"offset"(colour offset, -1-1, 0 = unchanged),"tint"(image tint: r, g, b 0-255),"temperature"(white temperature in kelvins, 1500-15000, 6500 = neutral),"grain"(grain 0-1),"grainJitter"(grain jitter 0-1),"vignette"(darkened edges 0-1),"bloom"(glow of bright areas 0-8),"fringe"(colour fringing at the edges 0-5),"exposure"(-8-8, 0 = unchanged, +1 = twice as bright).