Jump to content

Blip dimensions


5150

Recommended Posts

Ayo, is it possible to set a blip's dimension? tried something like whats pasted below but no luck on that.

if getElementDimension(localPlayer) == 0 then
    createBlip(1181.1982421875, -1324.736328125, 13.585506439209, 22, 2, 255, 0, 0, 255, 0, 300)
elseif getElementDimension(localPlayer) == 4950 then
    createBlip(1837.7470703125, -1682.0029296875, 29.1171875,48, 2, 255, 0, 0, 255, 0, 300)
elseif getElementDimension(localPlayer) == 5051 then
    createBlip(etc etc etc)
end
Link to comment
local function createBlips()
    if getElementDimension(localPlayer) == 0 then
        local blip = createBlip(1181.1982421875, -1324.736328125, 13.58, 22, 2, 255, 0, 0, 255, 0, 300)
        setElementDimension(blip, 0)
    elseif getElementDimension(localPlayer) == 4950 then
        local blip = createBlip(1837.7470703125, -1682.0029296875, 29.1171875, 48, 2, 255, 0, 0, 255, 0, 300)
        setElementDimension(blip, 4950)
    elseif getElementDimension(localPlayer) == 5051 then
        local blip = createBlip(etc, etc, etc)
        setElementDimension(blip, 5051)
    end
end
addEventHandler("onClientResourceStart", resourceRoot, createBlips)

 

  • Like 1
Link to comment
25 minutes ago, FLUSHBICEPS said:
local function createBlips()
    if getElementDimension(localPlayer) == 0 then
        local blip = createBlip(1181.1982421875, -1324.736328125, 13.58, 22, 2, 255, 0, 0, 255, 0, 300)
        setElementDimension(blip, 0)
    elseif getElementDimension(localPlayer) == 4950 then
        local blip = createBlip(1837.7470703125, -1682.0029296875, 29.1171875, 48, 2, 255, 0, 0, 255, 0, 300)
        setElementDimension(blip, 4950)
    elseif getElementDimension(localPlayer) == 5051 then
        local blip = createBlip(etc, etc, etc)
        setElementDimension(blip, 5051)
    end
end
addEventHandler("onClientResourceStart", resourceRoot, createBlips)

 

thanks. dunno why i completely forgot you could just use setElementDimension lol

  • Like 1
Link to comment
1 hour ago, FLUSHBICEPS said:
local function createBlips()
    if getElementDimension(localPlayer) == 0 then
        local blip = createBlip(1181.1982421875, -1324.736328125, 13.58, 22, 2, 255, 0, 0, 255, 0, 300)
        setElementDimension(blip, 0)
    elseif getElementDimension(localPlayer) == 4950 then
        local blip = createBlip(1837.7470703125, -1682.0029296875, 29.1171875, 48, 2, 255, 0, 0, 255, 0, 300)
        setElementDimension(blip, 4950)
    elseif getElementDimension(localPlayer) == 5051 then
        local blip = createBlip(etc, etc, etc)
        setElementDimension(blip, 5051)
    end
end
addEventHandler("onClientResourceStart", resourceRoot, createBlips)

 

one more question, sorry. I'm trying to get the blips to automatically refresh once you get set to another dimension. i tried 

onClientElementDimensionChange

but no luck it seems

Link to comment
local function createBlips()
    if getElementDimension(localPlayer) == 0 then
        local blip = createBlip(1181.1982421875, -1324.736328125, 13.58, 22, 2, 255, 0, 0, 255, 0, 300)
        setElementDimension(blip, 0)
    elseif getElementDimension(localPlayer) == 4950 then
        local blip = createBlip(1837.7470703125, -1682.0029296875, 29.1171875, 48, 2, 255, 0, 0, 255, 0, 300)
        setElementDimension(blip, 4950)
    elseif getElementDimension(localPlayer) == 5051 then
        local blip = createBlip(etc, etc, etc)
        setElementDimension(blip, 5051)
    end
end

local function refreshBlips()
    for _, blip in ipairs(getElementsByType("blip")) do
        destroyElement(blip)
    end
    createBlips()
end

addEventHandler("onClientResourceStart", resourceRoot, createBlips)
addEventHandler("onClientElementDimensionChange", localPlayer, refreshBlips)

It refreshes the blips whenever the player's dimension changes so basically it's keeping track of where the player is in the game dimension and updating the blips to reflect that

hoped ive helped 

Edited by FLUSHBICEPS
Link to comment
7 minutes ago, FLUSHBICEPS said:
local function createBlips()
    if getElementDimension(localPlayer) == 0 then
        local blip = createBlip(1181.1982421875, -1324.736328125, 13.58, 22, 2, 255, 0, 0, 255, 0, 300)
        setElementDimension(blip, 0)
    elseif getElementDimension(localPlayer) == 4950 then
        local blip = createBlip(1837.7470703125, -1682.0029296875, 29.1171875, 48, 2, 255, 0, 0, 255, 0, 300)
        setElementDimension(blip, 4950)
    elseif getElementDimension(localPlayer) == 5051 then
        local blip = createBlip(etc, etc, etc)
        setElementDimension(blip, 5051)
    end
end

local function refreshBlips()
    for _, blip in ipairs(getElementsByType("blip")) do
        destroyElement(blip)
    end
    createBlips()
end

addEventHandler("onClientResourceStart", resourceRoot, createBlips)
addEventHandler("onClientElementDimensionChange", localPlayer, refreshBlips)

It refreshes the blips whenever the player's dimension changes so basically it's keeping track of where the player is in the game dimension and updating the blips to reflect that

hoped ive helped 

i ended up having to do it like this, because doing local blip = createBlip for every single blip only spawned the first blip. without structuring it in a table they each need an individual number
3vdS8UI.png

 

doing

for _, blip in ipairs

wouldnt count all of them

Link to comment
local blips = {
  {x = 0, y = 0, z = 0, dimension = 0},
  {x = 1, y = 1, z = 1, dimension = 0},
  {x = 2, y = 2, z = 2, dimension = 1}
}

local function createBlips()
  for _, blipData in ipairs(blips) do
    local blip = createBlip(blipData.x, blipData.y, blipData.z, 0, 2, 255, 0, 0, 255, 0, 500)
    setElementDimension(blip, blipData.dimension)
  end
end

local function refreshBlips()
  for _, blip in ipairs(getElementsByType("blip")) do
    destroyElement(blip)
  end
  createBlips()
end

addEventHandler("onClientElementDimensionChange", localPlayer, function(dimension)
  refreshBlips()
end)

createBlips()

 

  • Like 1
Link to comment
On 2/13/2023 at 5:56 AM, FLUSHBICEPS said:
local blips = {
  {x = 0, y = 0, z = 0, dimension = 0},
  {x = 1, y = 1, z = 1, dimension = 0},
  {x = 2, y = 2, z = 2, dimension = 1}
}

local function createBlips()
  for _, blipData in ipairs(blips) do
    local blip = createBlip(blipData.x, blipData.y, blipData.z, 0, 2, 255, 0, 0, 255, 0, 500)
    setElementDimension(blip, blipData.dimension)
  end
end

local function refreshBlips()
  for _, blip in ipairs(getElementsByType("blip")) do
    destroyElement(blip)
  end
  createBlips()
end

addEventHandler("onClientElementDimensionChange", localPlayer, function(dimension)
  refreshBlips()
end)

createBlips()

 

It would no longer be necessary to refresh by deleting the blips and recreating them, since you already created all the blips in their respective dimensions.

 

 

Link to comment
4 hours ago, alex17" said:

It would no longer be necessary to refresh by deleting the blips and recreating them, since you already created all the blips in their respective dimensions.

 

 

they dont automatically refresh when you change dimensions

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...