CreateMarker: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Spolszczenie/Translate)
m (Add new argument)
 
(28 intermediate revisions by 14 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{PL/Server client function}}
{{Server client function}}
Funkcja ta tworzy znacznik. Znacznik to obiekt 3D w świecie. Za pomocą tego można wyznaczyć dany punkt lub obszar. Funkcji tej często się używa do przemieszczania graczy lub aby dać możliwość wejścia do jakiegoś budynku (Interioru).
{{Warning|When using type "arrow" markers, you may experience positioning issues. This is a known issue with how GTA creates these types of markers. It is recommended you keep the position at least 1 game unit above the ground to avoid issues.}}
{{Warning|"cylinder" marker type doesn't have the same size for collisions and visible textures. Note that the marker collisions are around 10-20% bigger than the visible texture.}}


Istnieją różne typy markerów między innymi:
[[Image:Mtasa_markers.png|thumb|337px|This image shows all the different marker types available using this function.]]
 
This function creates a marker. A marker is a 3D model in the world that can highlight a particular point or area, often used to instruct players where to go to perform actions such as entering buildings.
 
There are various limits that govern the maximum number of each type that can be visible at once. These are:
* Coronas: 32
* Coronas: 32
* Przystanek/Punkt, Pierścień, Cylinder i Strzałki: 32
* Checkpoints, Rings, Cylinders and Arrows combined: 32
 
You are able to create as many markers as you wish (memory and element limit permitting), but the player will only be able to see the nearest ones up to the limit.


Możesz stworzyć tak dużo znaczników ile tylko chcesz. Ale gracz będzie mógł zobaczyć je tylko z odpowiedniej odległości.
<br><br><br><br>


==Składnia==
==Syntax==
<section name="Serwer" class="server" show="true">
<section name="Server" class="server" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
marker createMarker ( float x, float y, float z [, string theType = "checkpoint", float size = 4.0, int r = 0, int g = 0, int b = 255, int a = 255, visibleTo = getRootElement( ) ] )
marker createMarker ( float x, float y, float z [, string theType = "checkpoint", float size = 4.0, int r = 0, int g = 0, int b = 255, int a = 255, element visibleTo = getRootElement( ), bool ignoreAlphaLimits = false ] )
</syntaxhighlight>
</syntaxhighlight>
{{PL/OOP||Marker}}
{{OOP||Marker}}
===Wymagane Argumenty===
===Required Arguments===
* '''x''': Liczba zmiennoprzecinkowa określająca współrzędną X znacznika na mapie.
* '''x''': A floating point number representing the X coordinate on the map.
* '''y''': Liczba zmiennoprzecinkowa określająca współrzędną Y znacznika na mapie.
* '''y''': A floating point number representing the Y coordinate on the map.
* '''z''': Liczba zmiennoprzecinkowa określająca współrzędną Z znacznika na mapie.
* '''z''': A floating point number representing the Z coordinate on the map.


===Opcjonalne Argumenty===
===Optional arguments===
{{PL/OptionalArg}}
{{OptionalArg}}
* '''theType''': Typ znacznika jaki ma zostać utworzony. Możliwe do wyboru:
* '''theType''': The visual type of the marker to be created. Possible values:
{{Marker_types}}
{{Marker_types}}
* '''size''': Rozmiar znacznika który ma zostać utworzony w metrach.
* '''size''': The diameter of the marker to be created, in meters.
* '''r''': Liczba całkowita określająca liczbę czerwieni do zabarwienia znacznika (0 - 255).
* '''r''': An integer number representing the amount of red to use in the colouring of the marker (0 - 255).
* '''g''': Liczba całkowita określająca liczbę zieleni do zabarwienia znacznika (0 - 255).
* '''g''': An integer number representing the amount of green to use in the colouring of the marker (0 - 255).
* '''b''': Liczba całkowita określająca liczbę niebieskości do zabarwienia znacznika (0 - 255).
* '''b''': An integer number representing the amount of blue to use in the colouring of the marker (0 - 255).
* '''a''': Liczba całkowita określająca liczbę alfa do zabarwienia znacznika (0 - 255, gdzie 0 oznacza przezroczysty a 255 nieprzezroczysty).
* '''a''': An integer number representing the amount of alpha to use in the colouring of the marker (0 - 255 where 0 is transparent and 255 is opaque).
* '''visibleTo''': Ten argument określa dla kogo ma być widoczny dany znacznik. Domyślnie jest widoczny dla wszystkich. Zobacz [[visibility]].
* '''visibleTo''': This defines which elements can see the marker. Defaults to visible to everyone. See [[visibility]].
{{New feature/item|9.0161|1.6.0|22620|
* '''ignoreAlphaLimits''': This argument is only valid for '''checkpoint''' and '''arrow''' markers. It defines whether the alpha of these markers can be changed. If the argument is false, the marker has a constant alpha as before, i.e. checkpoint always 128 and arrow always 255. If the argument is true, alpha can be changed.
}}
</section>
</section>
<section name="Klient" class="client" show="true">
<section name="Client" class="client" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
marker createMarker ( float x, float y, float z [, string theType = "checkpoint", float size = 4.0, int r = 0, int g = 0, int b = 255, int a = 255 ] )
marker createMarker ( float x, float y, float z [, string theType = "checkpoint", float size = 4.0, int r = 0, int g = 0, int b = 255, int a = 255, bool ignoreAlphaLimits  = false ] )
</syntaxhighlight>
</syntaxhighlight>
{{PL/OOP||Marker}}
{{OOP||Marker}}
===Wymagane Argumenty===
===Required Arguments===
* '''x''': Liczba zmiennoprzecinkowa określająca współrzędną X znacznika na mapie.
* '''x''': A floating point number representing the X coordinate on the map.
* '''y''': Liczba zmiennoprzecinkowa określająca współrzędną Y znacznika na mapie.
* '''y''': A floating point number representing the Y coordinate on the map.
* '''z''': Liczba zmiennoprzecinkowa określająca współrzędną Z znacznika na mapie.
* '''z''': A floating point number representing the Z coordinate on the map.


===Opcjonalne Argumenty===
===Optional arguments===
{{PL/OptionalArg}}
{{OptionalArg}}
* '''theType''': Typ znacznika jaki ma zostać utworzony. Możliwe do wyboru:
* '''theType''': The visual type of the marker to be created. Possible values:
{{Marker_types}}
{{Marker_types}}
* '''size''': Rozmiar znacznika który ma zostać utworzony w metrach.
* '''size''': The diameter of the marker to be created, in meters.
* '''r''': Liczba całkowita określająca liczbę czerwieni do zabarwienia znacznika (0 - 255).
* '''r''': An integer number representing the amount of red to use in the colouring of the marker (0 - 255).
* '''g''': Liczba całkowita określająca liczbę zieleni do zabarwienia znacznika (0 - 255).
* '''g''': An integer number representing the amount of green to use in the colouring of the marker (0 - 255).
* '''b''': Liczba całkowita określająca liczbę niebieskości do zabarwienia znacznika (0 - 255).
* '''b''': An integer number representing the amount of blue to use in the colouring of the marker (0 - 255).
* '''a''': Liczba całkowita określająca liczbę alfa do zabarwienia znacznika (0 - 255, gdzie 0 oznacza przezroczysty a 255 nieprzezroczysty).
* '''a''': An integer number representing the amount of alpha to use in the colouring of the marker (0 - 255 where 0 is transparent and 255 is opaque).
</section>
{{New feature/item|9.0161|1.6.0|22620|
* '''ignoreAlphaLimits''': This argument is only valid for '''checkpoint''' and '''arrow''' markers. It defines whether the alpha of these markers can be changed. If the argument is false, the marker has a constant alpha as before, i.e. checkpoint always 128 and arrow always 255. If the argument is true, alpha can be changed.
}}</section>


===Wynik===
===Returns===
Zwraca [[marker]] elementu, który został utworzony lub zwraca 'false' Jeśli argumenty są błędne.
Returns the [[marker]] element that was created, or ''false'' if the arguments are incorrect.


==Przykłady==
==Example==
<section name="Serwer" class="server" show="true">
<section name="Example 1" class="server" show="true">
Przykład tworzy znacznik obok miejsca w którym znajduje się obecnie gracz:
This example creates a marker next to the player when they type 'createmarker':
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- ta funkcja jest wywoływana gdy wpiszemy createmarker w konsoli:
-- this function is called whenever someone types 'createmarker' in the chat:
function consoleCreateMarker ( thePlayer, commandName )
function chatCreateMarker ( thePlayer, commandName )
   if ( thePlayer ) then
   if ( thePlayer ) then
       local x, y, z = getElementPosition ( thePlayer ) -- pobiera pozycję gracza
       local x, y, z = getElementPosition ( thePlayer ) -- get the player's position
       -- create a cylindrical marker next to the player:
       -- create a cylindrical marker next to the player:
       local theMarker = createMarker ( x + 2, y + 2, z, "cylinder", 1.5, 255, 255, 0, 170 )
       local theMarker = createMarker ( x + 2, y + 2, z, "cylinder", 1.5, 255, 255, 0, 170 )
       if ( theMarker ) then -- sprawdza czy marker został prawidłowo utworzony
       if isElement ( theMarker ) then -- check if the marker was created successfully
         outputConsole ( "Marker created successfully", thePlayer )
         outputChatBox ( "Marker created successfully", thePlayer, 0, 255, 0 )
       else
       else
         outputConsole ( "Failed to create marker", thePlayer )
         outputChatBox ( "Failed to create marker", thePlayer, 255, 0, 0 )
       end
       end
   end
   end
end
end
addCommandHandler ( "createmarker", consoleCreateMarker )
addCommandHandler ( "createmarker", chatCreateMarker )
</syntaxhighlight>
</syntaxhighlight>
</section>
</section>


== Rodzaje Markerów ==
==See Also==
[[File:Markers.png|1000px]]
 
 
<br/>
''Autor: [[User:Tararysz12|marcin778]]; utworzono: 16:40, 31 Sierpnia  2016 (CEST)''
<br/>''Author: [[User:Tararysz12|marcin778]]; created: 14:40, 31 Aug 2016 (UTC)''
 
 
==Zobacz również==
{{Marker functions}}
{{Marker functions}}
[[en:createMarker]]
[[ru:createMarker]]
[[ru:createMarker]]
[[ar:createMarker]]
[[ar:createMarker]]
[[pl:createMarker]]

Latest revision as of 18:37, 15 July 2024

[[|link=|]] Warning: When using type "arrow" markers, you may experience positioning issues. This is a known issue with how GTA creates these types of markers. It is recommended you keep the position at least 1 game unit above the ground to avoid issues.
[[|link=|]] Warning: "cylinder" marker type doesn't have the same size for collisions and visible textures. Note that the marker collisions are around 10-20% bigger than the visible texture.
This image shows all the different marker types available using this function.

This function creates a marker. A marker is a 3D model in the world that can highlight a particular point or area, often used to instruct players where to go to perform actions such as entering buildings.

There are various limits that govern the maximum number of each type that can be visible at once. These are:

  • Coronas: 32
  • Checkpoints, Rings, Cylinders and Arrows combined: 32

You are able to create as many markers as you wish (memory and element limit permitting), but the player will only be able to see the nearest ones up to the limit.





Syntax

Click to collapse [-]
Server
marker createMarker ( float x, float y, float z [, string theType = "checkpoint", float size = 4.0, int r = 0, int g = 0, int b = 255, int a = 255, element visibleTo = getRootElement( ), bool ignoreAlphaLimits = false ] )

OOP Syntax Help! I don't understand this!

Method: Marker(...)


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

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.

  • theType: The visual type of the marker to be created. Possible values:
    • "checkpoint": A race checkpoint. These are very tall, but not infinite, light pillars. Checkpoints snap to ground and become invisible after going over a certain Z height.
    • "ring": Doughnut shaped ring, normally used for aircraft.
    • "cylinder": Small glowing ground ring. These are the glow markers you walk into to activate missions or events in single player.
    • "arrow": Arrow pointing down. These are the arrows on the doors you can enter in single player, except MTA's are not animated by default.
    • "corona": A glowing ball of light.
  • size: The diameter of the marker to be created, in meters.
  • r: An integer number representing the amount of red to use in the colouring of the marker (0 - 255).
  • g: An integer number representing the amount of green to use in the colouring of the marker (0 - 255).
  • b: An integer number representing the amount of blue to use in the colouring of the marker (0 - 255).
  • a: An integer number representing the amount of alpha to use in the colouring of the marker (0 - 255 where 0 is transparent and 255 is opaque).
  • visibleTo: This defines which elements can see the marker. Defaults to visible to everyone. See visibility.
ADDED/UPDATED IN VERSION 1.6.0 r22620:
  • ignoreAlphaLimits: This argument is only valid for checkpoint and arrow markers. It defines whether the alpha of these markers can be changed. If the argument is false, the marker has a constant alpha as before, i.e. checkpoint always 128 and arrow always 255. If the argument is true, alpha can be changed.
Click to collapse [-]
Client
marker createMarker ( float x, float y, float z [, string theType = "checkpoint", float size = 4.0, int r = 0, int g = 0, int b = 255, int a = 255, bool ignoreAlphaLimits  = false ] )

OOP Syntax Help! I don't understand this!

Method: Marker(...)


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

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.

  • theType: The visual type of the marker to be created. Possible values:
    • "checkpoint": A race checkpoint. These are very tall, but not infinite, light pillars. Checkpoints snap to ground and become invisible after going over a certain Z height.
    • "ring": Doughnut shaped ring, normally used for aircraft.
    • "cylinder": Small glowing ground ring. These are the glow markers you walk into to activate missions or events in single player.
    • "arrow": Arrow pointing down. These are the arrows on the doors you can enter in single player, except MTA's are not animated by default.
    • "corona": A glowing ball of light.
  • size: The diameter of the marker to be created, in meters.
  • r: An integer number representing the amount of red to use in the colouring of the marker (0 - 255).
  • g: An integer number representing the amount of green to use in the colouring of the marker (0 - 255).
  • b: An integer number representing the amount of blue to use in the colouring of the marker (0 - 255).
  • a: An integer number representing the amount of alpha to use in the colouring of the marker (0 - 255 where 0 is transparent and 255 is opaque).
ADDED/UPDATED IN VERSION 1.6.0 r22620:
  • ignoreAlphaLimits: This argument is only valid for checkpoint and arrow markers. It defines whether the alpha of these markers can be changed. If the argument is false, the marker has a constant alpha as before, i.e. checkpoint always 128 and arrow always 255. If the argument is true, alpha can be changed.

Returns

Returns the marker element that was created, or false if the arguments are incorrect.

Example

Click to collapse [-]
Example 1

This example creates a marker next to the player when they type 'createmarker':

-- this function is called whenever someone types 'createmarker' in the chat:
function chatCreateMarker ( thePlayer, commandName )
   if ( thePlayer ) then
      local x, y, z = getElementPosition ( thePlayer ) -- get the player's position
      -- create a cylindrical marker next to the player:
      local theMarker = createMarker ( x + 2, y + 2, z, "cylinder", 1.5, 255, 255, 0, 170 )
      if isElement ( theMarker ) then -- check if the marker was created successfully
         outputChatBox ( "Marker created successfully", thePlayer, 0, 255, 0 )
      else
         outputChatBox ( "Failed to create marker", thePlayer, 255, 0, 0 )
      end
   end
end
addCommandHandler ( "createmarker", chatCreateMarker )

See Also