Jump to content

setVehicleColor


Recommended Posts

addEventHandler("onNotifyPlayerReady", getRootElement(), 
    function() 
        local playerTeam = getPlayerTeam" class="kw2">getPlayerTeam (source) 
        local PVeh= getPedOccupiedVehicle(source) 
        if ( playerTeam ) then 
            local teamName = getTeamName(playerTeam) 
                if teamName == "[T1]" then 
                    setVehicleColor(PVeh,30,255,0) 
                    setBlipColor(155,13,43) 
                    end  
                    end 
                    end) 
                     
                     
                     

setVehicleColor(PVeh,30,255,0)

setBlipColor(155,13,43)

have error pls help.

Edited by Guest
Link to comment
addEventHandler("onNotifyPlayerReady", getRootElement(), 
    function() 
        local playerTeam = getPlayerTeam (source) 
        local PVeh= getPedOccupiedVehicle(source) 
        if ( playerTeam ) then 
            local teamName = getTeamName(playerTeam) 
                if teamName == "[T1]" then 
                    setVehicleColor( PVeh, color1, color2, color3, color4 ) 
                    setBlipColor(155,13,43) -- where is blip create?? add blip name be4 color code 
                    end 
        end 
end) 

Link to comment

What actually are you trying to say with this link? You could ever explain, what he should take a look on. There are some more issues in his code, not only this one.

To the author:

1) about setVehicleColor function: you can't user RGB style in MTA 1.0.5, this works only with MTA 1.1 unstable. So, to get it work, you should do:

setVehicleColor( pVeh, 86, 86, 0, 0 ) --id 86 is green color, but not so toxic like yours (30, 255, 0) 

2) I assume you have attached blip to your vehicle, so you have to check all the attached elements and if the type of the element is 'blip', then set it's color:

for k, el in ipairs( getAttachedElements( pVeh ) ) do 
  if getElementType( el ) == "blip" then 
    setBlipColor( el, 155,13,43, 255 ) --this function also has the 4th parameter: alpha 
  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...