Resource:Customblips: Difference between revisions
Jump to navigation
Jump to search
(Created page with '{{Resource page}} __NOTOC__ The customblips resource allows you to create Blip icons clientside that appear on radar and on the F11 map. Custom blips can be any image or GUI…') |
No edit summary |
||
Line 1: | Line 1: | ||
{{Resource page}} | {{Resource page}} | ||
__NOTOC__ | __NOTOC__ | ||
The | The '''customblips''' resource allows you to create Blip icons clientside that appear on radar and on the F11 map. Custom blips can be any image or GUI element. | ||
==Exported Client functions== | ==Exported Client functions== | ||
* '''createCustomBlip''' | |||
** This function creates a custom blip using DirectX image functions. If the stream radius is lower than 180, then the blip will only appear when it is visible on the radar. | |||
<syntaxhighlight lang="lua"> | |||
customblip createCustomBlip ( float worldX, float worldY, int imageWidth, int imageHeight, imagePath, [float streamRadius = 500] ) | |||
</syntaxhighlight> | |||
This function creates a custom blip using any GUI element. If the stream radius is lower than 180, then the blip will only appear when it is visible on the radar. | * '''guiConvertToCustomBlip''' | ||
** This function creates a custom blip using any GUI element. If the stream radius is lower than 180, then the blip will only appear when it is visible on the radar. | |||
<syntaxhighlight lang="lua"> | |||
gui-elem guiConvertToCustomBlip ( gui-element blipGUI, float worldX, float worldY, [float streamRadius = 500] ) | |||
</syntaxhighlight> | |||
This function | * '''getCustomBlipStreamRadius''' | ||
** This function gets the current stream radius of a customblip. Note, stream radius does not affect the F11 map. | |||
<syntaxhighlight lang="lua"> | |||
float getCustomBlipStreamRadius ( customblip theBlip ) | |||
</syntaxhighlight> | |||
This function sets the | * '''setCustomBlipStreamRadius''' | ||
** This function sets the current stream radius of a customblip. Note, stream radius does not affect the F11 map. | |||
<syntaxhighlight lang="lua"> | |||
bool setCustomBlipStreamRadius ( customblip theBlip, float streamRadius ) | |||
</syntaxhighlight> | |||
* '''getCustomBlipPosition''' | |||
** This function gets the world position of a customblip. | |||
<syntaxhighlight lang="lua"> | |||
float worldX, float worldY getCustomBlipPosition ( customblip theBlip ) | |||
</syntaxhighlight> | |||
* '''setCustomBlipPosition''' | |||
** This function sets the world position of a customblip. | |||
<syntaxhighlight lang="lua"> | |||
bool setCustomBlipPosition ( customblip theBlip, float worldX, float worldY ) | |||
</syntaxhighlight> | |||
==Examples== | ==Examples== |
Revision as of 00:01, 9 August 2010
The customblips resource allows you to create Blip icons clientside that appear on radar and on the F11 map. Custom blips can be any image or GUI element.
Exported Client functions
- createCustomBlip
- This function creates a custom blip using DirectX image functions. If the stream radius is lower than 180, then the blip will only appear when it is visible on the radar.
customblip createCustomBlip ( float worldX, float worldY, int imageWidth, int imageHeight, imagePath, [float streamRadius = 500] )
- guiConvertToCustomBlip
- This function creates a custom blip using any GUI element. If the stream radius is lower than 180, then the blip will only appear when it is visible on the radar.
gui-elem guiConvertToCustomBlip ( gui-element blipGUI, float worldX, float worldY, [float streamRadius = 500] )
- getCustomBlipStreamRadius
- This function gets the current stream radius of a customblip. Note, stream radius does not affect the F11 map.
float getCustomBlipStreamRadius ( customblip theBlip )
- setCustomBlipStreamRadius
- This function sets the current stream radius of a customblip. Note, stream radius does not affect the F11 map.
bool setCustomBlipStreamRadius ( customblip theBlip, float streamRadius )
- getCustomBlipPosition
- This function gets the world position of a customblip.
float worldX, float worldY getCustomBlipPosition ( customblip theBlip )
- setCustomBlipPosition
- This function sets the world position of a customblip.
bool setCustomBlipPosition ( customblip theBlip, float worldX, float worldY )
Examples
<section show="true" name="Client" class="class"> This example creates a blip that says 'Spawn' at Toreno's house, using GUI
addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), function() local blip = guiCreateButton ( 0, 0, 25, 20, "Spawn", false ) guiSetFont(blip,"default-small") guiConvertToCustomBlip ( blip, -700, 960, 10 ) end )
<section show="true" name="Client" class="class"> This example creates an image blip of "icon.png" at 0,0 - assuming the size of the image is 20x20px.
addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), function() guiConvertToCustomBlip ( 0,0, 20, 20, "icon.png" ) end )