Jump to content

Distance of blips in F11?


Bean666

Recommended Posts

hello. i used

setBlipVisibleDistance 

for blips to be visible from a close range. it works only in the Mini-radar, but it doesn't work on F11. how to make it also happen in F11? i've been wondering about this since before.

local blip = createBlip (-1025.5458984375, -977.3447265625, 129.21875, 44, 0, 0, 0, 0, 0, 0, 250) 
setBlipVisibleDistance(blip, 150)  

Link to comment
addEventHandler("onClientResourceStart", resourceRoot, function() 
    setTimer(function() 
        local localX, localY = getElementPosition(localPlayer) 
        for _, blip in pairs(getElementsByType("blip")) do 
            local blipX, blipY = getElementPosition(blip) 
            if(getDistanceBetweenPoints2D(localX, localY, blipX, blipY) > 250) then 
                setBlipVisibleDistance(blip, 500) 
                destroyElement ( blip ) 
            end 
        end 
    end, 500, 0)    
end) 

this one works in F11 and radar when you go far away from blip, but when you come back , blip isnt coming back anymore, which is easier to solve? the one i wrote above or htis?

Link to comment

You need to save deleted blips somewhere and then load them again, if they're nearby.

local hiddenblips = { } 
  
setTimer(function() 
    local localX, localY = getElementPosition(localPlayer) 
     
    for _, blip in pairs(getElementsByType("blip")) do 
        local blipX, blipY = getElementPosition(blip) 
        local maxdistance = getBlipVisibleDistance(blip) 
        local r, g, b, a = getBlipColor(blip) 
        if(getDistanceBetweenPoints2D(localX, localY, blipX, blipY) > maxdistance) then 
            table.insert(hiddenblips, { blipX, blipY, getBlipIcon(blip), getBlipSize(blip), getBlipOrdering(blip), maxdistance, r, g, b, a }) 
            destroyElement(blip) 
        end 
    end 
     
    for key, blip in pairs(hiddenblips) do 
        if(getDistanceBetweenPoints2D(localX, localY, blip[1], blip[2]) < blip[6]) then 
            createBlip( blip[1], blip[2], 0, blip[3], blip[4], blip[7], blip[8], blip[9], blip[10], blip[5], blip[6] ) 
            hiddenblips[key] = nil 
        end 
    end 
end, 500, 0) 

Link to comment
You need to save deleted blips somewhere and then load them again, if they're nearby.
local hiddenblips = { } 
  
setTimer(function() 
    local localX, localY = getElementPosition(localPlayer) 
     
    for _, blip in pairs(getElementsByType("blip")) do 
        local blipX, blipY = getElementPosition(blip) 
        local maxdistance = getBlipVisibleDistance(blip) 
        local r, g, b, a = getBlipColor(blip) 
        if(getDistanceBetweenPoints2D(localX, localY, blipX, blipY) > maxdistance) then 
            table.insert(hiddenblips, { blipX, blipY, getBlipIcon(blip), getBlipSize(blip), getBlipOrdering(blip), maxdistance, r, g, b, a }) 
            destroyElement(blip) 
        end 
    end 
     
    for key, blip in pairs(hiddenblips) do 
        if(getDistanceBetweenPoints2D(localX, localY, blip[1], blip[2]) < blip[6]) then 
            createBlip( blip[1], blip[2], 0, blip[3], blip[4], blip[7], blip[8], blip[9], blip[10], blip[5], blip[6] ) 
            hiddenblips[key] = nil 
        end 
    end 
end, 500, 0) 

that's possible to work on a playerblip right?
Link to comment

errors i get.

9fE0AFu.png

local hiddenblips = {  
{2473.7490234375, -1665.7666015625, 13.313109397888}, 
{2490.865234375, -1667.84765625, 13.34375} 
} 
  
setTimer(function() 
    local localX, localY = getElementPosition(localPlayer) 
    
    for _, blip in pairs(getElementsByType("blip")) do 
        local blipX, blipY = getElementPosition(blip) 
        local maxdistance = getBlipVisibleDistance(blip) 
        local r, g, b, a = getBlipColor(blip) 
        if(getDistanceBetweenPoints2D(localX, localY, blipX, blipY) > maxdistance) then 
            table.insert(hiddenblips, { blipX, blipY, getBlipIcon(blip), getBlipSize(blip), getBlipOrdering(blip), maxdistance, r, g, b, a }) 
            destroyElement(blip) 
        end 
    end 
    
    for key, blip in pairs(hiddenblips) do 
        if(getDistanceBetweenPoints2D(localX, localY, blip[1], blip[2]) < blip[6]) then 
            createBlip( blip[1], blip[2], 0, blip[3], blip[4], blip[7], blip[8], blip[9], blip[10], blip[5], blip[6], 56 ) 
            hiddenblips[key] = nil 
        end 
    end 
end, 500, 0) 

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...