Fury Posted July 21, 2012 Share Posted July 21, 2012 (edited) -- Edited July 27, 2012 by Guest Link to comment
Castillo Posted July 21, 2012 Share Posted July 21, 2012 function vehicleHealth ( ) for index, player in ipairs ( getElementsByType ( "player" ) ) do local vehicle = getPedOccupiedVehicle ( player ) if ( vehicle ) then local vehicleHealth = getElementHealth ( vehicle ) if ( math.floor ( vehicleHealth / 10 ) < 25 ) then setVehicleColor ( vehicle, 204, 0, 0, 0, 0, 0 ) end end end end setTimer ( vehicleHealth, 2000, 0 ) That? Link to comment
Fury Posted July 21, 2012 Author Share Posted July 21, 2012 function vehicleHealth ( ) for index, player in ipairs ( getElementsByType ( "player" ) ) do local vehicle = getPedOccupiedVehicle ( player ) if ( vehicle ) then local vehicleHealth = getElementHealth ( vehicle ) if ( math.floor ( vehicleHealth / 10 ) < 25 ) then setVehicleColor ( vehicle, 204, 0, 0, 0, 0, 0 ) end end end end setTimer ( vehicleHealth, 2000, 0 ) That? thanks but its set colour only first one (204,0,0). Link to comment
Castillo Posted July 21, 2012 Share Posted July 21, 2012 Are you sure the color supports 2 colors? Link to comment
Fury Posted July 21, 2012 Author Share Posted July 21, 2012 (edited) -- Edited July 27, 2012 by Guest Link to comment
Castillo Posted July 21, 2012 Share Posted July 21, 2012 Yes, you can get random color using the function: math.random Link to comment
Fury Posted July 21, 2012 Author Share Posted July 21, 2012 Are you sure the color supports 2 colors? no maybe i can use random on first argument ® (204 and 0) is that possible? edit: local colour ={ {204,0,0}, {0,0,0}, {165,42,42}, } function vehicleHealth ( ) for index, player in ipairs ( getElementsByType ( "player" ) ) do local vehicle = getPedOccupiedVehicle ( player ) if ( vehicle ) then local rndm = math.random( 1, #colour) local vehicleHealth = getElementHealth ( vehicle ) if ( math.floor ( vehicleHealth / 10 ) < 30 ) then setVehicleColor ( vehicle, colour[rndm] [1] ) end end end end setTimer ( vehicleHealth, 1000, 0 ) hm? with this code i have got this error: Link to comment
Castillo Posted July 21, 2012 Share Posted July 21, 2012 local colour = { { 204, 0, 0 }, { 0, 0, 0 }, { 165, 42, 42 }, } function vehicleHealth ( ) for index, player in ipairs ( getElementsByType ( "player" ) ) do local vehicle = getPedOccupiedVehicle ( player ) if ( vehicle ) then local rndm = math.random ( #colour ) local vehicleHealth = getElementHealth ( vehicle ) if ( math.floor ( vehicleHealth / 10 ) < 30 ) then setVehicleColor ( vehicle, unpack ( colour [ rndm ] ) ) end end end end setTimer ( vehicleHealth, 1000, 0 ) Link to comment
R.y.c.k Posted July 23, 2012 Share Posted July 23, 2012 this will allow name color=car color ? I ask only because players can have a beautiful color than the base color Link to comment
Castillo Posted July 23, 2012 Share Posted July 23, 2012 This has nothing to do with the nick name color. 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