Jump to content

Car color team only staff


Recommended Posts

How i make this only working for Staff Team?

  
function vehiclepaint ( player, seat ) 
    if ( seat == 0 and getPlayerTeam ( player ) ) then 
        local r,g,b = getTeamColor ( getPlayerTeam ( player ) ) 
        setVehicleColor ( source, r, g, b, 0, 0, 0 ) 
    end 
end 
addEventHandler ( "onVehicleEnter",root, vehiclepaint ) 
  
addEvent ( "onPlayerPickUpRacePickup", true ) 
addEventHandler ( "onPlayerPickUpRacePickup", root, 
    function ( pickupID, pickupType, vehicleModel ) 
        if ( pickupType == "vehiclechange" and getPlayerTeam ( source ) ) then 
            local r, g, b = getTeamColor ( getPlayerTeam ( source ) ) 
            setVehicleColor ( getPedOccupiedVehicle ( source ), r, g, b, 0, 0, 0 ) 
        end 
    end 
) 
  
addCommandHandler("addteam", 
    function(source, cmd, clantag, color, ...) 
        local name = {...} 
        if not name[1] then 
            outputChatBox("syntax: "..cmd.." ", source) 
            return 
        end 
        local r,g,b = getColorFromString(color) 
        if not r then 
            outputChatBox(cmd..": invalid color code", source) 
            return 
        end 
        name = table.concat(name, ' ') 
        local config = xmlLoadFile("config.xml") 
--      local config = getResourceConfig("config.xml") 
        local teamset, teamname 
        for name,settings in next,teams do 
            if settings.tag == clantag then 
                teamset, teamname = settings, name 
                break 
            end 
        end 
        if teamset then 
            local name_differs, color_differs 
            local c = teamset.color 
            local t = getTeamFromName(teamname) 
            if c[1] ~= r or c[2] ~= g or c[3] ~= b then 
                teamset.color = {r,g,b} 
                color_differs = true 
                if t then setTeamColor(t, r, g, b)end 
            end 
            if teamname ~= name then 
                name_differs = true 
            end 
            if color_differs or name_differs then 
                for k,child in next,xmlNodeGetChildren(config)do 
                    if xmlNodeGetAttribute(child, "tag") == clantag then 
                        if color_differs then 
                            xmlNodeSetAttribute(child, "color", string.format("#%02X%02X%02X", r, g, b)) 
                        end 
                        if name_differs then 
                            xmlNodeSetAttribute(child, "name", name) 
                        end 
                        break 
                    end 
                end 
            end 
        end 
    end 
) 
  

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