yToPzz Posted June 16, 2022 Share Posted June 16, 2022 -- //#Rainbow Car rainbow = {} function rainbowCar() for _, player in pairs(getElementsByType("player")) do if getElementData(player, "rainbowEnabled") then local vehicle = getPedOccupiedVehicle(player) if vehicle then if not rainbow[player] then rainbow[player] = 0 return end local r, g, b = getVehicleColor(vehicle, true) if rainbow[player] == 0 then if r < 250 then r = r + 3 if r > 255 then r = 250 end else rainbow[player] = 1 end end if rainbow[player] == 1 then if g < 250 then g = g + 3 else rainbow[player] = 2 end elseif rainbow[player] == 2 then if b < 255 then if r > 0 then r = r - 3 else r = 0 end b = b + 3 if b > 255 then b = 255 end else rainbow[player] = 3 end elseif rainbow[player] == 3 then if g > 0 then if r > 0 then r = r - 3 else r = 0 end g = g - 3 if g < 0 then g = 0 end else rainbow[player] = 4 end elseif rainbow[player] == 4 then if b > 0 then b = b - 3 if b < 0 then b = 0 end else b = 0 rainbow[player] = 0 end end setVehicleColor(vehicle, r, g, b) ---- line 866 WARNING end end end end addEventHandler("onClientPreRender", getRootElement(), rainbowCar) WARNING: VIP-Silver\client.lua:866: Expected positive value, got negative. This warning may be an error in future versions. Link to comment
MouNiR.Dz Posted June 18, 2022 Share Posted June 18, 2022 (edited) I am not sure but i think EDIT : if r is more than 0 so it could be 1 or 2 * if r > 0 then -- if r is less than 0 so for example if its 1 r = r - 3 -- sub 3 from 1 will get the result -2 so its a negative value i think you should use if r > 3 then instead And yes the same for the other colors like g and b Edited June 18, 2022 by MouNiR.Dz 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