CreateMarker: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(Added size argument)
Line 6: Line 6:


==Syntax==
==Syntax==
  [[marker]] [[createMarker]] ( float x, float y, float z, [int type, int r, int g, int b] )
  [[marker]] [[createMarker]] ( float x, float y, float z, [int type, int size, int r, int g, int b] )


===Required Arguments===
===Required Arguments===
Line 13: Line 13:
* '''z''': A floating point number representing the Z coordinate on the map.
* '''z''': A floating point number representing the Z coordinate on the map.
* '''type''': The visual type of the marker to be created.
* '''type''': The visual type of the marker to be created.
* '''size''': The size of the marker to be created.
* '''r''': An integer number representing the amount of red to use in the colouring of the marker.
* '''r''': An integer number representing the amount of red to use in the colouring of the marker.
* '''g''': An integer number representing the amount of green to use in the colouring of the marker.
* '''g''': An integer number representing the amount of green to use in the colouring of the marker.
Line 25: Line 26:
   if ( [[strtok]] ( chat, 1, 32 ) == "!createmarker" ) then
   if ( [[strtok]] ( chat, 1, 32 ) == "!createmarker" ) then
     x, y, z = [[getPlayerPosition]] ( player )
     x, y, z = [[getPlayerPosition]] ( player )
     [[createMarker]] ( x + 5, y, z, 0, 255, 0, 0 )
     [[createMarker]] ( x + 5, y, z, 0, 1, 255, 0, 0 )
     [[playerPM]] ( player, "You got a red marker" )
     [[playerPM]] ( player, "You got a red marker" )
   end
   end
  end
  end

Revision as of 01:30, 1 May 2006


Dialog-information.png This article needs checking.

Reason(s): Are there going to be more than the two marker types? what about ring markers?

Description

This function creates a marker and returns a handle to the created marker. If it fails, it will return false.

Syntax

marker createMarker ( float x, float y, float z, [int type, int size, int r, int g, int b] )

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.
  • type: The visual type of the marker to be created.
  • size: The size of the marker to be created.
  • r: An integer number representing the amount of red to use in the colouring of the marker.
  • g: An integer number representing the amount of green to use in the colouring of the marker.
  • b: An integer number representing the amount of blue to use in the colouring of the marker.

Acceptable type values

  • 0: Checkpoint
  • 1: Corona (doughnut-shaped)

Example

function onPlayerChat ( player, chat )
  if ( strtok ( chat, 1, 32 ) == "!createmarker" ) then
    x, y, z = getPlayerPosition ( player )
    createMarker ( x + 5, y, z, 0, 1, 255, 0, 0 )
    playerPM ( player, "You got a red marker" )
  end
end