SkiZo Posted May 31, 2017 Share Posted May 31, 2017 Hello everyone .. i need some help .. car1 = createVehicle ( 451, 1612, 1831, 10.2, 0, 0, 0 ) car2 = createVehicle ( 451, 1618, 1831, 10.2, 0, 0, 0 ) car3 = createVehicle ( 451, 1625, 1831, 10.2, 0, 0, 0 ) i wonna set those cars to red color .. i know setVehicleColor( car1, 255, 0, 0 ) setVehicleColor( car2, 255, 0, 0 ) setVehicleColor( car1, 255, 0, 0 ) there is any other trick to do that ?? i mean setVehicleColor( [car1 and car2 and car3],255,0,0) ???? #Just a question because i'm creating about 140 Red Car Or useing table ?? ( I don't know how ) Link to comment
coNolel Posted May 31, 2017 Share Posted May 31, 2017 Eh, might be something like this VehicleTables = { veh1 = createVehicle ( 451, 1625, 1831, 10.2, 0, 0, 0 ), veh2 = createVehicle ( 451, 1625, 1831, 10.2, 0, 0, 0 ), veh3 = createVehicle ( 451, 1625, 1831, 10.2, 0, 0, 0 ), veh4 = createVehicle ( 451, 1625, 1831, 10.2, 0, 0, 0 ) } function setColors() for k, v in pairs(VehicleTables) do setVehicleColor( v, 255, 0, 0 ) end Link to comment
idarrr Posted May 31, 2017 Share Posted May 31, 2017 (edited) vehicles = {} -- Create 140 vehicles and set the color to red for i=1, 140 do local x = 1625+((i-1)*5) -- Create 5 point space of each vehicle local veh = createVehicle(451, x, 1831, 10.2, 0, 0, 0) setVehicleColor(veh, 255, 0, 0) table.insert(vehicles, veh) end -- Or if you want a separated function function setVehColor() for _, veh in pairs(vehicles) do setVehicleColor(veh, 255, 0, 0) end end Edited May 31, 2017 by idarrr Typo 1 Link to comment
SkiZo Posted May 31, 2017 Author Share Posted May 31, 2017 Thanks Both <3 a lot <3 =) <3 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