Vector/Vector4: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 11: | Line 11: | ||
* '''x''','''y''','''z''' and '''w''' coordinates for the vector. If not specified, they default to 0. | * '''x''','''y''','''z''' and '''w''' coordinates for the vector. If not specified, they default to 0. | ||
* Instead of these | * Instead of these four coordinates, a single Vector4 object may be inserted to clone it. | ||
====Example==== | ====Example==== | ||
Line 26: | Line 26: | ||
if tonumber(garageID) > 0 and tonumber(garageID) < 50 then | if tonumber(garageID) > 0 and tonumber(garageID) < 50 then | ||
local boundingBox = Vector4(getGarageBoundingBox (garageID)) | local boundingBox = Vector4(getGarageBoundingBox (garageID)) | ||
outputChatBox(" | outputChatBox("West: "..boundingBox.x..", East: " ..boundingBox.y..", South: "..boundingBox.z.." North: "..boundingBox.w) | ||
else | else | ||
outputChatBox("Garage ID must be between 1 and 49") | outputChatBox("Garage ID must be between 1 and 49") |
Latest revision as of 18:54, 17 March 2018
The Vector4 class is a class introduced in 1.4
Methods
create
This is default constructor for the Vector4 class and returns a Vector4 object.
Syntax
vector4 Vector4 ( float x = 0, float y = 0, float z = 0, float w = 0 )
- x,y,z and w coordinates for the vector. If not specified, they default to 0.
- Instead of these four coordinates, a single Vector4 object may be inserted to clone it.
Example
This example adds a command called "/garage", allowing you to get any garage bounding box.
Click to collapse [-]
Clientfunction garageBoundingBox ( command, 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)