Jump to content

[HELP] player blips


K4stic

Recommended Posts

Posted

i have take this script from community and some upgrade

1 bug. it's make all player's with red blip

2 bug. then player charge team the blip not charge color

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 = getTeamColor(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 = getTeamColor(source) 
    local blip = createBlipAttachedTo(source, 0, 2, r, g, b, 255, 1) 
    setElementParent(blip, playerBlipRoot) 
    setTimer(updateBlipColor, 1500, 1, blip) --Upadate in 2 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(player) 
    local attach = getElementAttachedTo(player) 
    if ( attach ) then 
        local r, g, b = getTeamColor(player) 
        setBlipColor(blip, r, g, b, 255) 
    end 
end 
  
setTimer(updateBlipColor, 500, 0) 
  

Giving a Fuck? Nope, That isn't in My Skill Set

castie11.png

Posted

Try this :/ I have not tried it yet.

  
local playerBlipRoot = createElement("playerBlipRoot", "playerBlipRoot") 
  
  
  
--This function creates blips for all players when the resource starts. 
local function resourceStart(thePlayer) 
            local r, g, b = getTeamColor(thePlayer) 
            local blip = createBlipAttachedTo(thePlayer, 0, 2, r, g, b, 255, 1) 
            setElementParent(blip, playerBlipRoot) 
        end 
addEventHandler("onClientResourceStart", getRootElement(), resourceStart) 
  
  
  
--This function creates a blip for new players when they join. 
  
local function playerJoin(thePlayer) 
    local r, g, b = getTeamColor(thePlayer) 
    local blip = createBlipAttachedTo(thePlayer, 0, 2, r, g, b, 255, 1) 
    setElementParent(blip, playerBlipRoot) 
    setTimer(updateBlipColor, 1500, 1, blip) --Upadate in 2 seconds, in case the server sets the color. 
    function updateBlipColor(thePlayer) 
    local attach = getElementAttachedTo(thePlayer) 
    if ( attach ) then 
        local r, g, b = getTeamColor(thePlayer) 
        setBlipColor(blip, r, g, b, 255) 
    end 
    setTimer(updateBlipColor, 500, 1) 
end 
end 
addEventHandler("onClientPlayerJoin", getRootElement(), playerJoin) 
  
  
local function playerQuit() 
  
    for _, blip in ipairs(getElementChildren(playerBlipRoot)) do 
  
        if getElementAttachedTo(blip) == source then 
  
            destroyElement(blip) 
  
        end 
  
    end 
  
end 
  
addEventHandler("onClientPlayerQuit", root, playerQuit) 
  
  

If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE

SCOTLAND, my hometown, and the Home of GTA!

Posted

but i need in same script other then i charge team or other's charge team the color of blip not charget why?

local playerBlipRoot = createElement("playerBlipRoot", "playerBlipRoot") 
  
function resourceStart() 
    for _, player in ipairs(getElementsByType("player")) do 
        if player ~= localPlayer then 
            local r,g,b = getTeamColor(getPlayerTeam(player)) 
            local blip = createBlipAttachedTo(player, 0, 2, r,g,b, 255, 1) 
            setElementParent(blip, playerBlipRoot) 
        end 
    end 
end 
addEventHandler("onClientResourceStart", root, resourceStart) 
  
function playerJoin() 
    local r,g,b = getTeamColor(getPlayerTeam(source)) 
    local blip = createBlipAttachedTo(source, 0, 2, r,g,b, 255, 1) 
    setElementParent(blip, playerBlipRoot) 
    setTimer(updateBlipColor, 1500, 1, blip) 
end 
addEventHandler("onClientPlayerJoin", root, playerJoin) 
  
--This function destroys a players blip when they quit. 
function playerQuit() 
    for _, blip in ipairs(getElementChildren(playerBlipRoot)) do 
        if getElementAttachedTo(blip) == source then 
            destroyElement(blip) 
        end 
    end 
end 
addEventHandler("onClientPlayerQuit", root, playerQuit) 
  
function updateBlipColor(player) 
    local attach = getElementAttachedTo(player) 
    if ( attach ) then 
        local r,g,b = getTeamColor(getPlayerTeam(player)) 
        setBlipColor(blip, r,g,b, 255) 
    end 
end 
  
setTimer(updateBlipColor, 1000, 0) 

Giving a Fuck? Nope, That isn't in My Skill Set

castie11.png

Posted
super fail not see blips

Stop saying fail, the blips could not be showing because of one wrong letter in the script.

If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE

SCOTLAND, my hometown, and the Home of GTA!

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