- Documentation
- Server functions
Server functions
Functions available in type="server" scripts. They run on the server and see every player.
Shared functions work here too. For example setTimer and getElementPosition are in Shared functions.
New functions and events! 4
setNewSets a vehicle health floor: bullets, fire, explosions and collisions will not take the health below this value. A floor of 250 or more stops the car from catching fire or exploding from damage. A script can still go lower with setElementHealth or blowVehicle. 0 turns the floor off.Vehicle Health Floor setNewSets what a vehicle is immune to: bullets, fire, explosions, collisions and melee. Works for every player. AllVehicle Proofs falserestores normal behaviour. setVehicleDamageProof also makes it immune to everything at once.setNewChanges a vehicle's wheel grip with a multiplier (1 = normal, 0.5 = half, 1.5 = half again as much). Each resource has its own multiplier and the car gets their product. 1 removes the resource's multiplier, and stopping a resource removes its multipliers by itself.Vehicle Wheel Grip setNewTints a vehicle's windows for every player and can give them a light colour. The darkest is 80% - a higher value also gives 80%, because the glass should still look like glass: reflections stay and you can still see a bit of the interior. The colour only tints the glass, the darkening does most of the work. Darkness 0 without a colour restores the normal windows.Vehicle Window Tint
Accounts 24
addCreates a new account on the server. The password is stored as a secure hash, never in plain text.Account copyCopies all data from one account to another.Account Data getReturns the account with the given name. With a password it returnsAccount falsewhen the password does not match.getReturns the account with the given number (Account By ID getAccountID).getReturns account data stored under a key. Account data is persistent: it stays after the player leaves and after a server restart.Account Data getReturns the account's permanent number. Assigned on the first request and never changes afterwards.Account ID getReturns the IP address remembered at the last login.Account IP getReturns the account name.Account Name getReturns the player logged into this account. An account can be logged in by only one player at a time.Account Player getReturns all accounts on the server.Accounts getReturns the accounts whose data under a key equals the given value.Accounts By Data getReturns the accounts last used from the given IP address.Accounts By IP getReturns the accounts used from the given Client ID.Accounts By Serial getReturns the Client ID remembered when logging into this account.Account Serial getReturns the account type:Account Type "guest"(not logged in) or"player".getReturns all account data as a key-value table.All Account Data isChecks whether the account is a guest account, i.e. the player is not logged in.Guest Account logLogs a player into an account. FiresIn onPlayerLogin. An account can be logged in by only one player at a time.logLogs a player out of their account. FiresOut onPlayerLogout.removeDeletes an account together with its data.Account setStores account data under a key. The value is kept permanently (also after a server restart).Account Data setRenames an account, moving all its data.Account Name setChanges an account's password.Account Password setStores the Client ID assigned to the account.Account Serial
Administration and bans 19
addBans an IP address, nickname or serial (Client ID) without the player having to be online.Ban banBans a player (their Client ID and IP address) and kicks them right away.Player getReturns the name of whoever issued the ban.Ban Admin getReturns the IP address stored in the ban.Ban IP getReturns the nickname stored in the ban.Ban Nick getReturns the ban reason.Ban Reason getReturns every active ban. Bans that have already expired are skipped.Bans getReturns the serial (Client ID) stored in the ban.Ban Serial getReturns when the ban was created, in seconds since 1 January 1970 (Unix time).Ban Time getReturns when the ban expires, in seconds since 1970. A permanent ban returnsUnban Time false.isChecks whether a value is a ban handle.Ban isChecks whether a connection with this serial or IP address would be rejected by bans.Banned kickKicks a player from the server. The player sees the reason and can rejoin right away.Player reloadReloads the ban list from disk, for example after editing the ban file by hand.Bans removeRemoves a ban.Ban setChanges the admin name stored in the ban.Ban Admin setChanges the nickname stored in the ban.Ban Nick setChanges the ban reason.Ban Reason setChanges when the ban expires. You pass a moment in seconds since 1970, not a duration.Unban Time
Blips 4
addGives a blip icon a name. The name shows in the map legend (ESC) and in the tooltip when hovering over the icon.Map Blip Name addPlaces your own place name on the map (ESC), like the district names in the game.Map Zone Name removeRemoves an icon's name from the map legend.Map Blip Name removeRemoves a place label added withMap Zone Name addMapZoneName.
Chat and console 1
Clothes 20
addPuts a piece of CJ clothing on a ped (a player or an NPC): a texture and a model in one of 18 parts (0-17 or a name likePed Clothes "shirt","hat","trousers"). Every player sees it. The fifth argument (Trilogy Hub only) recolours the clothing:"RRGGBB"or a zone list"RRGGBB,,RRGGBB"(an empty spot = the zone stays as is, e.g. a print is kept).addGives a ped a San Andreas tattoo in one of nine body spots (slots 1-9: upper arms, forearms, back, chest, stomach, lower back). Every player sees it.Ped Tattoo addMakes a tattoo from your own PNG image in slot 1-9. The file must be listed inPed Tattoo Image meta.xmlas<file>(at most 1 MB and 1024x1024), and":resource/file.png"takes the file from another resource. Dark pixels are ink, light and transparent ones are skin. Every player sees it.clearRemoves all of a ped's tattoos and keeps the clothes.Ped Tattoos getReturns the texture and model of clothing numberClothes By Type Index indexof a type, from the table loaded withsetClothesData.getReturns what a ped wears on a body part: the texture, the model and the colour (Ped Clothes "RRGGBB", a zone list ornil).getReturns the offset and scale of the tattoo in slot 1-9 (Ped Tattoo Offset 0, 0, 0, 1when it is not moved).getReturns the offset and scale of a part of the look (Player Clothes Offset 0, 0, 0, 1when it is not moved).getReturns the player's outfit from the launcher wardrobe (skin -1), read only: a part ->Player Wardrobe { texture, model, color, name }table. An empty table = the player joined without an outfit. Scripts do not change this outfit; they dress a separate CJ copy (skin 0).getReturns the type and number of a clothing item by its texture and model, from the table loaded withType Index From Clothes setClothesData.removeRemoves a piece of a ped's clothing. With a texture and a model it removes it only when the ped wears exactly that item.Ped Clothes removeRemoves the tattoo from slot 1-9.Ped Tattoo removeRemoves a piece of a player's clothing. Accessories (hat, glasses, tattoo) disappear, while the shirt, trousers and shoes go back to the default look, because the game cannot draw a ped without them.Player Clothes resetPuts the tattoo in slot 1-9 back to its default place and size.Ped Tattoo Offset resetRemoves everything scripts put on the player (clothes and tattoos).Player Clothes setLoads your own clothing table forClothes Data getClothesByTypeIndexandgetTypeIndexFromClothes: a type (as a string"0"-"17") -> a list of{ texture, model }. Without it both functions returnfalse.setAnother name forPed Clothes setPlayerClothes: puts on a piece of clothing, with the same arguments.setMoves and scales the tattoo in slot 1-9 (offset in game centimetres). Every player sees it.Ped Tattoo Offset setPuts a piece of clothing on a player; the same asPlayer Clothes addPedClothes, with the argument order: texture, model, part. The fifth argument is a"RRGGBB"colour or a zone list. The player must use the CJ skin (0); the launcher wardrobe outfit (skin -1) is changed on a CJ copy that comes back after a skin change.setMoves and scales a part of the look (e.g. a hat or a tattoo) in game centimetres. Every player sees it.Player Clothes Offset
Collision shapes 10
addAdds a vertex to a polygon zone. WithoutCol Polygon Point indexat the end, withindex- at that position in the list (from 1). The detection area changes immediately.getReturns the polygon zone height range set withCol Polygon Height setColPolygonHeight.getReturns the position of one vertex of a polygon zone (numbered from 1).Col Polygon Point Position getReturns all vertices of a polygon zone as a table ofCol Polygon Points {x, y}pairs.getReturns the radius of a sphere, circle or tube zone.Col Shape Radius getReturns the zone's dimensions depending on its shape: sphere/circle - radius; tube - radius and height; rectangle - width and length; cuboid - width, depth, height; polygon - height.Col Shape Size removeRemoves a vertex of a polygon zone (numbered from 1). The zone must keep at least three vertices.Col Polygon Point setMoves a vertex of a polygon zone; the detection area changes immediately.Col Polygon Point Position setChanges the radius of a sphere, circle or tube zone (negative = 0).Col Shape Radius setChanges the zone's dimensions (not polygons); the numbers mean the same as inCol Shape Size getColShapeSize.
Database 9
dbOpens a connection to an SQLite database (a file in the resource folder) or MySQL.Connect dbRuns a query that returns no result (INSERT, UPDATE, CREATE). Arguments replace theExec ?placeholders.dbRuns a query and returns its result right away. One call instead ofFetch dbQuery,dbPollanddbFree. Works with SELECT, INSERT, UPDATE and DELETE.dbRuns a query and returns only the first row. Handy when you look for a single record, for example a player's account.Fetch One dbRuns a query and returns a single value: the first column of the first row. For counting (Fetch Value COUNT(*)), sums and single fields.dbFrees a query result you do not intend to read.Free dbCollects the result of aPoll dbQuery: the rows, the number of affected rows and the last inserted ID. If you just want to run a query and get the rows,dbFetchis simpler.dbReturns the query text with values placed atPrepare String ?and safely quoted. Useful when building a larger query from parts.dbSends a query that returns a result. Collect it withQuery dbPollor in a callback that receives the query handle.
Elements 30
addSubscribes a player to changes of one element data value. Works with values set inElement Data Subscriber "subscribe"mode: only subscribed players receive them, which saves network traffic.cloneCreates a copy of an element (vehicle, object, ped, marker and so on) at the given place.Element getReturns the element's rotation speed around the X, Y and Z axes.Element Angular Velocity getThe same asElement Bone Attachment Details getElementBoneAttachment(another name for compatibility with scripts).getReturns the n-th element of a type (from 0).Element By Index getReturns the n-th child of an element (from 0).Element Child getReturns an element's children in the tree, optionally only of one type.Element Children getReturns the number of an element's children.Element Children Count getReturns the collision shape assigned to a marker or pickup.Element Col Shape getReturns the players subscribed to an element data value.Element Data Subscribers getReturns the element's parent in the element tree.Element Parent getReturns the player who computes the element's physics (vehicle, object, ped) and sends its state to others.Element Syncer getReturns the name of the map zone where the element is (e.g. "Ganton"), or just the city.Element Zone Name hasChecks whether a player is subscribed to an element data value.Element Data Subscriber isChecks whether function calls on the element propagate to its children (yes by default).Element Call Propagation Enabled isChecks whether the element's model faces are drawn on both sides.Element Double Sided isChecks whether an element is a low-LOD object (a simplified model seen from afar).Element Low LOD isChecks whether an element is on fire.Element On Fire isChecks whether an element is visible to a player (seeElement Visible To setElementVisibleTo).removeUnsubscribes a player from an element data value.Element Data Subscriber setSets the element's rotation speed around the X, Y and Z axes.Element Angular Velocity setTurns on or off passing function calls from the element to its children.Element Call Propagation Enabled setAssigns a collision shape to a marker or pickup.Element Col Shape nilremoves the assignment.setTurns on drawing the model's faces on both sides.Element Double Sided setMarks an object as a low-LOD model.Element Low LOD setSets an element on fire or puts it out. With a duration in milliseconds the fire goes out by itself.Element On Fire setChanges the element's parent in the tree. Destroying the parent destroys the children too.Element Parent setSets the element's bounding radius used in geometry queries (e.g. line of sight, zones).Element Radius setChooses the player who computes the element's physics.Element Syncer trueornilrestores automatic choice.setShows or hides an element for a chosen player. Applies to blips, markers, text displays and similar.Element Visible To
Events 5
cancelStops sending a latent event to a player.Latent Event getReturns the handles of latent events still being sent to a player.Latent Event Handles getReturns the progress of sending a latent event to a player.Latent Event Status triggerSends an event from the server to one player, several players or everyone at once.Client Event triggerSends an event to clients likeLatent Client Event triggerClientEvent, intended for large data sent in the background (with a bandwidth limit). Argument order:sendTo, name, [bandwidth], [persist], sourceElement, .... Progress can be checked withgetLatentEventHandlesandgetLatentEventStatus.
Files 4
fileReturns a hash of the file content in hexadecimal. Useful to check whether a file has changed. The hash is computed from the content as UTF-8 text, so for binary files it may differ from hashes made by other tools. Algorithms:Get Hash "md5","sha1","sha224","sha256","sha384","sha512".pathChecks whether a path in the resource folder points to a folder.Is Directory pathChecks whether a path in the resource folder points to a file.Is File pathReturns a list of names in a resource folder; folder names end withList Dir /.
Fire 6
getReturns the list of burning fires started by the server.Fires isChecks whether explosions leave secondary fires.Explosion Fires Enabled isChecks whether the fire with the given number is still burning.Fire Burning isChecks whether fire spreads to nearby spots (Fire Spread Enabled setFireSpreadEnabled).setEnables or disables secondary fires after explosions (Explosion Fires Enabled createExplosion, a vehicle exploding). The fires are the same for all players. Enabled by default.setDecides whether fire spreads to nearby spots (grass, vehicles next to it). The setting works the same for every player. Fire spreads by default.Fire Spread Enabled
Game engine 1
Input and controls 7
getReturns the keys a player has bound to commands (Bound Keys bindKeywith a command name) as a key -> command table.getReturns the server's built-in commands, the ones no resource adds (e.g.Builtin Commands me,pm,kick). With a player it returns only the commands that player may use according toadmins.xml. Useful for a custom chat that recognises commands itself.getReturns the names of commands registered by a resource, or by every resource without an argument.Command Handlers getReturns the commands bound to a player's key.Commands Bound To Key getReturns the control state set withControl State setControlState.getReturns the first key a player has bound to a command.Key Bound To Command setPresses or releases a game control for a player, as if they held the key (e.g.Control State acceleratespeeds up the car,forwardswalks forward). The state lasts until you change it.
Lights 14
createCreates a light element: a point light (type 0, shines in all directions) or a spot light (type 1, with a direction), with a radius and colour.Light createCreates a searchlight beam: a real Unreal spot light shining from a start point to an end point, like a police helicopter searchlight or stadium lights. The cone width comes from the end radius and the distance; brightness adjusts itself to the beam length. Everyone in the same interior and dimension sees it.Search Light createCreates a rope that a SWAT team rappels down from a helicopter. TheSWATRope ropeelement disappears by itself after the given time.getReturns the light colour.Light Color getReturns the spot light direction.Light Direction getReturns the light radius in metres (3 by default).Light Radius getReturns the light type: 0 point, 1 spot.Light Type setChanges the light colour.Light Color setChanges the spot light direction (a vector, e.g. 0, 0, -1 = down).Light Direction setChanges the light radius (0-255 m).Light Radius setPoints the searchlight at a new spot.Search Light End Position setSets the radius of the light spot at the beam's end (0-255 m); larger gives a wider cone.Search Light End Radius setMoves the searchlight beam's source (e.g. following a helicopter).Search Light Start Position setSets the beam radius at the source (0-255 m).Search Light Start Radius
Maps 3
loadCreates elements (vehicles, objects, markers, pickups...) from an XML map node inMap Data .mapformat. Returns the map root element; destroying it removes the whole map.resetRestores the default world settings: 12:00, weather 0, gravity and world properties.Map Info saveSaves the elements under a given element to an XML node inMap Data .mapformat.
Markers 8
getReturns the marker icon set withMarker Icon setMarkerIcon("none","arrow","finish").getReturns the marker's target point set withMarker Target setMarkerTarget.getReturns the arrow look stored withMarker Target Arrow Properties setMarkerTargetArrowProperties.isReturns the value fromCorona Reflection Enabled setCoronaReflectionEnabled.setStores whether a corona (glowing marker) should reflect in water and on wet roads.Corona Reflection Enabled setSets the icon of a ring or checkpoint:Marker Icon "none","arrow"(arrow to the next point) or"finish"(finish flag).setSets the point a ring or checkpoint points at (in races - the next point on the route). Without coordinates it removes the target.Marker Target setStores the look of the arrow above a checkpoint that points to the target: size and colour.Marker Target Arrow Properties
Miscellaneous 39
addAttaches a function to events or function calls, for tracing and profiling.Debug Hook preEventandpostEventwork for events,preFunctionandpostFunctionfor the functions in a name list (the list is required then). ApreEventorpreFunctionfunction can return"skip"to block the event or the call.clearRemoves the visibility limits set withElement Visible To setElementVisibleTo, so everyone sees the element again.createCreates a rectangular radar area (e.g. a gang turf) in an RGBA colour. The area exists on the server: it has a colour, a size, flashing andRadar Area isInsideRadarArea, but the current client version does not draw it on the radar yet.derefReturns the value stored byrefunder a number.getReturns the reason given inCancel Reason cancelEvent(true, reason)by the last event cancellation, e.g. the reason for rejecting a connection inonPlayerConnect.getReturns the LOD object assigned withLow LODElement setLowLODElement.getReturns network statistics for the server or one player: bytes and packets sent and received. The packet loss and buffer fields are zeros for now.Network Stats getReturns the radar area colour.Radar Area Color getReturns the radar area width and height.Radar Area Size getReturns how much player synchronisation has cost since the last call: the number of cycles (Sync Cost ticks), the average and longest cycle time in ms (avgMs,maxMs), states per cycle (statesPerTick) and the measured time (seconds). Helps to find server hitches.getTells what kind a handle is:Userdata Type element,lua-timer,resource-data,xml-node,text-displayand others.isChecks whether a point (x, y) lies inside the radar area.Inside Radar Area isChecks whether the resource has the object syntax (OOPEnabled <oop>true</oop>, e.g.player:getName()). In Trilogy Hub it always returnsfalse; use functions (getPlayerName(player)).isChecks whether the radar area is flashing.Radar Area Flashing passwordCreates a secure password hash (scrypt; the result starts withHash $scrypt$) to store in a database instead of the password. The same text gives a different hash every time; check it withpasswordVerify. With a callback the hash goes to it.passwordChecks whether a password matches a hash fromVerify passwordHash. With a callback the result goes to it.refReturns a number under which a value (e.g. an element) is stored, so you can pass it on as a number.derefturns it back. The same value always gets the same number.removeDetaches a function added withDebug Hook addDebugHook.resetRestores the default fog distance (100).Fog Distance resetRestores the default moon size (3).Moon Size resetRestores the default rain level (0).Rain Level setSets the maximum flight height of planes and helicopters (0-10000). The value is stored for compatibility with existing scripts (Aircraft Max Height getAircraftMaxHeight) but does not change the in-game limit yet.setSets the maximum plane speed (0-100, 1.5 by default). The value is stored for compatibility with existing scripts (Aircraft Max Velocity getAircraftMaxVelocity) but does not change the in-game limit yet.setTurns clouds on or off. The value is stored for compatibility with existing scripts (Clouds Enabled getCloudsEnabled) but does not change the in-game sky yet.setPuts a weapon the ped already has into its hand (weapon number, e.g. 31 = M4; 0 = fists). Another name:Current Weapon setPedWeaponSlot.setSets the fog distance (-1000 to 1000). The value is stored for compatibility with existing scripts (Fog Distance getFogDistance), but Trilogy Hub does not change the in-game fog yet.setSets the frames per second limit (0-32767). The value is stored for compatibility with existing scripts (FPSLimit getFPSLimit) but does not cap the in-game frames yet; the player sets the limit in the game options.setChanges the game speed for every player:Game Speed 1is normal,0.5slow motion,2twice as fast (at most 10). It affects movement, animations and physics.setTurns interior sounds (music and chatter in buildings) on or off. The value is stored for compatibility with existing scripts (Interior Sounds Enabled getInteriorSoundsEnabled) but does not change the in-game sound yet.setSets how high you can fly with a jetpack. The value is stored for compatibility with existing scripts (Jetpack Max Height getJetpackMaxHeight) but does not change the in-game limit yet.setAssigns an object its simplified version seen from afar (LOD). In Trilogy Hub draw distances are computed by Unreal Engine, so the assignment is stored for compatibility with existing scripts (Low LODElement getLowLODElement) but does not change the in-game look.setEnables or disables the ESC map for the whole server. For a single player useMap Enabled setPlayerMapEnabled.setSets the moon size 0-100. The value is stored for compatibility with existing scripts (Moon Size getMoonSize) but does not change the in-game sky yet.setChanges the radar area colour, e.g. when another gang takes over the turf.Radar Area Color setTurns radar area flashing on or off (e.g. during a turf war).Radar Area Flashing setChanges the radar area size.Radar Area Size setSets the rain level 0-10. The value is stored for compatibility with existing scripts (Rain Level getRainLevel) but does not change the in-game rain; rain comes from the weather (setWeather).showAnother name forPlayer Hud Component setPlayerHudComponentVisible: shows or hides a game HUD component for a player (e.g."radar","money","health","all").warnA standard Lua 5.4 function: emits a warning made of its arguments. Lua warnings are off by default (warn("@on")turns them on) and go to the server process error output. For messages to script authors useoutputDebugString.
Objects 11
breakBreaks a breakable object: the object disappears for players and the server firesObject onObjectBreak. Does nothing for unbreakable objects.createCreates a static building from a model - a lighter element than an object, without physics, meant for large maps.Building getReturns the object mass stored withObject Mass setObjectMass(1 by default).getReturns a physical property stored withObject Property setObjectProperty;"all"returns a table of all of them.isReturns whether the object's respawn was enabled withObject Respawnable toggleObjectRespawn.resetPuts map objects back in their original places for all players (e.g. cleaning up after a riot). Takes one key fromMap Objects getMapObjects, a list of keys, or nothing - then all of them.respawnReturns an object to the place stored withObject toggleObjectRespawn(object, true), repairs it and shows it again. FiresonObjectRespawn.setTurns synchronisation of San Andreas map objects between players on or off. On (default): when someone knocks over a hydrant or smashes a barrel, others see the same. Off: each player sees their own object state.Map Object Sync Enabled setStores the object mass (it affects the reaction to hits).Object Mass setStores an object physical property:Object Property "mass","turn_mass","air_resistance","elasticity","center_of_mass","buoyancy".toggleTurns an object's respawn on or off. When turned on it stores the current position and rotation thatObject Respawn respawnObjectreturns to.
Peds 73
canReturns the value set withPed Be Knocked Off Bike setPedCanBeKnockedOffBike.trueby default.getAn alias ofAnalog Control State getPedAnalogControlState, kept for compatibility with existing scripts. Returns the analog control strength 0-1.getReturns a list of every bone number the server understands (1-8, 21-26, 31-36, 41-44, 51-54). Useful for looping over bones or checking whether a number typed in a command is valid.Bone IDs getReturns the English name of the bone with the given number, e.g. 8 →Bone Name "Head", 25 →"RightHand", 2 →"Pelvis". Returnsfalsewhen the number does not exist.getReturns the world point a ped is aiming at, as reported by the player's game. ReturnsPed Aim Target falsewhen the game has not sent an aim point yet.getReturns the strength of a ped's analog control (0-1) set withPed Analog Control State setPedAnalogControlState. 0 means the control is not pressed.getReturns the element an NPC is currently attacking (set withPed Attack Target setPedAttackTargetor picked by an aggressive NPC after being hurt). Returnsfalsewhen the NPC is not fighting.getReturns the ped camera heading stored withPed Camera Rotation setPedCameraRotation(0 by default). It does not read the player's real camera.getReturns the element a ped is standing on, e.g. a vehicle or an object (when a player stands on a bus roof it returns the bus). ReturnsPed Contact Element falsewhen the ped stands on regular map ground.getChecks whether a ped's control is pressed according to the state set by scripts (Ped Control State setPedControlStateorsetPedAnalogControlState). It does not read the keys a player physically presses; usegetControlStateon the client for that.getReturns at once a list of every ped control that scripts set as pressed. Handy for debugging NPCs or for saving and later restoring their state.Ped Control States getReturns the fighting style stored withPed Fighting Style setPedFightingStyle(15 by default).getReturns the ped gravity stored withPed Gravity setPedGravity(0.008 by default).getReturns the point a ped should look at according to the lastPed Look At setPedLookAt, and the time (ingetTickCountunits) until which the look lasts. Returnsfalsewhen nothing was set.getEstimates how a ped is moving right now:Ped Move State stand,walk,powerwalk,jogorsprint. The result follows from the ped's speed, or from thewalk/sprintcontrol when a script pressed it. Useful e.g. for fatigue or footstep noise systems.getReturns the oxygen value stored withPed Oxygen Level setPedOxygenLevel(0-1000). 1000 by default. It does not read the in-game oxygen bar.getReturns the name of the most recently set task (across all layers), i.e. what the ped is doing right now according to scripts. ReturnsPed Simplest Task falsewhen the ped has no tasks.getReturns the element a ped is aiming at (a player, an NPC or a vehicle), as reported by the player's game. ReturnsPed Target falsewhen the ped is not aiming at any element.getTraces a ped's line of fire (fromPed Target Collision getPedTargetStarttogetPedTargetEnd) and returns the first point where it hits a building, vehicle, ped or object. Returnsfalsewhen nothing is in the way.getReturns the end point of a ped's line of fire: the target set withPed Target End setPedAimTarget, or when none, a point 100 m ahead of the ped in the direction it faces.getReturns the point where a ped's line of fire starts, i.e. the approximate muzzle position (same asPed Target Start getPedWeaponMuzzlePosition). Together withgetPedTargetEndit defines the bullet path.getReturns the task stored in a layer byPed Task setPedTask: its name, data and the moment (ingetTickCountunits) it was set. Returnsfalsewhen the layer is empty.getReturns a table of all of a ped's task layers as "layer → task name". Useful to see what scripts told an NPC to do.Ped Tasks getReturns a pedestrian's current appearance variant: the clothing number and the skin number (both 0-3). Returns 0, 0 when no variant was set.Ped Variant getReturns the voice bank type and name stored withPed Voice setPedVoice. Returnsfalsewhen no voice was set.getReturns the walking style stored withPed Walking Style setPedWalkingStyle(0 by default).getReturns the approximate muzzle position of a ped's weapon: a point about 45 cm in front of the ped at shoulder height, in the direction it faces. The server does not know the exact arm pose, so this approximation is good enough for effects and simple line-of-fire checks.Ped Weapon Muzzle Position getReturns every weapon a ped owns, together with its ammo. The first value is a list of weapon IDs (one per occupied slot), the second is a table "weapon ID → ammo count". Useful for saving a player's inventory to a database before they leave.Ped Weapons getReturns the slot number (0-12) of the weapon a ped is currently holding. The slot follows from the weapon type: e.g. handguns are slot 2, assault rifles slot 5. When the ped is holding fists it returns 0.Ped Weapon Slot giveGives a ped a weapon with ammo, exactly likePed Weapon giveWeapon(it is the same function under another name). If the ped already has a weapon in the same slot, it is replaced, while ammo for the same weapon adds up.isChecks whether an NPC is aggressive, i.e. whether it fights back on its own when someone hurts it. Aggression is set withPed Aggressive setPedAggressiveor the seventh argument ofcreatePed.isChecks whether a ped is aiming a weapon (holding the right mouse button or aiming on a gamepad). The state comes from the player's game and refreshes several times per second.Ped Aiming isReturns the value set withPed Bleeding setPedBleeding.falseby default.isReturns the choking state stored withPed Choking setPedChoking.falseby default. The game does not set this state by itself (tear gas does not change it), so it reflects only what scripts have set.isChecks whether any of a ped's task layers holds a task with the given name (stored byPed Doing Task setPedTaskor by functions such assetPedEnterVehicle, which storeenterVehicle).isReturns the value set withPed Foot Blood Enabled setPedFootBloodEnabled.falseby default.isChecks whether a ped is frozen, i.e. cannot move or fall. Freezing is set withPed Frozen setElementFrozen; the player's game applies it immediately.isReturns the value set withPed Headless setPedHeadless.falseby default.isChecks whether a ped is standing on the ground. ReturnsPed On Ground falsewhen the ped is jumping, falling, swimming, sitting in a vehicle or flying a jetpack. The state comes from the player's game.isChecks whether a ped is reloading right now. For a player it uses the state sent by their game, and it also returnsPed Reloading Weapon truefor the time set withsetPedReloadingWeapon. Useful e.g. to block actions while reloading.isReturns the value set withPed Targeting Marker Enabled setPedTargetingMarkerEnabled.trueby default.killInstantly kills a player or an NPC: sets health to zero and fires the death event (Ped onPlayerWastedfor a player,onPedWastedfor an NPC) with the given killer, weapon and body part. Scripts that count kills or hand out rewards therefore see the death as if someone really shot the ped. Nothing happens when the ped is already dead.playSends every player thePed Voice Line onClientPedVoiceevent with the ped and the line name. The function itself does not play any sound: a client script plays the line, e.g. withplaySound3Dfrom a resource sound file attached to the ped. This lets you build custom NPC dialogue heard by everyone nearby.removeInstantly takes a player or an NPC out of a vehicle and places them next to it, without the get-out animation. It firesPed From Vehicle onPlayerVehicleExitjust like a normal exit and blocks the player from getting back in for 3 seconds so the game does not put them back. Returnsfalsewhen the ped is not in a vehicle.resetRemoves the voice stored withPed Voice setPedVoice, i.e. returns the ped to its model's original voice. AfterwardsgetPedVoicereturnsfalse.setAn alias ofAnalog Control State setPedAnalogControlState, kept for older scripts. It takes the same arguments: ped, control name and strength 0-1.setTurns an NPC's aggression on or off. When an aggressive NPC gets hurt by someone (a player or another ped), it starts attacking the attacker on its own, as if a script calledPed Aggressive setPedAttackTarget. A non-aggressive NPC (the default) takes damage and does not react. Works only for NPCs (ped), not for players.setStores the point a ped should aim at. The value is for scripts:Ped Aim Target getPedTargetEnd(and indirectlygetPedTargetCollision) returns it, but the game itself does not turn the ped's weapon that way.setSets a ped's analog control within 0-1, i.e. how hard it is "pressed" (e.g. 0.5 = half throttle). The value is stored for scripts; in addition any value above 0 presses the regular control of that name and 0 releases it, so for NPCsPed Analog Control State forwards,backwardsandsprintwork in the game as withsetPedControlState(without graded strength).setSets a ped's armour (body vest) on a 0-100 scale. The value goes straight to the player's game, so the armour bar on screen changes immediately. Values outside the range are clamped to 0-100. This is the same function asPed Armor setPlayerArmour.setMakes an NPC attack a player or another ped: the NPC walks up and punches or shoots with the weapon in its hand until the target dies, disappears or a script stops the fight. The fight is simulated by one player's game (the target player or the nearest player in the same dimension), so the NPC behaves the same for everyone. PassingPed Attack Target nilorfalseends the fight. The fight also ends by itself when the target dies, leaves the server or is destroyed.setTurns a ped's bleeding on or off. A bleeding player leaves blood drops on the ground in their game while moving (like wounded peds in the game). Health does not drop from bleeding alone. For NPCs the value is stored for scripts and returned byPed Bleeding isPedBleeding.setStores a ped's camera heading in degrees (-360 to 360). In Trilogy Hub this is state for scripts returned byPed Camera Rotation getPedCameraRotation; the player's camera does not turn. Use the Camera functions such assetCameraMatrixto control a player's camera.setSets whether a ped can be knocked off a motorbike or bicycle in a crash. For a player the setting works in their game. For NPCs the value is stored and returned byPed Can Be Knocked Off Bike canPedBeKnockedOffBike.setStores on the server whether a ped is choking (e.g. from tear gas in GTA). In Trilogy Hub this is state for scripts: the server remembers it and returns it fromPed Choking isPedChoking, but the game does not play a coughing animation or take health yet. If choking should have effects, implement them in a script, e.g. a timer that lowers health plussetPedAnimationwith a coughing animation.setPresses or releases a virtual control of a ped, e.g.Ped Control State forwards(walk forward) orsprint. For NPCs every player's game carries outforwards,backwardsandsprint, so the ped walks or runs the way it faces; other control names are stored for scripts and returned bygetPedControlState. Names are the same as inbindKey/toggleControl(e.g.fire,jump,crouch,walk).setStores whether a ped should be shooting from a vehicle window (drive-by). In Trilogy Hub this is state for scripts returned byPed Doing Gang Driveby isPedDoingGangDriveby; the game does not switch the ped into drive-by mode based on it.setTakes a ped out of its vehicle on the server, records its "exit vehicle" task and sends every client thePed Exit Vehicle onClientPedExitRequestevent (ped, vehicle). The exit works likeremovePedFromVehicle, i.e. instantly, without the door animation. Returnsfalsewhen the ped is not in a vehicle.setSets a ped's melee fighting style (4 = standard, 5 = boxing, 6 = kung fu, 7 = knee to head, 15 = grab and kick, 16 = elbows). A player gets this style in their game (as after gym training). For NPCs the value is stored and returned byPed Fighting Style getPedFightingStyle. Values outside 4-16 are rejected.setStores whether a ped should leave bloody footprints (like after stepping in a pool of blood in GTA). In Trilogy Hub this is state for scripts returned byPed Foot Blood Enabled isPedFootBloodEnabled; the game does not draw footprints based on it.setStores the gravity of a single ped (0.008 by default, the same as world gravity). In Trilogy Hub this is state for scripts returned byPed Gravity getPedGravity; only the whole world's gravity set withsetGravityaffects how peds move.setStores whether a ped should be headless (like after a sniper shot in GTA). In Trilogy Hub this is state for scripts returned byPed Headless isPedHeadless; the game does not remove the head from the ped model yet.setTurns a ped toward the given point and remembers where and for how long it should look. The body turn happens immediately (the ped's heading changes), while the point, time and element are stored for scripts and returned byPed Look At getPedLookAt; the game does not additionally turn the head. To keep following a target with the eyes usesetPedFocus.setStores a ped's underwater oxygen on a 0-1000 scale (1000 = full lungs). In Trilogy Hub this is state for scripts returned byPed Oxygen Level getPedOxygenLevel; the in-game oxygen bar does not change. Values outside 0-1000 are rejected.setMarks a ped as reloading for the given time. It does not start any animation in the game; it is a flag for scripts read byPed Reloading Weapon isPedReloadingWeapon, e.g. when your own weapon system needs its own reload time. A time of 0 or less clears the flag.setSets a San Andreas stat for a ped within 0-1000. For a player the change reaches their game immediately, so e.g. raising a weapon skill (69-79) to 999 enables dual-wielding pistols, and stat 24 raises max health. The value is also stored on the server and returned byPed Stat getPedStat.setStores whether a targeting marker (the triangle above the locked-on person's head) should be visible above a ped's target. In Trilogy Hub this is state for scripts returned byPed Targeting Marker Enabled isPedTargetingMarkerEnabled; the game does not hide the marker based on it.trueby default.setStores a "task" for a ped in a chosen layer, e.g.Ped Task primary="enterVehicle", together with any data. It is a mechanism for scripts (e.g. your own NPC AI): the game does not carry out stored tasks by itself, but other scripts can read them withgetPedTask,getPedTasks,isPedDoingTaskandgetPedSimplestTask. Passingnilas the name clears the task from the layer.setSets a pedestrian's appearance variant: the set of clothes and the skin tone. Every ped model in the Definitive Edition has 4 clothing variants (0-3) and 4 skin variants (0-3); the change is visible to every player. An omitted argument is randomised, which is whyPed Variant createPedgives each NPC a random look. Works for NPCs and for players using a ped skin.setStores a voice bank type and name for a ped (e.g. typePed Voice "PED_TYPE_GEN"and name"VOICE_GEN_BBDYG1"). The value is for scripts and comes back fromgetPedVoice; the Definitive Edition game does not change the ped's lines based on it yet. Custom lines can be played withplayPedVoiceLineand a client script.setStores a ped's walking style as a San Andreas walk animation number (e.g. 54 default, 118 man, 121 gang member, 129 woman). In Trilogy Hub this is currently state for scripts returned byPed Walking Style getPedWalkingStyle; the game does not change the way the ped walks based on it yet. Values outside 0-138 are rejected.setSwitches the weapon in a ped's hand to the one in the given inventory slot, as if the player scrolled the mouse wheel. The slot must contain a weapon; an empty slot (except 0, i.e. fists) givesPed Weapon Slot false. The change reaches the player's game immediately.warpInstantly puts a player or an NPC into the chosen vehicle seat, without walking up and without the get-in animation. If the ped was in another car, it is taken out of it first. When the chosen seat is occupied by someone else, nothing happens and the function returnsPed Into Vehicle false. The player's game receives the order immediately, and the server blocks the player from getting out on their own for 3 seconds so the warp is not undone. An NPC in a vehicle always stays seated: while it is in the car, its body has no collision (only bullets hit it), walking and turning wait until it leaves the car, and if the game takes it out of the seat, the client puts it back at once.
Permissions (ACL) 26
aclCreates an access control list (ACL) with the given name. A list holds rights, and groups connect lists with players and resources.Create aclSavestores the changes.aclCreates a permission group. Add lists (Create Group aclGroupAddACL) and objects (aclGroupAddObject) to the group.aclDeletes an access list and detaches it from groups.Destroy aclDeletes a permission group.Destroy Group aclReturns the access list with the given name.Get aclReturns the group with the given name.Get Group aclReturns the access list name.Get Name aclChecks whether a list grants a right. Also returnsGet Right falsewhen there is no entry.aclAdds an access list to a group.Group Add ACL aclAdds an object to a group: the stringGroup Add Object "user.accountname","resource.resourcename", a player or a resource.aclReturns the group name.Group Get Name aclReturns all permission groups.Group List aclReturns the access lists belonging to a group.Group List ACL aclReturns the objects belonging to a group (e.g.Group List Objects "user.jan").aclDetaches an access list from a group.Group Remove ACL aclRemoves an object from a group.Group Remove Object aclChecks whether there are ACL changes not yet saved to disk.Has Unsaved Changes aclReturns all access lists.List aclReturns the rights of a list, optionally of one kind only.List Rights aclReturns the groups an object (player, account or resource) belongs to.Object Get Groups aclReloads the ACL from disk, discarding unsaved changes.Reload aclRemoves a right entry from a list.Remove Right aclSaves the ACL toSave acl.jsonin the server folder.aclSets a right on a list. Right names:Set Right "command.name","function.name","resource.name"or your own ("general.name"). The fourth argument sets an expiry.hasChecks whether an object has a right. It first looks at the ACL lists of the object's groups; if none has an entry, theObject Permission To admins.xmllevels decide, and finally the default value.isChecks whether an object belongs to a permission group (created by script or from theObject In ACLGroup admins.xmllevels).
Pickups 6
getReturns the time (ms) after which a collected pickup comes back.Pickup Respawn Interval isChecks whether a pickup is currently visible and collectable (rather than waiting to come back after being collected).Pickup Spawned setChanges the amount of ammo in a weapon pickup.Pickup Ammo setSets the time (ms) after which a collected pickup reappears.Pickup Respawn Interval setChanges an existing pickup's type and contents without recreating it.Pickup Type amountandammomean the same as increatePickup.useCollects a pickup manually, as if a player walked into it: gives the contents, firesPickup onPickupUseand hides the pickup for its respawn time. Without a player the pickup is only hidden.
Players 79
countReturns the number of players in a team.Players In Team forceForces the map open for a player (or everyone:Player Map root).getReturns the players who are alive and in the world.Alive Players getReturns the players who are dead or have not spawned yet.Dead Players getReturns the names of game HUD components that can be hidden separately:Hud Component Names ammo,armour(orarmor),breath,clock,health,money,weapon,wanted,area_name,vehicle_name,radio,radar,all.getReturns the player's account. When the player is not logged in, it returns a guest account.Player Account getReturns the last anti-cheat information reported by the client on join.Player ACInfo getReturns the player's risk level from the anti-cheat (Trilogy Protect): a table with the fieldsPlayer ACRisk points(risk points),violations(number of detected violations) andbyRule(number of violations per rule). Read only: a script can use it e.g. to notify admins, but it does not affect the protection's kicks and bans.getReturns the player's level fromPlayer Admin Level admins.xml:"player","moderator","admin"or"owner".getReturns a value announced for the player (e.g. in the server list).Player Announce Value getReturns the player's armour (0-100).Player Armour getReturns the motion blur level set for the player (0-255, default 36).Player Blur Level getReturns the number of players on the server.Player Count getReturns a HUD component appearance property set withPlayer Hud Component Property setPlayerHudComponentProperty.getReturns how many milliseconds the player has been idle (not moving or pressing keys).Player Idle Time getReturns the player's IP address.Player IP getReturns the player's language chosen in the launcher (the same one the client sees inPlayer Localization getLocalization). Useful for sending messages to everyone in their own language. A player with an older client gets Polish.getReturns the world rectangle shown on the player's open map.Player Map Bounding Box getReturns the player's map opacity (0-255).Player Map Opacity getReturns the colour of the nametag above the player's head.Player Nametag Color getReturns the nametag look set for the player withPlayer Nametag Style setPlayerNametagStyle(a table with the fieldsenabled,distance,showDistance,scale,color,background).getReturns the players whose data value under a key equals the given one.Players By Data getReturns the level of script debug messages the player sees (0-3).Player Script Debug Level getReturns the player's Client ID: a stable device identifier that cannot be forged. Use it for bans and linking accounts.Player Serial getReturns the players in a team.Players In Team getReturns the player's team.Player Team getReturns the player's client version.Player Version getReturns the list of the player's voice recipients.Player Voice Broadcast To getReturns the player's voice channel set withPlayer Voice Channel setPlayerVoiceChannel.getReturns the list of players this player does not hear (set withPlayer Voice Ignore From setPlayerVoiceIgnoreFrom).getReturns a random player from the server.Random Player giveGives the player money.Player Money isChecks whether a player is exempt from cheat detection byPlayer ACExempt setPlayerACExempt.isChecks whether a player is still on the server. Useful in delayed functions.Player Connected isChecks whether the player's crosshair is visible. The game does not allow hiding the crosshair on its own, so it is visible as long as the whole HUD (Player Crosshair Visible "all") is.isChecks whether the player has entered the world (after the first spawn).Player In World isReturnsPlayer Loading trueuntil the player enters the world for the first time. After the first spawn it isfalsefor good. UnlikeisPlayerSpawnedit does not go back totrueafter death.isChecks whether the player can open the map.Player Map Enabled isChecks whether the map is forced for the player byPlayer Map Forced forcePlayerMap.isChecks whether the player has the map open right now.Player Map Visible isChecks whether a player is muted in chat.Player Muted isChecks whether the player has the game's in-vehicle radio on.Player Radio Enabled isChecks whether slow motion is on for the player: on the weapon wheel (Player Slow Motion Enabled "wheel"), on stunts ("stunt") or both ("all").isChecks whether the player is in the world and alive. After death it returnsPlayer Spawned falseuntil the next spawn.isChecks whether the player gets tired when sprinting (no by default).Player Stamina Enabled redirectMoves a player to another server. Without an address it reconnects them to the same one.Player resendAsks the client to resend anti-cheat information.Player ACInfo resendAsks the client to resend the list of game modifications.Player Mod Info resetRestores a HUD component's default appearance (one property or all of them).Player Hud Component Property setTurns cheat detection off or on for a player. Use it when a resource intentionally gives a player flying, aim assistance or unusual movement, so the protection does not treat it as cheating. Admins are exempt automatically. The exemption lasts until the player leaves the server.Player ACExempt setSets a value announced for the player, e.g. a score shown in the server list.Player Announce Value setSets the player's armour (0-100).Player Armour setSets the motion blur for a player (0-255,Player Blur Level rootfor everyone).setStores a HUD component's appearance: one property or a whole table. Properties:Player Hud Component Property posX,posY,size,fillColor,fillColorSecondary,textColor,alignment,drawBlackBorder,drawPercentage,blinkingTimeLimit,textOutline,textShadow,useFontTexture.setAllows or forbids the player to open the map.Player Map Enabled setStores the player's map opacity (0-255).Player Map Opacity setSets the player's money. The in-game counter shows the server's balance.Player Money setMutes or unmutes a player in chat.Player Muted setChanges the player's nickname. FiresPlayer Name onPlayerChangeNick.setSets the colour of the nametag above the player's head (everyone sees it; it takes precedence over the colour fromPlayer Nametag Color setPlayerNametagStyle). The player's nickname in chat uses this colour too.setShows or hides the player's nametag.Player Nametag Showing setSets the look of the built-in nametags above other players' heads as seen by this player (or everyone:Player Nametag Style root). Pass only the fields to change; the rest stay. Fields:enabled(bool,falsehides the built-in nametags, e.g. when a resource draws its own withdxDrawText),distance(metres, 0 = no limit),showDistance(bool, the "12 m" suffix after the nickname),scale(0.4–4, text size),color(a colour fromtocolororfalse= default colour),background(a background colour fromtocolororfalse= no background). A single player's colour, text and hiding (setPlayerNametagColor,setPlayerNametagText,setPlayerNametagShowing) take precedence over the style. After reconnecting set the style again.setChanges the nametag text.Player Nametag Text falserestores the nickname.setTurns the game's in-vehicle radio on or off for a player (or everyone:Player Radio Enabled root). Off gives silence instead of GTA stations, for your own script radio.setSets which script debug messages the player sees (0 none, 1 errors, 2 plus warnings, 3 everything).Player Script Debug Level setTurns slow motion on or off for a player: on the weapon wheel (Player Slow Motion Enabled "wheel"), on stunts ("stunt") or both.setTurns sprint stamina on or off for a player (or everyone:Player Stamina Enabled root). Off by default, so the character runs without getting tired.setAssigns a player to a team.Player Team nilorfalseremoves them from the team. FiresonPlayerTeamChange.setSets who hears the player's voice: one element, a list of elements, orPlayer Voice Broadcast To nil(everyone).setSets a player's voice channel. InPlayer Voice Channel "channels"mode players with the same channel hear each other anywhere on the map, like over a radio, while nearby players still hear each other normally in 3D. In other modes the channel has no effect.nilor an empty string removes the player from the channel.setSets whom the player does not hear.Player Voice Ignore From setMutes or unmutes a player in voice chat. A muted player's voice is not sent to anyone. Muting set with this function takes priority overPlayer Voice Muted mutedByDefaultin the server settings.setSets the player's wanted level (0-6 stars).Player Wanted Level setTurns voice chat on or off on the server.Voice Enabled setChanges one voice chat setting. The change takes effect immediately for all players. Names and ranges are the same as inVoice Setting getVoiceSettings; numbers out of range are clamped (e.g.range500 gives 250).pushToTalkKeyis a key name like inbindKey("z","lalt","mouse4","f5") and is only the default key: a player who picked their own in the ESC menu keeps it.setChanges several voice chat settings at once. The others stay unchanged. If any value is bad, nothing is changed.Voice Settings spawnSpawns a player at the given place: position, rotation, skin, interior and dimension.Player takeTakes money from the player.Player Money takeTakes a screenshot of the player's game (JPEG, without the overlay). The result arrives in thePlayer Screen Shot onPlayerScreenShotevent.
Projectiles 8
createCreates a projectile element on the server (grenade, rocket, Molotov, satchel charge, etc.) with a creator, type, force and target. FiresProjectile onProjectileCreation. The type is a weapon ID, e.g. 16 grenade, 17 tear gas, 18 Molotov, 19 rocket, 20 heat-seeking rocket, 39 satchel.detonateDetonates all satchel charges (type 39 projectiles) placed by a player; without a player, all on the server. Each explodes at its position and disappears.Satchels getReturns the projectile counter in ms (time to explosion set withProjectile Counter setProjectileCounter; 0 = none).getReturns the element that fired the projectile.Projectile Creator getReturns the force the projectile was created with (1 by default).Projectile Force getReturns the target of a homing projectile.Projectile Target getReturns the projectile type (weapon ID).Projectile Type setSets the projectile's time to explosion in ms. When it runs out, an explosion matching the projectile type happens at its position and the projectile disappears.Projectile Counter
Resources 35
abortAborts a running HTTP request. In the current server version it cannot be aborted yet: the function returnsRemote Request falsewith a warning, and the request ends by itself after thefetchRemotetimeout.addAdds a config file (Resource Config <config src type>) to themeta.xmlof a resource – your own, or one this script created withcreateResource. Adding the same file twice changes nothing.addAdds a map file (Resource Map <map src dimension>) to themeta.xmlof a resource – your own, or one this script created withcreateResource. The map loads the next time the resource starts.callCalls a function exposed by another server over HTTP (arguments go as JSON in a POST request). In the current server version the function does not send the request and returnsRemote false; usefetchRemotewithtoJSONinstead.copyCopies a resource under a new name. In the current server version the function is not wired up yet and returnsResource falsewith a warning.createCreates a new empty resource (a folder withResource meta.xml) inresources/, optionally in a category such as[maps]. The name may contain letters, digits,_and-; if such a resource already exists it returnsfalse. The script that created the resource may then write files in it with a":name/file"path (fileCreate,xmlCreateFile), add entries withaddResourceMap/addResourceConfigand delete it withdeleteResource. Start the new resource withstartResource; on the next server start it starts by itself.deleteDeletes a stopped resource from disk together with its folder. A script may delete only a resource it created itself withResource createResource.fetchSends an HTTP or HTTPS request and passes the response to a callback without blocking the server. WithRemote postDatait makes a POST request, without it a GET. The function gets the response body and a code:0= success, the HTTP status number on a server error,-1when there is no connection or it timed out.getReturns the state of an HTTP request: the address, progress and size. In the current server version it returnsRemote Request Info false.getReturns the running HTTP requests (of every resource or one). In the current server version the list is empty.Remote Requests getReturns the rights a resource asks for inResource ACLRequests meta.xml(aclrequestsin<info>). Each entry is a table with the right name and its state.getOpens a resource's XML config file (e.g.Resource Config <config src="settings.xml"/>frommeta.xml) and returns its root node. Read it with thexml*functions and close it withxmlUnloadFileat the end.getReturns the root of the elements a resource creates while running. In Trilogy Hub it is the same element asResource Dynamic Element Root getResourceRootElement.getReturns the handle of the resource with the given name (the folder name inResource From Name resources/), also when the resource is not running. Pass the handle tostartResource,getResourceState,calland other resource functions.getThe root of a resource's GUI elements. The GUI only exists on players' clients, so on the server the function always returnsResource GUIElement false.getReturns an attribute value fromResource Info <info>in the resource'smeta.xml, e.g.name,author,version,type,description.getReturns when the resource last started (seconds since 1970) orResource Last Start Time 0. In the current server version it always returns0.getReturns why a resource failed to start. An empty string = no error. In the current server version it always returns an empty string; load errors show up in the server console.Resource Load Failure Reason getReturns how many milliseconds the last resource load took. In the current server version it returnsResource Load Time false.getReturns the element of a map loaded from the resource'sResource Map Root Element .mapfile; its children are the objects, vehicles and other elements from that map.getReturns the resource name from its handle.Resource Name getReturns the subfolder the resource sits in insideResource Organizational Path resources/(e.g.[gamemodes]). An empty string when it sits directly inresources/.getReturns the resource's root element. Everything the resource creates is its child, and events attached to this root only concern this resource. Without an argument it returns the current resource's root (the same asResource Root Element resourceRoot).getReturns every resource in theResources resources/folder, running and stopped.getReturns the resource state:Resource State "running"when it runs or"loaded"when it is on disk but stopped. It also works on the client: there it only knows the resources running for the player, so it returns"running"orfalse.isChecks whether a resource is packed in a ZIP archive. Trilogy Hub resources are plain folders, so it always returnsResource Archived false.isChecks whether a resource hasResource Protected protected="true"in<info>inmeta.xml(a resource other scripts should not stop).refreshScans theResources resources/folder for new and changed resources. In the current server version the function is not wired up yet and returnsfalsewith a warning.removeDeletes a file from the resource folder (works likeResource File fileDeleteon a path in the resource).renameRenames a stopped resource. In the current server version the function is not wired up yet and returnsResource falsewith a warning.restartStops and immediately starts a resource, e.g. after its files changed.Resource setWrites an attribute intoResource Info <info>in the resource'smeta.xml. In the current server version the function is not wired up yet and returnsfalsewith a warning.startStarts a stopped resource. It loads its scripts, maps and files, and players download it.Resource stopStops a running resource. Its elements, timers, commands and key binds go away.Resource updateGrants or revokes a right a resource asked for. It creates the ACL listResource ACLRequest resource.name, adds it to theResourcesgroup and sets the right in it. WithbyWhoit writes to the server log who did it.
Server 23
getReturns the game type set withGame Type setGameType.getReturns the current loading screen set withLoading Screen setLoadingScreen.getReturns the map name set withMap Name setMapName.getReturns a server rule's value.Rule Value getReturns all server rules as a key → value table.Rule Values getA function for reading a setting from the server configuration file.Server Config Setting getReturns the HTTP server port. The Trilogy Hub server has no separate HTTP server (resource files reach players through the game connection), so it usually returns 0.Server Http Port getReturns the address the server listens on. UsuallyServer Ip "0.0.0.0"(all interfaces); the real address seen from the internet is given bygetServerIpFromMasterServer.getReturns the server address as seen from outside, as reported by the server list.Server Ip From Master Server getReturns the server password.Server Password getReturns the port the server accepts players on.Server Port getReturns the time since the server started, in milliseconds.Server Uptime getReturns server version information as a table.Version removeRemoves a server rule.Rule Value resetRestores the default Trilogy Hub loading screen.Loading Screen setStores the server's game type (e.g.Game Type "Roleplay","Freeroam","DM").setSets a custom server loading screen that players see while joining: a PNG/JPG image from the resource (up to 2 MB), a text and a list of tips shown in turn. The screen belongs to the resource - when it stops, the default Trilogy Hub screen returns.Loading Screen setStores the server's map name.Map Name setChanges the number of server slots at runtime (1-65535). New players are rejected when the server is full; current ones are not kicked. The change lasts until the server restarts.Max Players setStores a server rule (a key-value pair, e.g.Rule Value "discord"→"discord.gg/xyz").setA function for changing a setting in the server configuration file.Server Config Setting setSets or removes the server password at runtime. The server immediately requires the password from new players; the launcher gets the new password with the next server list report (up to 30 seconds) - until then entering the new password may fail. Players already on the server are not kicked.Server Password nil/falseremoves the password.shutdownStops the server (resources getonResourceStop, players are disconnected). The reason goes to the server log. If the server runs under hosting with automatic restart, it will start again.
SVG 6
svgCreates an SVG document (vector graphics) on the server with the given size in pixels and XML content. The document holds content that can be changed and read (e.g. generate a chart or badge and send its text to clients with an event). The optional function receives the finished document.Create svgReturns the XML content of an SVG document.Get Document XML svgReturns the SVG document size in pixels.Get Size svgReplaces the content of an SVG document. The optional function receives the document after the change.Set Document XML svgChanges the stored SVG document size in pixels.Set Size svgStores a function tied to SVG document changes (compatibility with existing scripts);Set Update Callback nilremoves it.
Teams 8
createCreates a team. The name must be unique. Teams group players, and their colour shows on the player list and above heads.Team getReturns the team colour.Team Color getChecks whether team members can hurt each other (yes by default).Team Friendly Fire getFinds a team by its exact name.Team From Name getReturns the team name.Team Name setChanges the team colour. Values outside 0-255 are clamped.Team Color setTurns damage between members of the same team on or off.Team Friendly Fire setRenames a team. The new name cannot be empty or taken.Team Name
Text displays 20
textCreates a text display: a set of texts drawn on the screens of chosen players, controlled entirely from the server (no client script). You add texts to it (Create Display textDisplayAddText) and observers - the players who see it (textDisplayAddObserver). Useful for simple messages, timers and scores.textCreates a text for a text display. The position is relative to the screen: 0 = left/top edge, 1 = right/bottom, so the text looks the same at any resolution. The text appears only after being added to a display.Create Text Item textRemoves a text display; it disappears from all observers' screens.Destroy Display textRemoves a text item (from all displays as well).Destroy Text Item textShows a display to a player (adds them to the observers).Display Add Observer textAdds a text item to a display; all the display's observers will see it.Display Add Text textReturns the players who see a display.Display Get Observers textChecks whether a player sees a display.Display Is Observer textHides a display from a player.Display Remove Observer textRemoves a text item from a display (the item still exists and can be added again).Display Remove Text textReturns a text item's colour.Item Get Color textReturns a text item's position (0-1 relative to the screen).Item Get Position textReturns a text item's priority (Item Get Priority "low","medium","high").textReturns a text item's scale.Item Get Scale textReturns a text item's text.Item Get Text textChanges a text item's colour.Item Set Color textMoves a text item (position 0-1 relative to the screen).Item Set Position textChanges a text item's priority:Item Set Priority "high"for fast-changing texts (counters),"low"for static ones.textChanges a text item's scale (size).Item Set Scale textChanges a text item's text for all observers (e.g. a countdown).Item Set Text
Utilities 17
clearSends every player theDebug Box onClientDebugClearevent (a client script can clear its debug window in it).debugFreezes the whole server for the given time (0-5000 ms). Only for testing behaviour under lag - the server does nothing during that time.Sleep getReturns the list of loaded native modules (DLLs). The Trilogy Hub server does not load modules, so the list is always empty.Loaded Modules getReturns information about a native module. The Trilogy Hub server does not load modules.Module Info getReturns how much data the server has received and sent over the network since it started.Network Usage Data getReturns basic server statistics as columns and rows (uptime, players, vehicles, objects, timers, resources, number of API functions). The category, options and filter arguments are accepted, but the data set is always the same.Performance Stats getReturns the memory used by the server's Lua scripts.Process Memory Stats isReturns the value fromChat Input Blocked setChatInputBlocked.isReturns the value fromShow Collisions Enabled showCol.isReturns the value fromShow Sound Enabled showSound.isReturns whether the download box also appears for small files.Transfer Box Always Visible pregChecks whether a text matches a regular expression (JavaScript syntax). Flags as text (Find "i"- case-insensitive,"m"- multiline,"s"- dot matches newline,"u"- Unicode) or a number.pregReturns all regular expression matches in a text. When the pattern has groups in brackets, each match is a table: the whole match followed by the groups.Match pregReplaces all fragments matching a regular expression. In the replacement,Replace $1,$2insert the groups.setStores a chat input block.Chat Input Blocked showStores turning on the collision preview for players (a tool for map makers).Col showStores turning on the sound source preview for players.Sound
Vehicles 130
addStores a set of custom siren lights for the vehicle: number of points, type and flags. After it,Vehicle Sirens setVehicleSirenssets the position and colour of each point.areReturns the value set withVehicle Doors Undamageable setVehicleDoorsUndamageable(falseby default).attachAttaches a trailer or semi-trailer to a towing vehicle (truck, tractor, tow truck) for every player. Fires theTrailer To Vehicle onTrailerAttachevent on the trailer; if a script cancels it (cancelEvent), the trailer is not attached. Players can also attach trailers normally in the game by reversing a truck onto them.blowDestroys a vehicle: health drops to 0, the engine stops, the vehicle becomes a wreck (Vehicle isVehicleBlown=true) and theonVehicleExplodeevent fires. By default every player also sees an explosion. If respawning is enabled for the vehicle (toggleVehicleRespawn, off by default), the wreck returns to its spawn point after the time set withsetVehicleRespawnDelay(10 s by default); without respawning the wreck disappears after the time fromsetVehicleWreckDelay(20 s by default). Blowing up an already destroyed vehicle does nothing.detachDetaches a trailer from the towing vehicle for every player and firesTrailer From Vehicle onTrailerDetachon the trailer. A specific trailer can be given; then the function only works if that trailer is the one attached.getReturns the names of all handling fields accepted byHandling Field Names setVehicleHandlingandsetModelHandling:mass,turnMass,dragCoeff,centerOfMass,percentSubmerged,tractionMultiplier,tractionLoss,tractionBias,numberOfGears,maxVelocity,engineAcceleration,engineInertia,driveType,engineType,brakeDeceleration,brakeBias,ABS,steeringLock, thesuspension*fields,seatOffsetDistance,collisionDamageMultiplier,monetary,modelFlags,handlingFlags,headLight,tailLight,animGroup.getReturns the value stored withHeli Blade Collisions Enabled setHeliBladeCollisionsEnabled(trueby default).getReturns the handling changes set for a model withModel Handling setModelHandling(without factory values).getReturns a model's number of passenger seats after applying the limit fromModel Max Passengers setModelMaxPassengers.getReturns the direction stored withTrain Direction setTrainDirection(trueby default).getReturns the track position stored withTrain Position setTrainPosition(0 by default).getReturns the speed stored withTrain Speed setTrainSpeed(0 by default).getReturns the track number stored withTrain Track setTrainTrack(0 by default).getReturns the movable part setting stored withVehicle Adjustable Property setVehicleAdjustableProperty(0 by default).getReturns the two palette numbers set withVehicle Color Id setVehicleColorId. When the vehicle has RGB colours fromsetVehicleColor(or none yet), it returnsfalse; usegetVehicleColorthen.getReturns the part offset stored withVehicle Component Position setVehicleComponentPosition(0, 0, 0 when not set).getReturns the part rotation stored withVehicle Component Rotation setVehicleComponentRotation(0, 0, 0 when not set).getReturns the part scale stored withVehicle Component Scale setVehicleComponentScale(1, 1, 1 when not set).getReturns the vehicle helper point position stored withVehicle Dummy Position setVehicleDummyPosition.getReturns a vehicle's entry points: those set withVehicle Entry Points setVehicleEntryPoints, or four approximate points at the sides of the vehicle (for seats 0-3) at its current position.getReturns the vehicle's gravity direction stored withVehicle Gravity setVehicleGravity(0, 0, -1 by default).getReturns after how many milliseconds an abandoned vehicle returns to its respawn point (60000 by default, 0 = off).Vehicle Idle Respawn Delay getReturns the value stored withVehicle Landing Gear Down setVehicleLandingGearDown(trueby default).getReturns the factory position of a model helper point. ForVehicle Model Dummy Default Position seat_frontandseat_rearit gives the game's factory front and rear seat position.getReturns a model helper point position set withVehicle Model Dummy Position setVehicleModelDummyPosition.getReturns a model's exhaust outlet position set withVehicle Model Exhaust Fumes Position setVehicleModelExhaustFumesPosition.getReturns the plate design set withVehicle Plate Design setVehiclePlateDesign(-1 = the game decides).getReturns how many milliseconds after destruction this vehicle's wreck respawns (10000 by default).Vehicle Respawn Delay getReturns the coordinates of the place where the vehicle appears when it respawns.Vehicle Respawn Position getReturns the rotation the vehicle will have when it respawns.Vehicle Respawn Rotation getReturns the rotor speed stored withVehicle Rotor Speed setVehicleRotorSpeed(0 by default).getReturns the value stored withVehicle Rotor State setVehicleRotorState(trueby default).getReturns the siren settings fromVehicle Siren Params addVehicleSirensas a table:SirenCount,SirenTypeandFlags(["360"],DoLOSCheck,UseRandomiser,Silent).getReturns the list of siren points stored withVehicle Sirens addVehicleSirensandsetVehicleSirens. Each point is a table with the fieldsx,y,z,Red,Green,Blue,Alpha,Min_Alpha.getReturns every existing vehicle of a model, e.g. all taxis on the map.Vehicles Of Type getReturns the trailer the given vehicle is towing.Vehicle Towed By Vehicle getReturns the vehicle that is towing the given trailer.Vehicle Towing Vehicle getReturns a vehicle's rotation speed around the x, y, z axes. This is the same function asVehicle Turn Velocity getElementAngularVelocity.getReturns the turret rotation stored withVehicle Turret Position setVehicleTurretPosition(horizontal, vertical in radians; 0, 0 by default).getReturns a wheel's grip: 0 = full, 1 = slipping, 2 = none.Vehicle Wheel Friction State getReturns the wheel size multiplier stored withVehicle Wheel Scale setVehicleWheelScale(1 by default).getReturns the wheel rotations stored withVehicle Wheels Rotation setVehicleWheelsRotation.getReturns how many milliseconds after the explosion this vehicle's wreck disappears (forVehicle Wreck Delay root: the default, initially 20000).isChecks whether a carriage is the locomotive leading the train.Train Chain Engine isReturns the value stored withTrain Derailable setTrainDerailable(trueby default).isReturns the value stored withTrain Derailed setTrainDerailed(falseby default).isChecks whether the vehicle is damage proof (Vehicle Damage Proof setVehicleDamageProof).isReturns the value set withVehicle Fuel Tank Explodable setVehicleFuelTankExplodable(falseby default).isChecks whether a vehicle has automatic respawning enabled (Vehicle Respawnable toggleVehicleRespawn).falseby default: the wreck of such a vehicle does not come back but disappears after the time fromsetVehicleWreckDelay.isReturns the value stored withVehicle Smoke Trail Enabled setVehicleSmokeTrailEnabled(falseby default).isReturns whether a window was marked as rolled down withVehicle Window Open setVehicleWindowOpen.removeRemoves the custom sirens added to the vehicle withVehicle Sirens addVehicleSirens.resetRestores the factory (or inherited from the base model) position of one seat of a model or, without a seat number, of all its seats.Model Seat Position resetClears the part offset stored withVehicle Component Position setVehicleComponentPosition.resetClears the part rotation stored withVehicle Component Rotation setVehicleComponentRotation.resetClears the part scale stored withVehicle Component Scale setVehicleComponentScale.resetClears every vehicle helper point stored withVehicle Dummy Positions setVehicleDummyPosition.resetRestarts the countdown to a wreck respawn: the wreck respawns after the full time fromVehicle Explosion Time setVehicleRespawnDelay, counted from now. When the vehicle is not a wreck waiting to respawn, the function changes nothing.resetResets the vehicle's idle counter, as if someone had just got out. The countdown to returning an abandoned vehicle (Vehicle Idle Time setVehicleIdleRespawnDelay) starts again. Useful e.g. when a player has parked the car in a garage and you want to give them more time.resetReturns all of a vehicle's lamps toVehicle Lamp States 'auto', i.e. working as in the game. Clears everything set withsetVehicleLampState.respawnImmediately respawns a vehicle at its respawn point (where it was created, or the point fromVehicle setVehicleRespawnPosition). All occupants are removed from the vehicle, its speed is zeroed, health goes back to 1000 and door, panel, lamp and wheel damage disappears. Fires theonVehicleRespawnevent. Also works for a vehicle that is not a wreck.setStores whether a helicopter's rotor blades should cut whatever they hit (peds, other vehicles).Heli Blade Collisions Enabled setStores your own list of parts that fit a vehicle model, e.g. for a new model fromModel Compatible Upgrades engineRequestModel.setChanges the handling of every vehicle of a model at once, for every player, including vehicles created later. A single car's changes fromModel Handling setVehicleHandlingtake priority over the model setting.setLimits a model's passenger seats: players cannot get into seats with a higher number (the server cancels entering). Also works for new models fromModel Max Passengers engineRequestModel. You cannot add seats the base model does not have.nilorfalseremoves the limit.setMoves a seat position in a vehicle for the whole model, for every player: where the ped sits and which way it faces. Most often used to place seats in new vehicles fromModel Seat Position engineRequestModelandengineReplaceModel, which by default have the base car's seats. The number of seats does not change.setCopies seat positions from another model to the given model, e.g. a new vehicle fromModel Seats From engineRequestModelshould seat people like a Sultan. Without a seat number it copies every seat the source has.setStores whether a train can derail (e.g. when taking a bend too fast).Train Derailable setStores whether a train is derailed.Train Derailed setStores the direction in which a train travels along the track.Train Direction setStores a train's position on the track as the distance from the start of the track.Train Position setStores a train's speed along the track.Train Speed setStores the number of the track the train runs on.Train Track setStores the setting of a vehicle's movable part: dozer blade, forklift forks, crane arm, Hydra nozzles.Vehicle Adjustable Property setSets a vehicle's colours using numbers from the San Andreas vehicle palette (0-127), as in the classic game and the carcols files. Number 0 is black, 1 white, 3 red, 6 yellow… (Vehicle Color Id getVehiclePaletteColorgives names and colours). Passing one number sets both main colours to it.setStores an offset for a named part of a vehicle model (e.g. the bonnet) relative to its position in the model.Vehicle Component Position setStores a rotation for a named part of a vehicle model in degrees (x, y, z).Vehicle Component Rotation setStores a scale for a named part of a vehicle model on three axes (1 = original size).Vehicle Component Scale setStores the position, rotation and scale of a model part in one call. Each of the three arguments is a vector or aVehicle Component Transform { x, y, z }table; an omitted one (nil) stays unchanged.setStores a vehicle's gear number.Vehicle Current Gear setMakes a vehicle damage proof for every player: collisions, shots and explosions do not take its health or break the body. Useful for showroom vehicles, city buses or vehicles in a safe zone.Vehicle Damage Proof setSets how dirty the body looks for every player: 0 = spotless, 1 = very dusty. Useful for car washes and for cars abandoned in the desert. A new vehicle fromVehicle Dirt Level createVehicleis clean.setOpens a door, the bonnet or the boot of a vehicle to the given degree for every player: 0 = shut, 1 = wide open, 0.5 = halfway. Useful e.g. in a workshop (open bonnet) or when searching the boot. Door numbering as inVehicle Door Open Ratio setVehicleDoorState.setSets the state of one door (or the bonnet or boot) of a vehicle for every player: shut, ajar, dented or missing. Door numbers: 0 bonnet, 1 boot, 2 front left, 3 front right, 4 rear left, 5 rear right. A vehicle without that door simply will not show it.Vehicle Door State setStores whether the vehicle's doors should be impossible to break off.Vehicle Doors Undamageable setStores the position of a helper point (dummy) for one vehicle, e.g. the exhaust or lights.Vehicle Dummy Position setFits a vehicle with an engine described by real-car parameters (power, torque, displacement, fuel, mass, gears) and calculates the handling fields from them: mass, top speed, acceleration, engine inertia, fuel type, number of gears and grip. An engine much stronger than the factory one reduces grip (wheelspin). Wear lowers power by up to 30%.Vehicle Engine nilrestores the factory engine. Good for tuning and engine-swap systems on RP servers.setStores custom entry points for a vehicle (a table ofVehicle Entry Points { x, y, z, seat }points).setStores whether the vehicle's fuel tank should explode when shot (shooting the tank blows the car up).Vehicle Fuel Tank Explodable setStores a custom gravity direction for a vehicle as a vector (0, 0, -1 by default, i.e. down). This allows e.g. driving on walls.Vehicle Gravity setChanges the colour of a vehicle's headlights for every player, e.g. xenon blue or yellow. It affects the glowing lenses and the light patch in front of the car.Vehicle Head Light Color setNewSets a vehicle health floor: bullets, fire, explosions and collisions will not take the health below this value. A floor of 250 or more stops the car from catching fire or exploding from damage. A script can still go lower with setElementHealth or blowVehicle. 0 turns the floor off.Vehicle Health Floor setSets after how many milliseconds an abandoned vehicle returns to its respawn point by itself. "Abandoned" means nobody is inside and it stands more than 0.5 m from the respawn point. The counter resets when someone gets in. The default is 60000 ms; 0 turns returning of abandoned vehicles off. The countdown runs for vehicles whose respawning was configured with any function from this group (e.g. this one) or which have been a wreck; a freshly created, unconfigured vehicle does not return by itself.Vehicle Idle Respawn Delay setTurns on a vehicle's indicators, which blink for every player. On vehicles with their own model (Vehicle Indicators engineReplaceModel) the lamps marked in the model with SA indicator colours blink. Game cars have no separate indicators, so the front blinks orange and the rear uses the red lens. A single lamp is set withsetVehicleLampState.setTurns one lamp (or a group of lamps) of a vehicle on, off or back to game control, for every player. This lets a script e.g. light the brake lamps when braking, the reverse lamps, or leave a single headlight working. TheVehicle Lamp State 'auto'state means the lamp works as usual in the game. An indicator set to'on'shines steadily; blinking comes fromsetVehicleIndicators. Game cars have no reverse lamps or separate indicators (the front shines orange, the rear uses the red lens); custom models fromengineReplaceModelhave all lamps.setLowers or raises a plane's landing gear. The change reaches the game of every player who has the plane loaded, also after it is loaded again. The pilot can then change the gear with the key, as usual in the game.Vehicle Landing Gear Down setBreaks or repairs one lamp of a vehicle for every player. Numbers: 0 front left, 1 front right, 2 rear left, 3 rear right. A broken lamp does not light up, even with the lights on.Vehicle Light State setStores a model's number of passenger seats on the server. The game client usually does this automatically; a script can provide it earlier soVehicle Max Passengers getVehicleMaxPassengersknows it from the start.setStores the position of a helper point (dummy) for a whole vehicle model. TheVehicle Model Dummy Position seat_frontandseat_rearpoints move the seats (front and rear) in the game for every player; other points are stored for scripts.setStores the exhaust outlet position for a whole vehicle model (vehicle space, metres).Vehicle Model Exhaust Fumes Position setStores nitro being switched on or off. Switching on uses one charge fromVehicle Nitro Activated setVehicleNitroCount(with -1 charges never run out); without charges the function returnsfalse.setStores the vehicle's number of nitro charges, used up byVehicle Nitro Count setVehicleNitroActivated.setStores the nitro charge level (like the nitro bar in the game).Vehicle Nitro Level setApplies one of the factory paintjobs from the Loco Low Co. and Wheel Arch Angels garages to a vehicle, visible to every player. Only some models have paintjobs (e.g. Elegy, Jester, Savanna, Blade); nothing changes on others. The paintjob covers the main colour.Vehicle Paintjob setSets the damage level of one body part for every player. Numbers: 0 front left wing, 1 front right wing, 2 rear left, 3 rear right, 4 windscreen, 5 front bumper, 6 rear bumper. State 0 = intact, 3 = badly damaged (a bumper may fall off).Vehicle Panel State setChooses the graphic design of the licence plate (background and state colours) for every player. Normally the game picks the design by the city where the vehicle was created; this function sets it permanently.Vehicle Plate Design setNewSets what a vehicle is immune to: bullets, fire, explosions, collisions and melee. Works for every player. AllVehicle Proofs falserestores normal behaviour. setVehicleDamageProof also makes it immune to everything at once.setSets how many milliseconds after destruction a vehicle's wreck respawns at its respawn point. The default is 10000 ms (10 s). Only works with respawning enabled (Vehicle Respawn Delay toggleVehicleRespawn). The new time applies to later explosions; for a wreck already waiting useresetVehicleExplosionTime.setSets the place (and optionally the rotation) where the vehicle appears when it respawns: after destruction, after being abandoned and onVehicle Respawn Position respawnVehicle. By default it is where the vehicle was created. The vehicle is not moved right away.setSets the rotation the vehicle will have when it respawns (the respawn position stays the same).Vehicle Respawn Rotation setStores the rotation speed of a helicopter rotor or a plane propeller.Vehicle Rotor Speed setStores whether a helicopter's rotor should spin.Vehicle Rotor State setSets the position and colour of one siren point added withVehicle Sirens addVehicleSirens.setTurns the siren and light bar of an emergency vehicle (police, ambulance, fire truck) on or off for every player, just like a player does with the horn key in the game. Nothing is visible on vehicles without a siren.Vehicle Sirens On setStores whether a smoke trail should follow a plane (e.g. Stuntplane, Cropduster).Vehicle Smoke Trail Enabled setChanges the colour of a vehicle's tail lights for every player (red by default).Vehicle Tail Light Color setTurns the "TAXI" roof light of a taxi on or off for every player (models with the light: Taxi 420, Cabbie 438). A lit sign usually means the taxi is free.Vehicle Taxi Light On setSets a vehicle's rotation speed around the x, y, z axes, e.g. to make a car spin. This is the same function asVehicle Turn Velocity setElementAngularVelocity.setStores the turret rotation of a vehicle (Rhino tank, SWAT van, fire truck): horizontal and vertical, in radians.Vehicle Turret Position setChooses the appearance variants of a vehicle model, i.e. the game's factory extras: roof rack, a different pickup bed, cargo, covers. Every model has its own number of variants (many have none). Without arguments a variant is picked at random. The change is visible to every player.Vehicle Variant setNewChanges a vehicle's wheel grip with a multiplier (1 = normal, 0.5 = half, 1.5 = half again as much). Each resource has its own multiplier and the car gets their product. 1 removes the resource's multiplier, and stopping a resource removes its multipliers by itself.Vehicle Wheel Grip setStores a multiplier for the vehicle's wheel size (1 = normal).Vehicle Wheel Scale setStores the rotation of each of a vehicle's four wheels in degrees.Vehicle Wheels Rotation setSets the state of a vehicle's wheels for every player: inflated, flat or fallen off. Argument order: front left, rear left, front right, rear right. For a bike the first two count (front, rear). Pass -1 orVehicle Wheel States nilto leave a wheel unchanged.setStores whether a vehicle window is rolled down. Window numbers 0-3.Vehicle Window Open setNewTints a vehicle's windows for every player and can give them a light colour. The darkest is 80% - a higher value also gives 80%, because the glass should still look like glass: reflections stay and you can still see a bit of the interior. The colour only tints the glass, the darkening does most of the work. Darkness 0 without a colour restores the normal windows.Vehicle Window Tint setSets how many milliseconds after the explosion a vehicle wreck disappears from the map (the element is destroyed, withVehicle Wreck Delay onElementDestroycalled; players inside fall out). The default is 20000 ms (20 s); 0 = the wreck stays forever. Passingrootchanges the default for all vehicles without their own setting. Does not apply to vehicles with respawning enabled (toggleVehicleRespawn) — those come back repaired at their respawn point.fixVehiclebefore the time runs out stops the removal. A change for a wreck already waiting restarts the countdown.spawnRespawns a vehicle once at the given spot, likeVehicle respawnVehicle: removes occupants, repairs the vehicle and zeroes its speed. The stored respawn point does not change, so later automatic respawns still go back to the old place.spawnCreates an object element at the vehicle's position and gives it the vehicle's speed with a slight random spread, as if a part had fallen off. The object disappears after the given time. The part number is stored in the element dataVehicle Flying Component flyingComponent.toggleEnables or disables automatic respawning of a vehicle. Off by default: a scripted vehicle does not come back by itself. When enabled, a wreck returns repaired to the respawn point after the time fromVehicle Respawn setVehicleRespawnDelay, and an abandoned vehicle after the time fromsetVehicleIdleRespawnDelay. Disabling it cancels a wreck respawn already waiting in the queue; a wreck without respawning disappears after the time fromsetVehicleWreckDelay(20 s by default).
Weapons 23
createCreates a scripted weapon that stands in the world and belongs to no ped. You control it withWeapon setWeaponTarget,fireWeaponandsetWeaponState.fireFires one shot from a scripted weapon at its current target. Uses one round from the clip.Weapon getReturns a weapon's factory property. The factory data lives in the game files, so it always returnsOriginal Weapon Property false. UsegetWeaponPropertyfor properties set on the server.getReturns a scripted weapon's reserve ammo (outside the clip).Weapon Ammo getReturns the number of rounds in a scripted weapon's clip.Weapon Clip Ammo getReturns a scripted weapon's fire rate multiplier (Weapon Firing Rate 1is the factory rate).getReturns a scripted weapon's flags: the whole table, or one flag when you pass its name.Weapon Flags getReturns a weapon property (e.g. damage, range) set on this server withWeapon Property setWeaponProperty.getReturns a scripted weapon's state.Weapon State getReturns a scripted weapon's target.Weapon Target giveGives a ped a weapon with ammo. If the ped already has a weapon in that slot, it is replaced.Weapon isChecks whether scripted weapons are drawn.Weapon Render Enabled resetRestores a scripted weapon's factory fire rate (multiplierWeapon Firing Rate 1).setSets ammo. For a ped it sets the ammo of a given weapon; for a scripted weapon it sets its reserve.Weapon Ammo setSets the number of rounds in a scripted weapon's clip.Weapon Clip Ammo setSets a scripted weapon's fire rate multiplier.Weapon Firing Rate setSets a scripted weapon flag (name and value) or several flags at once from a table.Weapon Flags setSets a weapon property (damage, range, accuracy and so on) for the whole server.Weapon Property setTurns drawing of scripted weapons on or off.Weapon Render Enabled setSets a scripted weapon's state.Weapon State setAims a scripted weapon at an element or a point. With no target (Weapon Target nil) it stops aiming.takeTakes every weapon from a ped.All Weapons takeTakes one weapon from a ped together with all its ammo.Weapon
World 72
createCreates a water element as an area with three or four corners. A finalWater trueargument means shallow water.getReturns the garage rectangle calculated fromGarage Bounding Box setGarageBounds: west, east, south and north limits.getReturns the garage position given withGarage Position setGarageBounds.getReturns the garage size given withGarage Size setGarageBounds.getReturns the value fromJetpack Weapon Enabled setJetpackWeaponEnabled(falseby default).getReturns the height of the lowest obstacle above a point (whether there is a roof overhead), according to the server's model: only script objects, without map buildings.Roof Position getReturns the position of a water element's corner.Water Vertex Position getReturns the numbers stored under a name withWorld Property setWorldProperty.isReturns whether an ambient sound type is enabled (yes by default).Ambient Sound Enabled isReturns whetherGame World Removed removeGameWorldwas called (and not undone).isReturns whether a glitch was enabled withGlitch Enabled setGlitchEnabled(all off by default).isChecks whether the game clock is stopped withTime Frozen setTimeFrozen.isReturns whether a world sound was not muted withWorld Sound Enabled setWorldSoundEnabled(also checks muting of the whole group).processChecks whether a segment crosses one specific element, treating it as a sphere of its radius (a server-side simplification). Returns the point on the segment closest to the element's centre.Line Against Mesh removeStores hiding the whole San Andreas map (for servers with their own map).Game World resetRestores all ambient sounds (clears settings fromAmbient Sounds setAmbientSoundEnabled).resetRestores the default valueBirds Enabled trueof the birds setting.resetRestores the default blur (36).Blur Level resetRestores the default value (Corona Reflections Enabled false) of light reflections.resetRestores the default grain (0).Grain Level resetRestores the default grain multiplier (1).Grain Multiplier resetClears the settings fromHeat Haze setHeatHaze.resetRestores the default value (Interior Furniture Enabled true) of interior furniture.resetRestores the default camera near clip (0.3).Near Clip Distance resetRestores the default ped drawing distance (60).Peds LODDistance resetClears the sun colour fromSun Color setSunColor.resetRestores the default sun size (1).Sun Size resetRestarts a stopped game clock; the same asTime Frozen setTimeFrozen(false).resetRestores the default vehicle drawing distance (500).Vehicles LODDistance resetAn alias ofVolumetric Shadows resetVolumetricShadowsEnabled.resetRestores the default value (Volumetric Shadows Enabled false) of volumetric shadows.resetClears the water colour fromWater Color setWaterColor.resetRestores the default value (Water Drawn Last false) ofsetWaterDrawnLast.resetClears the water level set withWater Level setWaterLevel.resetClears the wind set withWind Velocity setWindVelocity.resetClears most world settings stored by scripts at once: named properties, colour filter, fog, sun and moon size, rain, grain, blur, drawing distances, waves, birds, reflections, shadows, furniture, muted sounds, game speed and minute length. Unless you passWorld Properties false, it also clears special properties, garages, glitches and the jetpack weapon setting.resetClears one named property fromWorld Property setWorldProperty.resetClears all muting fromWorld Sounds setWorldSoundEnabled.restoreUndoesGame World removeGameWorld.setAllows or forbids aim assist for every player.Aim Assist Enabled falseforces free aim (the crosshair does not snap to targets) and the game menu option is locked. Useful on PvP servers where controller and mouse players should be on equal terms.setStores turning ambient sounds on or off:Ambient Sound Enabled "gunfire"(distant gunshots in dangerous areas) or"general"(other background noises).setStores whether birds should fly over the map (yes by default).Birds Enabled setStores the motion blur strength at high speed (0-255, 36 by default in the game).Blur Level setStores whether lights (street lamps, headlights) should reflect on wet roads (off by default).Corona Reflections Enabled setProvides a garage's position and size so thatGarage Bounds getGaragePosition,getGarageSizeandgetGarageBoundingBoxwork (the server does not know the game's garage data).setStores whether a game garage (Pay'n'Spray, mission garages, numbers 0-49) should be open. The state is sent to players and read withGarage Open isGarageOpenon both sides.setTurns a known game glitch allowed on many servers on or off. Available names:Glitch Enabled quickreload,fastfire(faster firing by cancelling the animation),fastmove(fast crouched movement),crouchbug(shoot-crouch),closedamage(close-range damage),hitanim(hit animation),fastsprint(fast sprint by tapping),baddrivebyhitbox(wrong hitbox in drive-bys),quickstand,kickoutofvehicle_onmodelreplace.setAdds film-like grain to the game image for all players (0 = none, 255 = strongest). The strength is multiplied byGrain Level setGrainMultiplier.setA multiplier for the grain strength fromGrain Multiplier setGrainLevel(0-10, 1 by default). Grain does not exceed its maximum strength.setChanges the gravity strength in the game world for every player. The default is 0.008; a smaller value gives higher jumps and longer car flights (e.g. 0.004 = half of Earth's). The game accepts values above 0 and below 1.Gravity setStores heat haze settings (the shimmering hot air over desert asphalt).Heat Haze setStores whether interiors (houses, shops) should have furniture (yes by default). Useful when you place your own furnishings inside.Interior Furniture Enabled setStores a general permission to fire weapons while flying a jetpack (off by default). It takes one value for all weapons.Jetpack Weapon Enabled setStores the camera near clip distance: things closer to the camera than this are not drawn (0.1-20 m, 0.3 by default).Near Clip Distance setStores the distance beyond which peds stop being drawn (0-500 m, 60 by default).Peds LODDistance setStores the sun colour: core and glow (corona), each RGB 0-255. Without the last three numbers the glow gets the core colour.Sun Color setStores the sun disc size (0-100, 1 by default).Sun Size setStops or restarts the game clock for every player. A stopped clock keeps a constant time of day (e.g. eternal noon on a racing server).Time Frozen setTimecan still change the hour.setStores whether the traffic lights should be locked in their current state (no automatic changes).Traffic Lights Locked setStores the state of the traffic lights at junctions (0-9).Traffic Light State setStores the distance beyond which vehicles stop being drawn (0-500 m, 500 by default).Vehicles LODDistance setStores whether peds and vehicles should have volumetric shadows (off by default).Volumetric Shadows Enabled setStores the water colour (RGB 0-255) and its opacity (200 by default).Water Color setStores whether water should be drawn last (this affects how transparent objects under water look).Water Drawn Last setStores the water level: with just a number for the whole world, with a water element for that element.Water Level setMoves a corner of a water element fromWater Vertex Position createWater.setStores the height of waves on water (0-100, 0 by default).Wave Height setStores the wind direction and strength. The value is sent to players and read withWind Velocity getWindVelocityon the client, e.g. for your own effects.setStores a named world property of up to three numbers, e.g. a colour or an effect intensity from the list (World Property AmbientColor,LightsOnGround,SpriteBrightness, etc.). The name is case-insensitive.setStores muting of world sounds by groups and indexes (e.g. group 0 = people, 5 = birds). Index -1 means the whole group; a two-argument call (World Sound Enabled group, enabled) also affects the whole group.setTurns a special world property on or off:World Special Property Enabled hovercars,aircars,extrabunny,extrajump,randomfoliage,snipermoon,extraairresistance,underworldwarp,vehiclesunglare,coronaztest,watercreatures,burnflippedcars,fireballdestruct,roadsignstext,extendedwatercannons,tunnelweatherblend,ignorefirestate,flyingcomponents,vehicleburnexplosions,vehicle_engine_autostart.vehicle_engine_autostartreally works: turned off, a car engine does not start by itself when a driver gets in and must be turned on withsetVehicleEngineState.testChecks whether a sphere at the given point overlaps any element (vehicle, ped, object) according to the server's simplified model (elements as spheres, no map buildings). Useful e.g. to check that a spot is free before creating a car.Sphere Against World