Skip to content

Commit 8243434

Browse files
committed
Minor fixes (blips)
- Code formatting - Typos - Duplicated example files
1 parent 0cee06d commit 8243434

33 files changed

+149
-165
lines changed

functions/Blip/createBlip.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ shared: &shared
5454
values:
5555
- type: blip|false
5656
name: created-blip
57-
description: Returns an element of the [[blip]] if it was created successfully, false otherwise.
57+
description: Returns an element of the [[blip]] if it was created successfully, **false** otherwise.
5858
preview_images:
5959
- path: radar-blip.png
6060
description: Example blip.

functions/Blip/createBlipAttachedTo.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ shared: &shared
4949
values:
5050
- type: blip|false
5151
name: created-blip
52-
description: Returns an element of the [[blip]] if it was created successfully, false otherwise.
52+
description: Returns an element of the [[blip]] if it was created successfully, **false** otherwise.
5353
server:
5454
<<: *shared
5555
examples:
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- Pick a random player
2-
local myPlayer = getRandomPlayer( )
2+
local myPlayer = getRandomPlayer()
33
-- Retrieve the player's position and store it in the variables x, y and z
4-
local x, y, z = getElementPosition( myPlayer )
4+
local x, y, z = getElementPosition(myPlayer)
55
-- Create a radar blip at the player's position, with a 'cash' icon and only visible to the player
6-
local myBlip = createBlip( x, y, z, 51, 0, 0, 0, 255, myPlayer )
6+
local myBlip = createBlip(x, y, z, 51, 0, 0, 0, 255, myPlayer)
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- Pick a random player
2-
local myPlayer = getRandomPlayer( )
2+
local myPlayer = getRandomPlayer()
33
-- Create a radar blip in the middle of the map
4-
local myBlip = createBlip( 0, 0, 0 )
4+
local myBlip = createBlip(0, 0, 0)
55
-- Make the player the parent of the blip, so that the blip follows the player around
6-
setElementParent( myBlip, myPlayer )
6+
setElementParent(myBlip, myPlayer)
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- Pick a random player
2-
function setupRandomRobber ()
3-
local myPlayer = getRandomPlayer ()
4-
-- Create a radar blip at the player's position, with a 'cash' icon and only visible to everyone (no 'visibleTo' parameter)
5-
local myBlip = createBlipAttachedTo ( myPlayer, 52 )
6-
end
2+
function setupRandomRobber()
3+
local myPlayer = getRandomPlayer()
4+
-- Create a radar blip at the player's position, with a 'cash' icon and only visible to everyone (no 'visibleTo' parameter)
5+
local myBlip = createBlipAttachedTo(myPlayer, 52)
6+
end
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- Pick a random player
2-
function setupRandomRobber ()
3-
local myPlayer = Player.getRandom()
4-
-- Create a radar blip at the player's position, with a 'cash' icon and only visible to everyone (no 'visibleTo' parameter)
5-
local myBlip = Blip.createAttachedTo ( myPlayer, 52 )
6-
end
2+
function setupRandomRobber()
3+
local myPlayer = Player.getRandom()
4+
-- Create a radar blip at the player's position, with a 'cash' icon and only visible to everyone (no 'visibleTo' parameter)
5+
local myBlip = Blip.createAttachedTo(myPlayer, 52)
6+
end

functions/Blip/examples/createBlip_OOP-1.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ local myPlayer = Player.getRandom()
33
-- Retrieve the player's position and store it in the variables x, y and z
44
local x, y, z = myPlayer.position
55
-- Create a radar blip at the player's position, with a 'cash' icon and only visible to the player
6-
local myBlip = Blip( x, y, z, 51, 0, 0, 0, 255, myPlayer )
6+
local myBlip = Blip(x, y, z, 51, 0, 0, 0, 255, myPlayer)
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
-- Retrieve a table containing all the blips that exist
2-
local blips = getElementsByType ( "blip" )
2+
local blips = getElementsByType("blip")
33
-- Loop through the list, storing the blip from the table in the variable blipValue
44
for blipKey, blipValue in ipairs(blips) do
5-
-- Retrieve the blip's colors into the variables red, green, blue and alpha
6-
local red, green, blue, alpha = getBlipColor ( blipValue )
7-
-- If the blip's icon isn't white already
8-
if ( red ~= 255 or green ~= 255 or blue ~= 255 or alpha ~= 255 ) then
9-
-- Set the blip's color to white
10-
setBlipColor ( blipValue, 255, 255, 255, 255 )
11-
end
12-
end
5+
-- Retrieve the blip's colors into the variables red, green, blue and alpha
6+
local red, green, blue, alpha = getBlipColor(blipValue)
7+
-- If the blip's icon isn't white already
8+
if (red ~= 255 or green ~= 255 or blue ~= 255 or alpha ~= 255) then
9+
-- Set the blip's color to white
10+
setBlipColor(blipValue, 255, 255, 255, 255)
11+
end
12+
end
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
-- Retrieve a table containing all the blips that exist
2-
local blips = Element.getAllByType ( "blip" )
2+
local blips = Element.getAllByType("blip")
33
-- Loop through the list, storing the blip from the table in the variable blipValue
44
for blipKey, blipValue in ipairs(blips) do
5-
-- Retrieve the blip's colors into the variables red, green, blue and alpha
6-
local red, green, blue, alpha = blipValue:getColor()
7-
-- If the blip's icon isn't white already
8-
if ( red ~= 255 or green ~= 255 or blue ~= 255 or alpha ~= 255 ) then
9-
-- Set the blip's color to white
10-
blipValue:setColor( 255, 255, 255, 255 )
11-
end
12-
end
5+
-- Retrieve the blip's colors into the variables red, green, blue and alpha
6+
local red, green, blue, alpha = blipValue:getColor()
7+
-- If the blip's icon isn't white already
8+
if (red ~= 255 or green ~= 255 or blue ~= 255 or alpha ~= 255) then
9+
-- Set the blip's color to white
10+
blipValue:setColor(255, 255, 255, 255)
11+
end
12+
end
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
-- Retrieve a table containing all the blips that exist
2-
local blips = getElementsByType ( "blip" )
2+
local blips = getElementsByType("blip")
33
-- Loop through the list, storing the blip from the table in the variable blipValue
44
for blipKey, blipValue in ipairs(blips) do
5-
-- Retrieve the blip's icon into the variable 'blipIcon'
6-
local blipIcon = getBlipIcon ( blipValue )
7-
-- If the blip's icon wasn't the default already
8-
if ( blipIcon ~= 0 ) then
9-
-- Set the blip's icon to the default
10-
setBlipIcon ( blipValue, 0 )
11-
end
12-
end
5+
-- Retrieve the blip's icon into the variable 'blipIcon'
6+
local blipIcon = getBlipIcon(blipValue)
7+
-- If the blip's icon wasn't the default already
8+
if (blipIcon ~= 0) then
9+
-- Set the blip's icon to the default
10+
setBlipIcon(blipValue, 0)
11+
end
12+
end

0 commit comments

Comments
 (0)