Resource:Spawnmanager/createSpawnpoint

From Multi Theft Auto: Wiki
Revision as of 19:23, 19 October 2007 by Talidan (talk | contribs) (New page: __NOTOC__ {{Server function}} This function creates a spawnpoint. ==Syntax== <syntaxhighlight lang="lua"> spawnpoint createSpawnpoint ( float x, float y, float z, [ float rotation = 0, int skin = 0, ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This function creates a spawnpoint.

Syntax

spawnpoint createSpawnpoint ( float x, float y, float z, [ float rotation = 0, int skin = 0,  int interior, int dimension ] )

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

Optional Arguments

  • rotation: A floating point number representing the spawn's rotation about the Z axis in degrees.
  • skin: An integer representing the skin ID (see character skins).

Returns

Returns the spawnpoint element if creation was successful, false otherwise.

Example

This function lets the player create a new spawnpoint where he stands, with the skin of his choice.

function createSP( source, command, skin )
      local x, y, z = getElementPosition( source ) --Get the players location
      local rot = getPlayerRotation( source ) --Get the players rotation
      local theSpawnpoint = call(getResourceFromName("spawnmanager", "createSpawnpoint", x, y, z, rot, skin ) --Create the spawnpoint.
      if ( theSpawnpoint ) then
            outputConsole ( "Spawnpoint created.", source ) --notify the player if it was successful
      end
end
addCommandHandler( "mark", createSP )

See Also

Template:Spawnpoint functions