Jump to content

Help-ME FAST plz


RyaanThiago

Recommended Posts

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

Link to comment
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).

Link to comment

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 ?

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...