zielonek Posted February 23, 2011 Share Posted February 23, 2011 Hi, Could someone write me a script to change the color of car for account Mafi? On the server, all cars are red. addEventHandler( "onPlayerLogin", root, function( _, acc ) if getAccountName( acc ) == "Mef" then local veh = getPedOccupiedVehicle( source ); if veh then setVehicleColor( veh, 86, 86, 0, 0 ); end; end; end ); How to combine it with that? function randomVehColors() for i, car in ipairs( getElementsByType( "vehicle" ) ) do local color = {} color[1] = math.random(5,5) color[2] = math.random(5,5) color[3] = math.random(5,5) color[4] = math.random(5,5) setVehicleColor ( car, color[1], color[2], color[3], color[4] ) end end setTimer( randomVehColors, 500, 0 ) Im try two and this change all players car color Help me Thanks. Link to comment
Martyz Posted February 23, 2011 Share Posted February 23, 2011 addEventHandler("onPlayerLogin", getRootElement(), function( _, acc) if getAccountName( acc ) == "Mef" then local veh = getPedOccupiedVehicle( source ) if veh then local color = {} color[1] = math.random(0,5) color[2] = math.random(0,5) color[3] = math.random(0,5) color[4] = math.random(0,5) setVehicleColor ( car, color[1], color[2], color[3], color[4]) end end end ) Link to comment
proracer Posted February 23, 2011 Share Posted February 23, 2011 First argument in setVehicleColor (line 11) should be "veh" not "car". Link to comment
zielonek Posted February 23, 2011 Author Share Posted February 23, 2011 Thanks , but don't working Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now