Bean666 Posted May 23, 2016 Share Posted May 23, 2016 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
Bean666 Posted May 23, 2016 Author Share Posted May 23, 2016 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
Rataj Posted May 27, 2016 Share Posted May 27, 2016 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
Bean666 Posted May 28, 2016 Author Share Posted May 28, 2016 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
Bean666 Posted May 28, 2016 Author Share Posted May 28, 2016 errors i get. 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
Anubhav Posted May 28, 2016 Share Posted May 28, 2016 Make sure the script is client-sided. Link to comment
Bean666 Posted May 28, 2016 Author Share Posted May 28, 2016 20: attempt to compare number with nil it's now Cside. Link to comment
Rataj Posted May 28, 2016 Share Posted May 28, 2016 You are not supposed to put anything inside that array. Just normally create your blips and attach script I wrote. Link to comment
Bean666 Posted May 28, 2016 Author Share Posted May 28, 2016 aight thanks it worked, will this work on playerblips too>? Link to comment
Rataj Posted May 28, 2016 Share Posted May 28, 2016 For playerblips you need to check if blip is attached to something and re-attach it again in second loop. Then it should work fine. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now