Skip to content

Vector4

Client-side
Server-side
Shared

Element category: Vector

Represents a 4D Vector.

OOP-Only Methods

create

Default constructor for the Vector4 class. Returns a Vector4 object.

Vector4(mixed vectorOrX[, float y, float z, float w])
  • vectorOrX: float | table | vector4 – Vector4, table, or floats indicating vector's coordinates
  • y: float – If vectorOrX is a float, this is the Y coordinate
  • z: float – If vectorOrX is a float, this is the Z coordinate
  • w: float – If vectorOrX is a float, this is the W coordinate

Code Examples

client

This example adds a command called "/garage", allowing you to get any garage bounding box.

function garageBoundingBox( _, garageID)
if not garageID then
outputChatBox("[Usage] /garage <id>")
return
end
if tonumber(garageID) then
if tonumber(garageID) > 0 and tonumber(garageID) < 50 then
local boundingBox = Vector4(getGarageBoundingBox (garageID))
outputChatBox("West: "..boundingBox.x..", East: " ..boundingBox.y..", South: "..boundingBox.z.." North: "..boundingBox.w)
else
outputChatBox("Garage ID must be between 1 and 49")
end
end
end
addCommandHandler ("garage",garageBoundingBox)

See Also

Articles