Jump to content

Vehicle color


Reflex#

Recommended Posts

    addEvent ( 'onPlayerPickUpRacePickup', true ); 
      
    function zaa ( vehicle, id ) 
        if ( getPlayerTeam ( source ) ) then 
            if ( eventName == 'onPlayerPickUpRacePickup' and id == 'vehiclechange' or id == 'repair' or id == 'nitro' ) then 
                local r, g, b = getTeamColor ( getPlayerTeam ( source ) ) 
                setVehicleColor ( vehicle, r, g, b ); 
            else 
                local r, g, b = getTeamColor ( getPlayerTeam ( source ) ) 
                setVehicleColor ( vehicle, r, g, b ) 
            end 
        end 
    end 
    addEventHandler ( 'onPlayerVehicleEnter', root, zaa ); 
    addEventHandler ( 'onPlayerPickUpRacePickup', root, zaa ); 

/debugscript 3:

Bad argument @ setVehicleColor

Link to comment

'onPlayerPickUpRacePickup' doesn't provide vehicle element..

try this:

addEvent ( 'onPlayerPickUpRacePickup', true ) 
      
    function zaa ( id, type, model ) 
        if ( getPlayerTeam ( source ) ) then 
            if ( eventName == 'onPlayerPickUpRacePickup' and id == 'vehiclechange' or id == 'repair' or id == 'nitro' ) then 
                local r, g, b = getTeamColor ( getPlayerTeam ( source ) ) 
                local vehicle = getPedOccupiedVehicle(source) 
                setVehicleColor ( vehicle, r, g, b ); 
            else 
                local r, g, b = getTeamColor ( getPlayerTeam ( source ) ) 
                 local vehicle = getPedOccupiedVehicle(source) 
                setVehicleColor ( vehicle, r, g, b ) 
            end 
        end 
    end 
    addEventHandler ( 'onPlayerVehicleEnter', root, zaa ) 
    addEventHandler ( 'onPlayerPickUpRacePickup', root, zaa ) 

Link to comment
'onPlayerPickUpRacePickup' doesn't provide vehicle element..

try this:

addEvent ( 'onPlayerPickUpRacePickup', true ) 
      
    function zaa ( id, type, model ) 
        if ( getPlayerTeam ( source ) ) then 
            if ( eventName == 'onPlayerPickUpRacePickup' and id == 'vehiclechange' or id == 'repair' or id == 'nitro' ) then 
                local r, g, b = getTeamColor ( getPlayerTeam ( source ) ) 
                local vehicle = getPedOccupiedVehicle(source) 
                setVehicleColor ( vehicle, r, g, b ); 
            else 
                local r, g, b = getTeamColor ( getPlayerTeam ( source ) ) 
                 local vehicle = getPedOccupiedVehicle(source) 
                setVehicleColor ( vehicle, r, g, b ) 
            end 
        end 
    end 
    addEventHandler ( 'onPlayerVehicleEnter', root, zaa ) 
    addEventHandler ( 'onPlayerPickUpRacePickup', root, zaa ) 

But why bad argument on setVehicleColor?

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