Fury Posted July 21, 2012 Posted July 21, 2012 (edited) -- Edited July 27, 2012 by Guest Destruction Derby
Castillo Posted July 21, 2012 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? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Fury Posted July 21, 2012 Author 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). Destruction Derby
Castillo Posted July 21, 2012 Posted July 21, 2012 Are you sure the color supports 2 colors? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Fury Posted July 21, 2012 Author Posted July 21, 2012 (edited) -- Edited July 27, 2012 by Guest Destruction Derby
Castillo Posted July 21, 2012 Posted July 21, 2012 Yes, you can get random color using the function: math.random San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Fury Posted July 21, 2012 Author 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: Destruction Derby
Castillo Posted July 21, 2012 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 ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Castillo Posted July 21, 2012 Posted July 21, 2012 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
R.y.c.k Posted July 23, 2012 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
Castillo Posted July 23, 2012 Posted July 23, 2012 This has nothing to do with the nick name color. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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