Jump to content

another bug distance..


Bean666

Recommended Posts

man this script was working before.. but idk it suddenly got bugged, script is still working in RADAR, but in F11 it's not , i can still see players from far distance in F11, i have all other blip scripts off.

local playerBlips = {} 
local distance = 30 
  
addEventHandler("onClientResourceStart", resourceRoot, 
function() 
    for k, thePlayer in ipairs(getElementsByType("player")) do 
        if not (playerBlips[thePlayer]) and not (thePlayer == localPlayer) then 
            playerBlips[thePlayer] = createBlipAttachedTo(thePlayer, 0, 2) 
        end 
    end 
end) 
  
addEventHandler("onClientPlayerJoin", root, 
function() 
    if not (playerBlips[source]) and not (source == localPlayer) then 
        playerBlips[source] = createBlipAttachedTo(source, 0, 2) 
    end 
end) 
  
addEventHandler("onClientRender", root, 
function() 
    for thePlayer, theBlip in pairs(playerBlips) do 
        if (isElement(thePlayer)) and (isElement(theBlip)) and not (thePlayer == localPlayer) then 
            local R, G, B = getPlayerNametagColor(thePlayer) 
            local px, py, pz = getElementPosition(thePlayer) 
            local bx, by, bz = getElementPosition(theBlip) 
  
            setBlipColor(theBlip, R, G, B, 255) 
            setBlipVisibleDistance(theBlip, distance) 
            if (getDistanceBetweenPoints3D(px, py, pz, bx, by, bz) >= distance) then 
                setBlipColor(theBlip, R, G, B, 0) 
            end 
        end 
    end 
end) 
  
addEventHandler("onClientPlayerQuit", root, 
function() 
    if (isElement(playerBlips[source])) then 
        destroyElement(playerBlips[source]) 
        playerBlips[source] = nil 
    end 
end) 

Edited by Guest
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...