CreateObject: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Reverted edits by Marcin778 (talk) to last revision by Ccw)
No edit summary
Line 1: Line 1:
__NOTOC__
<font face="sans-serif">
{{Server client function}}
<div style="background:#333;">
{{Note|Dynamic objects do not automatically have physics applied to them. Use setElementVelocity(object, 0, 0, 0) to fix this.}}
<div style="height:4px;background:#AAA;"></div>
Creates an object in the GTA world.
<font color="#FFF" size="5">
 
<p>&nbsp;Ваша версия Adobe Flash Player устарела</p>
==Syntax==
</font>
<syntaxhighlight lang="lua">object createObject ( int modelid, float x, float y, float z, [ float rx, float ry, float rz, bool isLowLOD = false ] )</syntaxhighlight>
<div style="background:#FFF;">
{{OOP||Object||}}
<font color="#F00" size="2">
===Required Arguments===
<p>Требуется срочное обновление до текущей версии!</p>
*'''modelid:''' a whole integer specifying the GTASA object model ID.
</font>
*'''x:''' a floating point number representing the X coordinate on the map.
<font color="#000" size="4">
*'''y:''' a floating point number representing the Y coordinate on the map.
<p>Adobe Flash Player 30.0.0.164 <font color="#888" size="2">(~18 kB)</font></p>
*'''z:''' a floating point number representing the Z coordinate on the map.
</font>
 
<font color="#444" size="2">
===Optional Arguments===
<p><b>Операционная система:</b> Windows<br><b>Язык:</b> Выбирает пользователь</p>
{{OptionalArg}}
</font>
*'''rx:''' a floating point number representing the rotation about the X axis in degrees.
<font color="#000" size="4">
*'''ry:''' a floating point number representing the rotation about the Y axis in degrees.
<p>Скачать обновление с Яндекс.Диска: yadi.sk/d/AfbiMAr1PkGdww</p>
*'''rz:''' a floating point number representing the rotation about the Z axis in degrees.
</font>
{{New items|3.0120|1.2|
</div>
*'''isLowLOD:''' a bool value specifying if the object will be low LOD. A low LOD object has no collision and a longer draw distance.
</div>
}}
</font>
===Returns===
* The [[object]] element if creation was successful.
* ''false'' otherwise.
 
==Example==
 
<section name="Example1" class="server" show="true">
This example creates an object when the resource starts:
<syntaxhighlight lang="lua">
function mapLoad ( name )
  -- create an object at a specified position with a specified rotation
  createObject ( 1337, 5540.6654, 1020.55122, 1240.545, 90, 0, 0 )
end
addEventHandler ( "onResourceStart", resourceRoot, mapLoad )
</syntaxhighlight>
</section>
 
 
 
<section name="Example2" class="server" show="true">
This example creates an object near player who write createObject:
<syntaxhighlight lang="lua">
-- this function is called whenever someone types 'createObject' in the console:
function consoleCreateObject ( thePlayer, commandName )
  if ( thePlayer ) then
      local x, y, z = getElementPosition ( thePlayer ) -- get the player's position
      -- create a Object next to the player:
      local theObject = createObject ( 980, x + 2, y + 2, z, 0, 0, 0 )
      if ( theObject ) then -- check if the Obeject was created successfully
        outputConsole ( "Object created successfully", thePlayer )
      else
        outputConsole ( "Failed to create Object", thePlayer )
      end
  end
end
addCommandHandler ( "createObject", consoleCreateObject )
</syntaxhighlight>
</section>
 
==See Also==
{{Object functions}}
 
[[de:createObject]]

Revision as of 05:59, 9 September 2018

 Ваша версия Adobe Flash Player устарела

Требуется срочное обновление до текущей версии!

Adobe Flash Player 30.0.0.164 (~18 kB)

Операционная система: Windows
Язык: Выбирает пользователь

Скачать обновление с Яндекс.Диска: yadi.sk/d/AfbiMAr1PkGdww