RyaanThiago Posted February 20, 2016 Posted February 20, 2016 Someone tell me function name Rainbow ? is a function that changes the color of your vehicle can someone tell me the name of this function?
Addlibs Posted February 20, 2016 Posted February 20, 2016 There is no such function. You need to write it yourself.
Captain Cody Posted February 20, 2016 Posted February 20, 2016 function rainbowbotches (playerSource) local theVehicle = getPedOccupiedVehicle ( playerSource ) thetimer = setTimer ( rainbow, 1000, 0, theVehicle ) end function rainbow (vehicle) local r, g, b = math.random( 255 ), math.random( 255 ), math.random( 255 ) setVehicleColor( vehicle, r, g, b ) end function rainbowstop () killTimer ( thetimer ) end addCommandHandler ( "rainbow", rainbowbotches ) addCommandHandler ( "stoprainbow", rainbowstop ) Pros = It may work Cons = Canceling may be an issue with multiple vehicles
Bonus Posted February 20, 2016 Posted February 20, 2016 local vehRainbowTimer = {} local sectoswitchcolor = 0.1 -- can change that local function colorTheVehicle ( veh ) if getVehicleOccupant ( veh ) then setVehicleColor ( veh, math.random ( 255 ), math.random ( 255 ), math.random ( 255 ) ) elseif isTimer ( vehRainbowTimer[veh] ) then killTimer ( vehRainbowTimer[veh] ) end end local function rainbowWhatever ( player ) local veh = getPedOccupiedVehicle ( player ) if veh and getPedOccupiedVehicleSeat ( player ) == 0 then vehRainbowTimer[veh] = setTimer ( colorTheVehicle, sectoswitchcolor * 1000, 0, veh ) end end I did it with "if getVehicleOccupant ( veh ) then" instead of "onVehicleExit" because in some situations it doesnt trigger onVehicleExit or onPlayerVehicleExit even if you are out (I think when you get ported out or spawn somewhere else with spawnPlayer, not sure).
Captain Cody Posted February 20, 2016 Posted February 20, 2016 That certainly works to, I just gave him bare bone one because he didn't even attempt.
RyaanThiago Posted February 22, 2016 Author Posted February 22, 2016 if painel == true then if state == "down" then if isCursorOnElement (627, 227, 165, 167) then local theVehicle = getPedOccupiedVehicle ( localPlayer ) thetimer = setTimer ( rainbow, 1000, 1, theVehicle ) end end end end function rainbow (vehicle) local vehicle = getPedOccupiedVehicle ( localPlayer ) local r, g, b = math.random( 255 ), math.random( 255 ), math.random( 255 ) setVehicleColor( vehicle, r, g, b ) end function rainbowstop () killTimer ( thetimer ) end addCommandHandler ( "rainbow", rainbowbotches ) addCommandHandler ( "stoprainbow", rainbowstop ) So guys what's wrong with it. it's not working why ? guys something is wrong ?
Bonus Posted February 22, 2016 Posted February 22, 2016 Clientsided you are the only one who can see the rainbow colors.
RyaanThiago Posted February 23, 2016 Author Posted February 23, 2016 Whats i dont understand. explain me anyone what need to this function work correctly
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