Jump to content

Team Color


Recommended Posts

Hello everybody,

I have a server on MTA, with 5 team. Everything is okay with the script, but I want to add one thing.

When I put players in the team, their name have the same color in chat and blip example : Fallen Army Team : have green color, I want this green color for all team player because they can't have same color just in team chat.

Can someone help me for this? Thank you!

Edited by Guest
Link to comment
addEventHandler("onResourceStart",resourceRoot,function() 
    for i,v getElementsByType("vehicle")do 
        local player = getVehicleController(i) 
        if(player)then 
            local pedTeam = getPlayerTeam(player) 
            if(pedTeam)then 
                local r,g,b = getTeamColor(pedTeam) 
                setVehicleColor(i,r,g,b) 
            else 
                setVehicleColor(i,255,255,255) 
            end 
        else 
            setVehicleColor(i,255,255,255) 
        end 
    end 
end) 
  
addEventHandler("onVehicleStartEnter",root,function(player,_,jacked) 
    local r,g,b = getTeamColor(getPlayerTeam(player)) 
    setVehicleColor(source,r,g,b) 
end) 
addEventHandler("onVehicleExit",root,function() 
    setVehicleColor(source,255,255,255) 
end) 

Link to comment
addEventHandler("onResourceStart",resourceRoot,function() 
    for i,v in ipairs ( getElementsByType("vehicle") ) do 
        local player = getVehicleController(v) 
        if(player)then 
            local pedTeam = getPlayerTeam(player) 
            if(pedTeam)then 
                local r,g,b = getTeamColor(pedTeam) 
                setVehicleColor(v,r,g,b) 
            else 
                setVehicleColor(v,255,255,255) 
            end 
        else 
            setVehicleColor(v,255,255,255) 
        end 
    end 
end) 
  
addEventHandler("onVehicleStartEnter",root,function(player,_,jacked) 
    if not getPlayerTeam ( player ) then return end 
    local r,g,b = getTeamColor(getPlayerTeam(player)) 
    setVehicleColor(source,r,g,b) 
end) 
addEventHandler("onVehicleExit",root,function() 
    setVehicleColor(source,255,255,255) 
end) 

Try this if doesn't work post the error here.

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