CreateBuilding: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Blanked the page)
Tag: Blanking
No edit summary
Line 1: Line 1:
__NOTOC__
{{Client function}}
{{New feature/item|3.0161|1.6.0|22410|Creates a [[building]] [[element]] at a given position and rotation.}}


==Syntax==
<syntaxhighlight lang="lua">building createBuilding ( int modelId, float x, float y, float z, [ float rx, float ry, float rz, int interior = 0 ] )</syntaxhighlight>
{{OOP||[[Building]]||}}
===Required Arguments===
*'''modelId:''' A whole integer specifying the GTA:SA object model ID.
*'''x:''' A floating point number representing the X coordinate on the map.
*'''y:''' A floating point number representing the Y coordinate on the map.
*'''z:''' A floating point number representing the Z coordinate on the map.
*'''rx:''' A floating point number representing the rotation about the X axis in degrees.
*'''ry:''' A floating point number representing the rotation about the Y axis in degrees.
*'''rz:''' A floating point number representing the rotation about the Z axis in degrees.
===Optional Arguments===
{{OptionalArg}}
*'''interior:''' The interior you want to set the building to. Valid values are 0 to 255.
===Returns===
* Returns the [[building]] element if the creation was successful, throws an error otherwise.
==Example==
<section name="Simple example" class="client" show="true">
This example creates a building when the resource starts:
<syntaxhighlight lang="lua">
function loadMap()
  -- create a *building* at a specified position with a specified rotation
  createBuilding(1337, 5540.6654, 1020.55122, 1240.545, 90, 0, 0)
end
addEventHandler("onClientResourceStart", resourceRoot, loadMap)
</syntaxhighlight>
</section>
==See Also==
{{Building functions}}

Revision as of 16:24, 21 April 2024

ADDED/UPDATED IN VERSION 1.6.0 r22410:
Creates a building element at a given position and rotation.

Syntax

building createBuilding ( int modelId, float x, float y, float z, [ float rx, float ry, float rz, int interior = 0 ] )

OOP Syntax Help! I don't understand this!

Method: Building(...)


Required Arguments

  • modelId: A whole integer specifying the GTA:SA object model ID.
  • x: A floating point number representing the X coordinate on the map.
  • y: A floating point number representing the Y coordinate on the map.
  • z: A floating point number representing the Z coordinate on the map.
  • rx: A floating point number representing the rotation about the X axis in degrees.
  • ry: A floating point number representing the rotation about the Y axis in degrees.
  • rz: A floating point number representing the rotation about the Z axis in degrees.

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • interior: The interior you want to set the building to. Valid values are 0 to 255.


Returns

  • Returns the building element if the creation was successful, throws an error otherwise.

Example

Click to collapse [-]
Simple example

This example creates a building when the resource starts:

function loadMap()
   -- create a *building* at a specified position with a specified rotation
   createBuilding(1337, 5540.6654, 1020.55122, 1240.545, 90, 0, 0)
end
addEventHandler("onClientResourceStart", resourceRoot, loadMap)


See Also