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)