setElementCollidableWith | Multi Theft Auto: Wiki Skip to content

setElementCollidableWith

Client-side
Server-side
Shared

Pair: isElementCollidableWith

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


This function can be used to set an element to collide with another element. An element with collisions disabled does not interact physically with the other element.

Note: You can only use this function with the element types listed below.

Syntax

setElementCollidableWith ( )

Code Examples

client
function ghostmode_on()
local playerVehicle = getPedOccupiedVehicle(localPlayer) -- Get the players vehicle
if(playerVehicle) then -- Check the return value.
for i,v in pairs(getElementsByType("vehicle")) do --LOOP through all vehicles
setElementCollidableWith(v, playerVehicle, false) -- Set the collison off with the other vehicles.
end
outputChatBox("You are now a Ghost")
end
end
addCommandHandler("ghostmode", ghostmode_on) -- Add the /ghostmode Command.

See Also

Element Functions