papam77 Posted July 28, 2013 Share Posted July 28, 2013 function car ( vehicle ) local barva = getVehicleColor ( vehicle ) local r, g, b = 255, 255, 255 if not barva == r and barva == g and barva == b then setVehicleColor ( localVehicle, 255 ,255 ,255 ) end end addEventHandler ("onClientResourceStart", getResourceRootElement(getThisResource()), car ) Why this doesn't set car color to white when is any other color than white? Link to comment
iMr.3a[Z]eF Posted July 28, 2013 Share Posted July 28, 2013 (edited) function car ( ) local vehicle = getElementType( "vehicle") local r, g, b = 255, 255, 255 if not getVehicleColor ( vehicle ) == r, g, b then setVehicleColor ( vehicle, 255 ,255 ,255 ) end end addEventHandler ("onClientResourceStart", resourceRoot, car ) Edited July 28, 2013 by Guest Link to comment
Moderators IIYAMA Posted July 28, 2013 Moderators Share Posted July 28, 2013 addEventHandler ("onClientResourceStart", resourceRoot, car ) Link to comment
iMr.3a[Z]eF Posted July 28, 2013 Share Posted July 28, 2013 addEventHandler ("onClientResourceStart", resourceRoot, car ) Thx for warn, code Edited. Link to comment
Moderators IIYAMA Posted July 28, 2013 Moderators Share Posted July 28, 2013 Thx for warn, code Edited. np. Link to comment
papam77 Posted July 28, 2013 Author Share Posted July 28, 2013 It has errors http://www.upload.ee/image/3474033/errprs.png Link to comment
Moderators IIYAMA Posted July 28, 2013 Moderators Share Posted July 28, 2013 Question: must all vehicles have white colours after the script starts? to be honest I don't know what you want to make. Is this what you want to make? addEventHandler ("onClientResourceStart", resourceRoot, function ( ) local r, g, b,vehicles = 255, 255, 255,getElementsByType( "vehicle") for i=1,#vehicles do local vehicle = vehicles[i] local r2,g2,b2 = getVehicleColor ( vehicle ) if r2 ~= r or g2 ~= g or b2 ~= b then setVehicleColor ( vehicle, 255 ,255 ,255 ) end end end) Link to comment
papam77 Posted July 28, 2013 Author Share Posted July 28, 2013 I need if player has car with any other color out of white to automaticaly change it to white if is other color. Link to comment
Moderators IIYAMA Posted July 28, 2013 Moderators Share Posted July 28, 2013 Try this, the race resource may change the colour after spawning, but I am not sure about that. addEventHandler ("onVehicleEnter", root, function ( ) local r2,g2,b2 = getVehicleColor ( source) if r2 ~= 255 or g2 ~= 255 or b2 ~= 255 then setVehicleColor ( source, 255 ,255 ,255 ) end end) Updated Link to comment
iMr.3a[Z]eF Posted July 28, 2013 Share Posted July 28, 2013 addEventHandler ("onVehicleEnter", root, function ( ) local r2,g2,b2 = getVehicleColor ( source ) if r2,g2,b2 ~= 255, 255, 255 then setVehicleColor ( source, 255 ,255 ,255 ) end end ) Link to comment
Moderators IIYAMA Posted July 28, 2013 Moderators Share Posted July 28, 2013 @ iMr.3a[Z]eFYou can't use swap there. if r2,g2,b2 ~= 255, 255, 255 then addEventHandler ("onVehicleEnter", root, function ( ) setVehicleColor ( source, 255 ,255 ,255, 255 ,255 ,255, 255 ,255 ,255, 255 ,255 ,255 ) end) Link to comment
iMr.3a[Z]eF Posted July 28, 2013 Share Posted July 28, 2013 addEventHandler ("onVehicleEnter", root, function ( ) setVehicleColor ( source, 255 ,255 ,255, 255 ,255 ,255, 255 ,255 ,255, 255 ,255 ,255 ) end) WTF??????????? what did you just did. Link to comment
Moderators IIYAMA Posted July 28, 2013 Moderators Share Posted July 28, 2013 addEventHandler ("onVehicleEnter", root, function ( ) setVehicleColor ( source, 255 ,255 ,255, 255 ,255 ,255, 255 ,255 ,255, 255 ,255 ,255 ) end) WTF??????????? what did you just did. Syntax bool setVehicleColor ( vehicle theVehicle, int r1, int g1, int b1, [int r2, int g2, int b2,] [int r3, int g3, int b3,] [int r4, int g4, int b4] ) @ iMr.3a[Z]eFYou can't use swap there. if r2,g2,b2 ~= 255, 255, 255 then Link to comment
papam77 Posted July 28, 2013 Author Share Posted July 28, 2013 But race is giving this, but i am too much lazy to change everything to 1 ################################################################ # This file defines the color combinations a vehicle can have. # # The syntax is: # [Vehicle ID] [Color 1] [Color 2] [Color 3] [Color 4] # # Note that for the majority of vehicles Color 3 and Color 4 # have no effect and therefore are not used in their color # combinations. # # You can specify a vehicle ID more than once to add several # color combinations for that vehicle. The color used for that # vehicle will be randomly chosen from them when the vehicle # is spawned (if the color was not specified upon spawning). # # Explanations of IDs of colors and vehicles can be found # in these wiki articles: # # [url=http://development.mtasa.com/index.php?title=Vehicle_Colors]http://development.mtasa.com/index.php? ... cle_Colors[/url] # [url=http://development.mtasa.com/index.php?title=Vehicle_IDs]http://development.mtasa.com/index.php? ... ehicle_IDs[/url] # # If you break something when editing this file, just delete it # and the server will recreate it using GTA's default values. ################################################################ 416 1 445 1 445 1 445 1 445 1 445 1 445 1 445 1 445 1 485 1 485 1 485 1 485 1 485 1 485 1 485 1 429 1 429 1 429 1 429 1 429 1 429 1 429 1 429 1 433 1 499 1 499 1 499 1 499 1 499 1 499 1 499 1 499 1 496 1 496 1 496 1 496 1 496 1 496 1 496 1 496 1 422 1 422 1 422 1 422 1 422 1 422 1 422 1 424 1 424 1 424 1 424 1 424 1 424 1 424 1 424 1 481 1 481 1 481 1 481 1 481 1 481 1 481 1 481 1 401 1 401 1 401 1 401 1 401 1 401 1 401 1 401 1 402 1 402 1 402 1 402 1 402 1 402 1 402 1 402 1 431 1 431 1 431 1 431 1 431 1 431 1 431 1 431 1 438 1 482 41 41 482 48 48 482 52 52 482 64 64 482 71 71 482 85 85 482 10 10 482 62 62 415 20 1 415 25 1 415 36 1 415 40 1 415 62 1 415 75 1 415 92 1 415 0 1 437 54 7 437 79 7 437 87 7 437 95 16 437 98 20 437 105 20 437 123 20 437 125 21 472 56 15 472 56 53 480 73 45 480 12 12 480 2 2 480 6 6 480 4 4 480 46 46 480 53 53 473 56 15 473 56 53 406 1 1 407 3 1 486 1 1 427 0 1 419 45 75 419 47 76 419 33 75 419 13 76 419 54 75 419 69 76 419 59 75 419 87 76 462 12 12 462 13 13 462 14 14 462 1 2 462 2 1 462 1 3 462 3 1 462 10 10 490 0 0 455 84 15 455 84 58 455 84 31 455 32 74 455 43 31 455 1 31 455 77 31 455 32 74 463 79 79 463 84 84 463 7 7 463 11 11 463 19 19 463 22 22 463 36 36 463 53 53 466 67 76 466 68 76 466 78 76 466 2 76 466 16 76 466 18 76 466 25 76 466 45 88 434 1 1 434 12 12 434 2 2 434 6 6 434 4 4 434 46 46 434 53 53 474 97 1 474 81 1 474 105 1 474 110 1 474 91 1 474 74 1 474 84 1 474 83 1 492 30 26 492 77 26 492 81 27 492 24 55 492 28 56 492 49 59 492 52 69 492 71 107 425 43 0 Link to comment
papam77 Posted July 28, 2013 Author Share Posted July 28, 2013 it is GTA:SA file with all colors able to car types vehiclecolors.conf Link to comment
iMr.3a[Z]eF Posted July 28, 2013 Share Posted July 28, 2013 Why you posted it here then? Link to comment
papam77 Posted July 28, 2013 Author Share Posted July 28, 2013 For someone else I guess i am not alone who don't know how to change it. I already know it. 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