Jump to content

USER PANEL RACE


Recommended Posts

I MADE A PANEL. I CAN NOT UNDERSTAND THAT ONLY ONE ERROR. WHEN I ENTER IN THE SERVER THE FUNCTION PART WITHOUT I CLICK THE BOTTON. WHEN I CLICK THE BOTTON DO NOT REMOVE THE MONEY AND THE FUNCTION NOT PART

    guiCreateLabel(0.50, 0.10, 0.30, 0.09, "Prince:$500000", true, Tab[7]) 
    disco = guiCreateButton (0.50, 0.15, 0.40, 0.09, "DISCO LIGHTS", true, Tab[7]) 
    guiCreateLabel(0.50, 0.25, 0.30, 0.09, "Prince:$500000", true, Tab[7]) 
    rainbowColor = guiCreateButton (0.50, 0.30, 0.40, 0.09, "DISCO CAR", true, Tab[7]) 
    addEventHandler("onClientGUIClick",disco,discoheadlights,false) 
    addEventHandler("onClientGUIClick",rainbowColor,rainbowColor,false) 

r,g,b = 255,255,255 
upValues = true 
function rainbowColor (btn) 
        if upValues == true  then 
            if g <= 255 and g >= 0 and r == 0 and b == 255 then  
                r,g,b = r,g-6.375,b 
            end 
            if r <= 255 and r >= 0 and g == 255 and b == 255 then  
                r,g,b = r-6.375,g,b 
            end 
            if b <= 255 and b >= 0 and r == 0 and g == 0 then  
                r,g,b = r,g,b-6.375 
            end 
            if r == 0 and g == 0 and b == 0 then  
                upValues = false 
            end 
        end  
        if upValues == false then    
            if g <= 255 and g >= 0 and r == 255 and b == 0 then  
                r,g,b = r,g+6.375,b 
            end 
            if r <= 255 and r >= 0 and g == 0 and b == 0 then  
                r,g,b = r+6.375,g,b 
            end 
            if b <= 255 and b >= 0 and r == 255 and g == 255 then  
                r,g,b = r,g,b+6.375 
            end 
            if r == 255 and g == 255 and b == 255 then  
                upValues = true 
            end 
        end  
        for id,player in ipairs(getElementsByType("player")) do 
            local vehicle = getPedOccupiedVehicle(player) 
            if vehicle then 
                if getElementDimension(vehicle) == 0 then 
                    setVehicleColor(vehicle,r,g,b,r,g,b) 
                end 
                end 
            end 
        end 
setTimer(rainbowColor,50,0) 
  
  
function discoheadlights (btn) 
    for id,player in ipairs(getElementsByType("player")) do 
            local car = getPedOccupiedVehicle(player) 
            if car and isElement(car) then 
                local l1 = getVehicleLightState(car,0) 
                if  l1 == 0 then 
                    setVehicleHeadLightColor(car,math.random(0,255),math.random(0,255),math.random(0,255)) 
                    setVehicleLightState(car,0,1) 
                    setVehicleLightState(car,2,1) 
                    setVehicleLightState(car,1,0) 
                    setVehicleLightState(car,3,0) 
                else 
                    setVehicleHeadLightColor(car,math.random(0,255),math.random(0,255),math.random(0,255)) 
                    setVehicleLightState(car,0,0) 
                    setVehicleLightState(car,2,0) 
                    setVehicleLightState(car,1,1) 
                    setVehicleLightState(car,3,1) 
                end 
            end 
        end 
end 
setTimer(discoheadlights,1000,0) 
  

Link to comment

Try this:

guiCreateLabel(0.50, 0.10, 0.30, 0.09, "Prince:$500000", true, Tab[7]) 
    disco = guiCreateButton (0.50, 0.15, 0.40, 0.09, "DISCO LIGHTS", true, Tab[7]) 
    guiCreateLabel(0.50, 0.25, 0.30, 0.09, "Prince:$500000", true, Tab[7]) 
    rainbowColor = guiCreateButton (0.50, 0.30, 0.40, 0.09, "DISCO CAR", true, Tab[7]) 

r,g,b = 255,255,255 
upValues = true 
function rainbowColor (btn) 
        if upValues == true  then 
            if g <= 255 and g >= 0 and r == 0 and b == 255 then 
                r,g,b = r,g-6.375,b 
            end 
            if r <= 255 and r >= 0 and g == 255 and b == 255 then 
                r,g,b = r-6.375,g,b 
            end 
            if b <= 255 and b >= 0 and r == 0 and g == 0 then 
                r,g,b = r,g,b-6.375 
            end 
            if r == 0 and g == 0 and b == 0 then 
                upValues = false 
            end 
        end  
        if upValues == false then    
            if g <= 255 and g >= 0 and r == 255 and b == 0 then 
                r,g,b = r,g+6.375,b 
            end 
            if r <= 255 and r >= 0 and g == 0 and b == 0 then 
                r,g,b = r+6.375,g,b 
            end 
            if b <= 255 and b >= 0 and r == 255 and g == 255 then 
                r,g,b = r,g,b+6.375 
            end 
            if r == 255 and g == 255 and b == 255 then 
                upValues = true 
            end 
        end  
        for id,player in ipairs(getElementsByType("player")) do 
            local vehicle = getPedOccupiedVehicle(player) 
            if vehicle then 
                if getElementDimension(vehicle) == 0 then 
                    setVehicleColor(vehicle,r,g,b,r,g,b) 
                end 
                end 
            end 
        end 
  
  
function discoheadlights (btn) 
    for id,player in ipairs(getElementsByType("player")) do 
            local car = getPedOccupiedVehicle(player) 
            if car and isElement(car) then 
                local l1 = getVehicleLightState(car,0) 
                if  l1 == 0 then 
                    setVehicleHeadLightColor(car,math.random(0,255),math.random(0,255),math.random(0,255)) 
                    setVehicleLightState(car,0,1) 
                    setVehicleLightState(car,2,1) 
                    setVehicleLightState(car,1,0) 
                    setVehicleLightState(car,3,0) 
                else 
                    setVehicleHeadLightColor(car,math.random(0,255),math.random(0,255),math.random(0,255)) 
                    setVehicleLightState(car,0,0) 
                    setVehicleLightState(car,2,0) 
                    setVehicleLightState(car,1,1) 
                    setVehicleLightState(car,3,1) 
                end 
            end 
        end 
end 
  
isRainbowColor = false 
isLightRainbowColor = false 
  
addEventHandler("onClientGUIClick", root, 
function() 
if ( source == rainbowColor ) then 
if isRainbowColor then 
if isTimer(RainbowTimer) then 
killTimer(RainbowTimer) 
end 
isRanbowColor = false 
else 
RainbowTimer = setTimer(rainbowColor,50,0) 
isRanbowColor = true 
end 
elseif ( source == disco ) then 
if isLightRainbowColor then 
if isTimer(LightTimer) then 
killTimer(LightTimer) 
end 
isLightRainbowColor = false 
else 
LightTimer = setTimer(discoheadlights,1000,0) 
isLightRainbowColor = true 
end 
end 
end 
) 

You can turn on and turn off.

Link to comment
  
function rainbowColor () 
        for id,player in ipairs(getElementsByType("player")) do 
            local vehicle = getPedOccupiedVehicle(player) 
            if vehicle then 
                if getElementDimension(vehicle) == 0 then 
                    setVehicleColor(vehicle, math.random(0,255), math.random(0,255), math.random(0,255), math.random(0,255), math.random(0,255), math.random(0,255) ) 
                end 
                end 
            end 
end 
  
  
function discoheadlights (btn) 
    for id,player in ipairs(getElementsByType("player")) do 
            local car = getPedOccupiedVehicle(player) 
            if car and isElement(car) then 
                local l1 = getVehicleLightState(car,0) 
                if  l1 == 0 then 
                    setVehicleHeadLightColor(car,math.random(0,255),math.random(0,255),math.random(0,255)) 
                    setVehicleLightState(car,0,1) 
                    setVehicleLightState(car,2,1) 
                    setVehicleLightState(car,1,0) 
                    setVehicleLightState(car,3,0) 
                else 
                    setVehicleHeadLightColor(car,math.random(0,255),math.random(0,255),math.random(0,255)) 
                    setVehicleLightState(car,0,0) 
                    setVehicleLightState(car,2,0) 
                    setVehicleLightState(car,1,1) 
                    setVehicleLightState(car,3,1) 
                end 
            end 
        end 
end 
  
isRainbowColor = false 
isLightRainbowColor = false 
  
addEventHandler("onClientGUIClick", root, 
function() 
if ( source == rainbowColor ) then 
if isRainbowColor then 
if isTimer(RainbowTimer) then 
killTimer(RainbowTimer) 
end 
isRanbowColor = false 
else 
RainbowTimer = setTimer(rainbowColor,1000,0) 
isRanbowColor = true 
end 
elseif ( source == disco ) then 
if isLightRainbowColor then 
if isTimer(LightTimer) then 
killTimer(LightTimer) 
end 
isLightRainbowColor = false 
else 
LightTimer = setTimer(discoheadlights,1000,0) 
isLightRainbowColor = true 
end 
end 
end 
)  

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...