Jump to content

Nametag,blip colord


Recommended Posts

Posted

Hello,

I want a little help,

If a player get in team his nametagcolor and blipcolor change to team color like Example : If player was in Forever Team he's namecolor and blip should be red please help i tryed this nut this set red color to all players

-- needs configurable blip colors, and team support 
root = getRootElement () 
color = { 0, 255, 0 } 
players = {} 
resourceRoot = getResourceRootElement ( getThisResource () ) 
  
function onResourceStart ( resource ) 
    for id, player in ipairs( getElementsByType ( "player" ) ) do 
        local r, g, b = getTeamColor ( getPlayerTeam ( player ) ) 
        createBlipAttachedTo ( player, 0, 2, r, g, b ) 
    end 
end 
  
function onPlayerSpawn ( spawnpoint ) 
    local r, g, b = getTeamColor ( getPlayerTeam ( source ) ) 
   createBlipAttachedTo ( source, 0, 2, r, g, b ) 
end 
  
function onPlayerQuit () 
    destroyBlipsAttachedTo ( source ) 
end 
  
function onPlayerWasted ( totalammo, killer, killerweapon ) 
    destroyBlipsAttachedTo ( source ) 
end 
  
function setBlipsColor ( source, commandName, r, g, b ) 
    if ( tonumber ( b ) ) then 
        for id, player in ipairs( getElementsByType ( "player" ) ) do 
            destroyBlipsAttachedTo ( player ) 
            createBlipAttachedTo ( player, 0, 2, r, g, b ) 
        end 
    end 
end 
  
function setBlipColor ( source, commandName, r, g, b ) 
    if ( tonumber ( b ) ) then 
        destroyBlipsAttachedTo ( source ) 
        createBlipAttachedTo ( source, 0, 2, r, g, b ) 
    end 
end 
  
addCommandHandler ( "setblipscolor", setBlipsColor ) 
addCommandHandler ( "setblipcolor", setBlipColor ) 
addEventHandler ( "onResourceStart", resourceRoot, onResourceStart ) 
addEventHandler ( "onPlayerSpawn", root, onPlayerSpawn ) 
addEventHandler ( "onPlayerQuit", root, onPlayerQuit ) 
addEventHandler ( "onPlayerWasted", root, onPlayerWasted ) 
  
function destroyBlipsAttachedTo(player) 
    local attached = getAttachedElements ( player ) 
    if ( attached ) then 
        for k,element in ipairs(attached) do 
            if getElementType ( element ) == "blip" then 
                destroyElement ( element ) 
            end 
        end 
    end 
end 

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

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