Jump to content

a problem with playerblips


meh

Recommended Posts

hi there. today i'm having some hard times with this reasource: https://community.multitheftauto.com/index.php?p= ... ls&id=3207 don't get me wrong, it works, and works nice, but the problem is that players's blips or icons or whatever don't disappear from the radar after a player dies. and this is kind of a bummer in my opinon. i've contacted the author of this script already, but he didn't respond, so i guess he's not really interested in improving his own resource. so, guys your my only hope. please help me out. :D

here's the script's code itself:

--[[***************************************************************************** 
* 
*  PROJECT:     PlayerBlips 
*  LICENSE:     GNU GPLv3 
*  FILE:        :PlayerBlips/cPlayerBlips.lua 
*  PURPOSE:     Player blips. 
*  DEVELOPERS:  John_Michael <[email protected]> 
*   
********************************************************************************]] 
local playerBlipRoot = createElement("playerBlipRoot", "playerBlipRoot") 
  
--This function creates blips for all players when the resource starts. 
local function resourceStart() 
    for _, player in ipairs(getElementsByType("player")) do 
        if player ~= localPlayer then 
            local r, g, b = getPlayerNametagColor(player) 
            local blip = createBlipAttachedTo(player, 0, 2, r, g, b, 255, 1) 
            setElementParent(blip, playerBlipRoot) 
        end 
    end 
end 
addEventHandler("onClientResourceStart", root, resourceStart) 
  
--This function creates a blip for new players when they join. 
local function playerJoin() 
    local r, g, b = getPlayerNametagColor(source) 
    local blip = createBlipAttachedTo(source, 0, 2, r, g, b, 255, 1) 
    setElementParent(blip, playerBlipRoot) 
    setTimer(updateBlipColor, 5000, 1, blip) --Upadate in 5 seconds, in case the server sets the color. 
end 
addEventHandler("onClientPlayerJoin", root, playerJoin) 
  
--This function destroys a players blip when they quit. 
local function playerQuit() 
    for _, blip in ipairs(getElementChildren(playerBlipRoot)) do 
        if getElementAttachedTo(blip) == source then 
            destroyElement(blip) 
        end 
    end 
end 
addEventHandler("onClientPlayerQuit", root, playerQuit) 
  
--This function updates a blip's color, ensuring the blip colors always match. 
function updateBlipColor(blip) 
    local player = getElementAttachedTo(blip) 
    if player then 
        local r, g, b = getPlayerNametagColor(player) 
        setBlipColor(blip, r, g, b, 255) 
    end 
end 

Link to comment
Guest Guest4401
local function playerWasted() 
    for _, blip in ipairs(getElementChildren(playerBlipRoot)) do 
        if getElementAttachedTo(blip) == source then 
            destroyElement(blip) 
        end 
    end 
end 
addEventHandler("onClientPlayerWasted", root, playerWasted) 

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