Jump to content

color player


mr.Extreme

Recommended Posts

hello i want help

what the problem here

  
  
local lowerBound,upperBound = unpack(get"color_range") 
g_Root = getRootElement () 
g_ResourceRoot = getResourceRootElement ( getThisResource () ) 
  
addEventHandler ( "onResourceStart", g_ResourceRoot, 
    function() 
        for i,player in ipairs(getElementsByType"player") do 
            processPlayer ( player ) 
        end 
    end 
) 
  
function processPlayer ( player ) 
        if not isElement(blip) then 
            blip = createBlipAttachedTo(source) 
        end 
        local theTeam = getPlayerTeam(source) 
        if theTeam then 
            local r, g, b = getTeamColor(theTeam) 
            setPlayerNametagColor(source, r, g, b) 
            setBlipColor(blip, r, g, b, 255) 
        else 
        --[[if not isElement(blip1[source]) then 
            blip1[source] = createBlipAttachedTo(source) 
        end]] 
            player = player or source 
            local rr, gg, bb = math.random(lowerBound, upperBound), math.random(lowerBound, upperBound), math.random(lowerBound, upperBound) 
            setPlayerNametagColor(player, rr, gg, bb) 
            --setBlipColor(blip1[source], rr, gg, bb, 255) 
            --destroyElement(blip[source]) 
    end 
end 
addEventHandler ( "onPlayerLogin", getRootElement(), processPlayer ) 
  
function setColorPlayer() 
    if not isElement(blips) then 
        blips = createBlipAttachedTo(source) 
    end 
    player = player or source 
    local rr, gg, bb = math.random(lowerBound, upperBound), math.random(lowerBound, upperBound), math.random(lowerBound, upperBound) 
    setPlayerNametagColor(player, rr, gg, bb) 
    setBlipColor(blips, rr, gg, bb, 255) 
end 
addEventHandler("onPlayerJoin", getRootElement(), setColorPlayer) 
  
function ifnottheteam() 
    local theTeams = getPlayerTeam(source) 
    if not theTeams then 
        destroyElement(blip) 
    end 
    if theTeams then 
    destroyElement(blips) 
    end 
end 
addEventHandler("onPlayerLogin", getRootElement(), ifnottheteam) 
  
  
addEventHandler("onPlayerQuit", root, 
function() 
    if isElement(blip) then 
         destroyElement(blip) 
         destroyElement(blips) 
    end 
end 
) 
  
  
  
--[[ 
addEventHandler('onPlayerChat', g_Root, 
    function(msg, type) 
        if type == 0 then 
            cancelEvent() 
            local r, g, b = getPlayerColor(source) 
            local name = getPlayerName(source) 
            local msg = msg:gsub('#%x%x%x%x%x%x', '') 
            outputChatBox( name.. ': #FFFFFF' .. msg, g_Root, r, g, b, true) 
            outputServerLog( "CHAT: " .. name .. ": " .. msg ) 
        end 
    end 
) 
]] 
getPlayerColor = getPlayerNametagColor 
getPlayerColour = getPlayerNametagColor 
  

:(

Link to comment
local lowerBound,upperBound = unpack(get"color_range") 

(get"color_range")

It's wrong.

How exactly is it wrong? because he forgot about the parentheses before " and after "? if so, then you are wrong, because that'll work anyway.

My bad, I never used the get function, thought it was needed parentheses.

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