setColPolygonHeight | Multi Theft Auto: Wiki Skip to content

setColPolygonHeight

Client-side
Server-side
Shared

This function is used to change the height of an existing colshape polygon. By default, a colshape polygon is infinitely tall.

OOP Syntax Help! I don't understand this!

Syntax

bool setColPolygonHeight ( ​colshape shape, ​float floor, ​float ceil )
Required arguments
  • shape: The colshape polygon.
  • floor: The polygon floor (lowest Z coordinate). Parse false to reset this value to 0.
  • ceil: The polygon ceiling (highest Z coordinate). Parse false to reset this value to infinitely tall.

Returns

Returns true if the polygon was changed, false if invalid arguments were passed.

  • bool: result

Code Examples

server

This example sets every polygon colshape's max heigh to 50 units once resource starts.

function setPolygonsHeight()
for i, v in ipairs(getElementsByType("colshape")) do
if (getColShapeType(v) == 4) then -- if it's a polygon colshape do it otherwise don't
setColPolygonHeight(v, false, 50)
end
end
end
addEventHandler("onResourceStart", resourceRoot, setPolygonsHeight)