- Documentation
- Shared functions
- createObject
Function
createObject
Creates an object from a San Andreas model (e.g. 1337 bin, 3095 ramp, 1225 explosive barrel) or a model replaced with engineReplaceModel. Everyone in the same interior and dimension sees it; it stays in place and has collision. With isBreakable = true the game treats it as breakable and it can be smashed.
Syntax
object createObject(int modelid, float x, float y, float z [, float rx = 0, float ry = 0, float rz = 0, bool isBreakable = false])Arguments
modelidint- Object model ID.
xfloat- X.
yfloat- Y.
zfloat- Z.
rxfloat, optional = 0- Rotation around X (degrees).
ryfloat, optional = 0- Rotation around Y.
rzfloat, optional = 0- Rotation around Z (heading).
isBreakablebool, optional = falsetrue= breakable object.
Returns
The new object, or false.
Example
local ramp = createObject(1634, 2495, -1660, 13.5, 0, 0, 90)
local barrel = createObject(1225, 2500, -1660, 13.5, 0, 0, 0, true)
See also
moveObjectSmoothly 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:"Linear","InQuad","OutQuad","InOutQuad","OutInQuad","SineCurve","CosineCurve".setObjectScaleChanges an object's size (1 = normal, 2 = twice as big). The game applies one scale to all axes - the first number counts.destroyElementDestroys an element together with its children. On the client it also destroys GUI elements.setElementPositionMoves an element to the given place. On the server it works for any element. On the client it moves your own character (up to 50 m it is a plain move in the same frame andgetElementPositionreturns the new place right away, so it can be called every frame, e.g. for noclip; farther it is a teleport that loads the area), as well as client objects, sounds and collision shapes. An object moved every frame inonClientPreRenderis drawn in its new place in the same frame.