SetElementInterior: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (seperated & corrected example)
Line 21: Line 21:


==Example==
==Example==
<section name="Server & Client" class="both" show="false">
<section name="Server" class="server" show="false">
In this example, if a player were to type /interior 1, they would be teleported into this interior
In this example, if a player were to type /interior 1, they would be teleported into this interior
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function interior ( source, key, interior )
function interior ( source, commandName, interior )
   --Lets see if they gave a interior ID
   --Lets see if they gave a interior ID
   if ( interior == "1" ) then
   if ( interior == "1" ) then
Line 32: Line 32:
     --They didnt give one, so set them to the interior they wanted, but dont teleport them.
     --They didnt give one, so set them to the interior they wanted, but dont teleport them.
     setElementInterior ( source, interior )
     setElementInterior ( source, interior )
  end
end
addCommandHandler ( "interior", interior )
</syntaxhighlight>
</section>
<section name="Client" class="client" show="false">
In this example, if a player were to type /interior 1, they would be teleported into this interior
<syntaxhighlight lang="lua">
function interior ( commandName, interior )
  --Lets see if they gave a interior ID
  if ( interior == "1" ) then
    --They did, so lets assign them to that interior and teleport them there (all in 1 function call!)
    setElementInterior ( getLocalPlayer(), interior, 2233.91, 1714.73, 1011.38 )
  else
    --They didnt give one, so set them to the interior they wanted, but dont teleport them.
    setElementInterior ( getLocalPlayer(), interior )
   end
   end
end
end

Revision as of 03:22, 13 August 2007

This function allows you to set the interior of any element. An interior is the current loaded place, 0 being outside.

Syntax

bool setElementInterior ( element theElement, int interior, [float x, float y, float z] )

Required Arguments

  • theElement: The element in which you'd like to set the interior of.
  • interior: The interior you want to set the element to.

Returns

Returns 'true' if 'theElement' and 'interior' are valid arguments, 'false' otherwise.

Optional Arguments

  • 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.

Example

Click to expand [+]
Server
Click to expand [+]
Client

See Also