ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. setElementCollisionsEnabled

Function

setElementCollisionsEnabled

Server and clientElementsIdentical to MTA:SA

Turns an element's collisions on or off.

Syntax

bool setElementCollisionsEnabled(element theElement, bool enabled)

Arguments

theElementelement
The element.
enabledbool
false turns collisions off.

Returns

true on success.

Example

local ghost = createObject(3095, 2500, -1670, 12)
setElementCollisionsEnabled(ghost, false)
setElementAlpha(ghost, 100)

Notes

Your own character in client scripts. On the client you can also turn off collisions of your own character (localPlayer).

Vehicles, NPCs and objects. Works on objects, vehicles and NPCs for every player. An empty vehicle without collisions stays where it was placed.

.map files. The collisions="false" attribute works on a single element, on the root <map collisions="false"> (whole map) and in meta.xml: <map src="track.map" collisions="false" />. The element's own attribute wins.

See also