- Documentation
- Objects
Category
Objects
All Lua functions and events in the Objects category, on the server and the client.
Server functions 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.
Shared functions 10
createCreates an object from a San Andreas model (e.g. 1337 bin, 3095 ramp, 1225 explosive barrel) or a model replaced withObject engineReplaceModel. Everyone in the same interior and dimension sees it; it stays in place and has collision. WithisBreakable = truethe game treats it as breakable and it can be smashed.getReturns San Andreas map objects (hydrants, barrels, boxes, lamp posts…) that players moved or damaged. On the server each entry has a key shared by all players, model, position, rotation (quaternion), health, a broken flag and the player who last moved it. On the client it returns map objects loaded in this game with aMap Objects movedfield.getReturns an object's scale on three axes (1, 1, 1 by default).Object Scale isReturns whether map object synchronisation is on.Map Object Sync Enabled isReturns whether the object can be broken (Object Breakable breakObject).trueby default unless changed withsetObjectBreakable.isChecks whether an object is currently being moved byObject Moving moveObject.moveSmoothly moves an object to a new place over the given time, optionally rotating it by the given angles (relative to its current rotation) and with the chosen easing. Everyone sees the movement; when it ends the object stays in the new place. Used for gates, lifts, platforms. Easing:Object "Linear","InQuad","OutQuad","InOutQuad","OutInQuad","SineCurve","CosineCurve".setSets whether the object can be broken withObject Breakable breakObject.setChanges an object's size (1 = normal, 2 = twice as big). The game applies one scale to all axes - the first number counts.Object Scale stopStops a movement started withObject moveObject; the object stays where it was at that moment.
Server events 4
onA game map object was damaged (e.g. a broken-off hydrant).Map Object Break onA player moved a game map object (e.g. a hydrant or a barrel), not a script-created object.Map Object Move onA script-created object was destroyed in the game (e.g. a smashed fence). An explosive barrel also explodes for everyone.Object Break onAn object returned to its place and is repaired (Object Respawn respawnObject).