CreateBlipAttachedTo: Difference between revisions
Jump to navigation
Jump to search
(→Syntax) |
mNo edit summary |
||
(49 intermediate revisions by 22 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
This function creates a [[blip | {{Server client function}} | ||
This function creates a [[blip]] that is attached to an [[element]]. This blip is displayed as an icon on the client's radar and will 'follow' the element that it is attached to around. | |||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua">blip createBlipAttachedTo ( | <section name="Server" class="server" show="true"> | ||
<syntaxhighlight lang="lua"> | |||
blip createBlipAttachedTo ( element elementToAttachTo [, int icon = 0, int size = 2, int r = 255, int g = 0, int b = 0, int a = 255, int ordering = 0, float visibleDistance = 16383.0, element visibleTo = getRootElement( ) ] ) | |||
</syntaxhighlight> | |||
</section> | |||
<section name="Client" class="client" show="true"> | |||
<syntaxhighlight lang="lua"> | |||
blip createBlipAttachedTo ( element elementToAttachTo [, int icon = 0, int size = 2, int r = 255, int g = 0, int b = 0, int a = 255, int ordering = 0, float visibleDistance = 16383.0 ] ) | |||
</syntaxhighlight> | |||
</section> | |||
{{OOP||[[Blip]].createAttachedTo||}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
*''' | *'''elementToAttachTo:''' The [[element]] to attach the blip to. | ||
===Optional Arguments=== | ===Optional Arguments=== | ||
{{OptionalArg}} | {{OptionalArg}} | ||
*'''icon:''' The icon that the radar blips should be. Valid values | *'''icon:''' The icon that the radar blips should be. Valid values can be seen at [[Radar Blips]] | ||
*'''size:''' The size of the radar blip. Only applicable to the ''Marker'' icon. Default value is 2. Maximum is 25. | |||
*'''r:''' The amount of red in the blip's color (0 - 255). Only applicable to the ''Marker'' icon. Default is 255. | |||
*'''g:''' The amount of green in the blip's color (0 - 255). Only applicable to the ''Marker'' icon. Default is 0. | |||
*'''b:''' The amount of blue in the blip's color (0 - 255). Only applicable to the ''Marker'' icon. Default is 0. | |||
*'''a:''' The amount of alpha in the blip's color (0 - 255). Only applicable to the ''Marker'' icon. Default is 255. | |||
{{New feature/item|3|1.0|| | |||
*'''ordering:''' This defines the blip's Z-level ordering (-32768 - 32767). Default is 0. | |||
*'''visibleDistance:''' The maximum distance from the camera at which the blip is still visible (0-65535) | |||
}} | |||
<section name="Server" class="server" show="true"> | |||
*'''visibleTo:''' What elements can see the blip. Defaults to visible to everyone. See [[visibility]]. | |||
</section> | |||
*'''size:''' The size of the radar blip. Default is 2. | |||
*'''r:''' The | |||
*'''g:''' The | |||
*'''b:''' The | |||
*'''a:''' The | |||
* '''visibleTo:''' What elements can see the blip. Defaults to visible to everyone. See [[visibility]]. | |||
==Returns== | ===Returns=== | ||
Returns a [[blip | Returns a [[blip]] if the blip was created succesfully, or ''false'' otherwise. | ||
==Example== | ==Example== | ||
This example creates a radar blip attached to a random player, visible to everyone. The blip will follow the player around as they move. | <section name="Server" class="server" show="true"> | ||
This example creates a radar blip attached to a random player, visible to everyone. The blip will follow the player around as they move. This could be used for manhunt, to emphasise a random player. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- Pick a random player | -- Pick a random player | ||
myPlayer = getRandomPlayer () | function setupRandomRobber () | ||
-- Create a radar blip at the player's position, with a 'cash' icon and only visible to everyone (no 'visibleTo' parameter) | local myPlayer = getRandomPlayer () | ||
myBlip = createBlipAttachedTo ( myPlayer, | -- Create a radar blip at the player's position, with a 'cash' icon and only visible to everyone (no 'visibleTo' parameter) | ||
local myBlip = createBlipAttachedTo ( myPlayer, 52 ) | |||
end | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | |||
==See Also== | ==See Also== | ||
{{ | {{Blip_functions}} | ||
[[en:createBlipAttachedTo]] | |||
[[hu:createBlipAttachedTo]] | |||
[[pt-br:createBlipAttachedTo]] | |||
[[ru:createBlipAttachedTo]] | |||
[[ro:createBlipAttachedTo]] |
Latest revision as of 17:42, 21 February 2021
This function creates a blip that is attached to an element. This blip is displayed as an icon on the client's radar and will 'follow' the element that it is attached to around.
Syntax
Click to collapse [-]
Serverblip createBlipAttachedTo ( element elementToAttachTo [, int icon = 0, int size = 2, int r = 255, int g = 0, int b = 0, int a = 255, int ordering = 0, float visibleDistance = 16383.0, element visibleTo = getRootElement( ) ] )
Click to collapse [-]
Clientblip createBlipAttachedTo ( element elementToAttachTo [, int icon = 0, int size = 2, int r = 255, int g = 0, int b = 0, int a = 255, int ordering = 0, float visibleDistance = 16383.0 ] )
OOP Syntax Help! I don't understand this!
- Method: Blip.createAttachedTo(...)
Required Arguments
- elementToAttachTo: The element to attach the blip to.
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.
- icon: The icon that the radar blips should be. Valid values can be seen at Radar Blips
- size: The size of the radar blip. Only applicable to the Marker icon. Default value is 2. Maximum is 25.
- r: The amount of red in the blip's color (0 - 255). Only applicable to the Marker icon. Default is 255.
- g: The amount of green in the blip's color (0 - 255). Only applicable to the Marker icon. Default is 0.
- b: The amount of blue in the blip's color (0 - 255). Only applicable to the Marker icon. Default is 0.
- a: The amount of alpha in the blip's color (0 - 255). Only applicable to the Marker icon. Default is 255.
- ordering: This defines the blip's Z-level ordering (-32768 - 32767). Default is 0.
- visibleDistance: The maximum distance from the camera at which the blip is still visible (0-65535)
Click to collapse [-]
Server- visibleTo: What elements can see the blip. Defaults to visible to everyone. See visibility.
Returns
Returns a blip if the blip was created succesfully, or false otherwise.
Example
Click to collapse [-]
ServerThis example creates a radar blip attached to a random player, visible to everyone. The blip will follow the player around as they move. This could be used for manhunt, to emphasise a random player.
-- Pick a random player function setupRandomRobber () local myPlayer = getRandomPlayer () -- Create a radar blip at the player's position, with a 'cash' icon and only visible to everyone (no 'visibleTo' parameter) local myBlip = createBlipAttachedTo ( myPlayer, 52 ) end