Jump to content

vehcolor


Reflex#

Recommended Posts

Posted
function setVehColor(playerSource) 
    local teamOfPlayer = getPlayerTeam(playerSource) 
    local r,g,b = getTeamColor(teamOfPlayer) 
    local vehOfPlayer = getPedOccupiedVehicle(playerSource) 
    if (vehOfPlayer) then 
        setVehicleColor(vehOfPlayer, r,g,b,r,g,b,r,g,b,r,g,b) 
    else 
        setVehicleColor(vehOfPlayer, 1, 1, 1, 1) 
    end 
end 
  
addEventHandler("onVehicleEnter", getRootElement(), setVehColor) 

I create this script..when map start,color of car is true..but when car change..color changing too.

Help :)

This is debugscript 3:

WARNING: vehcolor/server.lua:3: Bad argument @ 'getTeamColor' 
 WARNING: vehcolor/server.lua:6: Bad argument @ 'setVehicleColor' 

Scripting in lua

Posted
function setVehColor ( playerSource ) 
    local teamOfPlayer = getPlayerTeam ( playerSource ) 
    if ( teamOfPlayer ) then 
        local r, g, b = getTeamColor ( teamOfPlayer ) 
        setVehicleColor ( source, r, g, b, r, g, b, r, g, b, r, g, b ) 
    end 
end 
addEventHandler ( "onVehicleEnter", getRootElement ( ), setVehColor ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
function setVehColor ( playerSource ) 
    local teamOfPlayer = getPlayerTeam ( playerSource ) 
    if ( teamOfPlayer ) then 
        local r, g, b = getTeamColor ( teamOfPlayer ) 
        setVehicleColor ( source, r, g, b, r, g, b, r, g, b, r, g, b ) 
    end 
end 
addEventHandler ( "onVehicleEnter", getRootElement ( ), setVehColor ) 

dont work :(

Scripting in lua

Posted
function setVehColor ( playerSource ) 
    local teamOfPlayer = getPlayerTeam ( playerSource ) 
    if ( teamOfPlayer ) then 
        local r, g, b = getTeamColor ( teamOfPlayer ) 
        setVehicleColor ( source, r, g, b, r, g, b, r, g, b, r, g, b ) 
    end 
end 
addEventHandler ( "onVehicleEnter", getRootElement ( ), setVehColor ) 
addEventHandler ( "onPlayerPickUpRacePickup", getRootElement ( ), setVehColor ) 

maybe?

Posted
function setVehColor ( playerSource ) 
    local teamOfPlayer = getPlayerTeam ( playerSource ) 
    if ( teamOfPlayer ) then 
        local r, g, b = getTeamColor ( teamOfPlayer ) 
        setVehicleColor ( source, r, g, b, r, g, b, r, g, b, r, g, b ) 
    end 
end 
addEventHandler ( "onVehicleEnter", getRootElement ( ), setVehColor ) 
addEventHandler ( "onPlayerPickUpRacePickup", getRootElement ( ), setVehColor ) 

maybe?

WARNING: vehcolor/server.lua:2: Bad 'player' pointer @ 'getPlayerTeam'(1)

Scripting in lua

Posted
function setVehColor ( playerSource ) 
    local teamOfPlayer = getPlayerTeam ( playerSource ) 
    if ( teamOfPlayer ) then 
        local r, g, b = getTeamColor ( teamOfPlayer ) 
        setVehicleColor ( source, r, g, b, r, g, b, r, g, b, r, g, b ) 
    end 
end 
addEventHandler ( "onVehicleEnter", getRootElement ( ), setVehColor ) 

dont work :(

worked for me

Please do not PM me with scripting related question nor support, use the forums instead.

Posted
function setVehColor ( playerSource ) 
    local teamOfPlayer = getPlayerTeam ( playerSource ) 
    if ( teamOfPlayer ) then 
        local r, g, b = getTeamColor ( teamOfPlayer ) 
        setVehicleColor ( source, r, g, b, r, g, b, r, g, b, r, g, b ) 
    end 
end 
addEventHandler ( "onVehicleEnter", getRootElement ( ), setVehColor ) 

dont work :(

worked for me

when car change,color too

Scripting in lua

Posted
function zaa(theVehicle) 
    if getPlayerTeam (source) then 
        local r, g, b = getTeamColor ( getPlayerTeam ( source) ) 
        if theVehicle then 
            setVehicleColor ( theVehicle, r,g,b,r,g,b) 
        end 
    end 
end 
addEventHandler("onPlayerVehicleEnter",getRootElement(),zaa) 
addEventHandler("onPlayerPickUpRacePickup",getRootElement(),zaa)  

this must worked

Posted
  
function zaa(theVehicle) 
    if getPlayerTeam (source) then 
        local r, g, b = getTeamColor ( getPlayerTeam ( source) ) 
        if theVehicle then 
            setVehicleColor ( theVehicle, r,g,b,r,g,b) 
        end 
    end 
end 
addEventHandler("onPlayerVehicleEnter",getRootElement(),zaa) 
addEventHandler("onPlayerPickUpRacePickup",getRootElement(),zaa)  

this must worked

You test it? :D

Scripting in lua

Posted

make sure the server side in the meta.xml

Please do not PM me with scripting related question nor support, use the forums instead.

Posted
  
function zaa(theVehicle) 
    if getPlayerTeam (source) then 
        local r, g, b = getTeamColor ( getPlayerTeam ( source) ) 
        if theVehicle then 
            setVehicleColor ( theVehicle, r,g,b,r,g,b) 
        end 
    end 
end 
addEventHandler("onPlayerVehicleEnter",getRootElement(),zaa) 
addEventHandler("onPlayerPickUpRacePickup",getRootElement(),zaa)  

this must worked

You test it? :D

WARNING: vehcolor/server.lua:5: Bad argument @ 'setVehicleColor'

Scripting in lua

Posted

What you want to do?

addEvent ( 'onPlayerPickUpRacePickup', true ); 
  
function zaa ( vehicle ) 
    if ( getPlayerTeam ( source ) ) then 
        local r, g, b = getTeamColor ( getPlayerTeam ( source ) ) 
        setVehicleColor ( vehicle, r, g, b ); 
    end 
) 
addEventHandler ( 'onPlayerVehicleEnter', root, zaa ); 
addEventHandler ( 'onPlayerPickUpRacePickup', root, zaa );  

Simple.

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

Posted

dont work :(

worked for me

when car change,color too

when you enter a vehicle, the color is equal to your team.

That's what you want?

Please do not PM me with scripting related question nor support, use the forums instead.

Posted
What you want to do?
addEvent ( 'onPlayerPickUpRacePickup', true ); 
  
function zaa ( vehicle ) 
    if ( getPlayerTeam ( source ) ) then 
        local r, g, b = getTeamColor ( getPlayerTeam ( source ) ) 
        setVehicleColor ( vehicle, r, g, b ); 
    end 
) 
addEventHandler ( 'onPlayerVehicleEnter', root, zaa ); 
addEventHandler ( 'onPlayerPickUpRacePickup', root, zaa );  

Simple.

When map start,color of car=color of team,all good,but when during the map,i pickup another car,color changed on another,so i want that when car change,color dont changed,remained like color of team

Scripting in lua

Posted (edited)
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 ); 

Try.

Edited by Guest

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

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