Jump to content

Button Anti Spam Error


Chris!i!

Recommended Posts

 timer = {} 
function cancelShots() 
  
guiSetProperty( GUIEditor.button[1], "Disabled", "False" ) 
else 
guiSetProperty( GUIEditor.button[1], "Disabled", "True" ) 
end 
  
addEventHandler("onClientGUIClick", GUIEditor.button[1], localPlayer, 
function() 
        setElementData(localPlayer, "anti.repeater", true); 
        if ( getElementData(localPlayer, "anti.repeater") == true ) then 
            
            timer[source] = setTimer( function() 
        guiSetProperty( GUIEditor.button[1], "Disabled", "False" ) 
            setElementData(localPlayer, "anti.repeater", false) 
            removeEventHandler("onClientGUIClick", GUIEditor.button[1], cancelShots) 
  
            end, 10000, 1 ) 
            addEventHandler("onClientGUIClick", GUIEditor.button[1], cancelShots) 
  
        end 
    end 

Client Sided.

I'm setting an no spam function for a button, it says end expected to close function at line 1, the function cancelShots.

It needs end replacing "else" but i wont remove else.

Thanks for your help.

Link to comment
function cancelShots() 
 if source == GUIEditor.button[1] then 
guiSetProperty( GUIEditor.button[1], "Disabled", "False" ) 
else 
guiSetProperty( GUIEditor.button[1], "Disabled", "True" ) 
end 
end 

Okay so, i've added an If statement, still didn't work.

That part should work now. It shouldn't give you the error now.

Link to comment

It still give me same error.

I've changed the script its not this

addEventHandler("onClientGUIClick", GUIEditor.button[1], 
function() 
        setElementData(localPlayer, "anti.repeater", true) 
        if ( getElementData(localPlayer, "anti.repeater") == true ) then 
            
            timer[source] = setTimer( function() 
        guiSetProperty( GUIEditor.button[1], "Disabled", "False" ) 
            setElementData(localPlayer, "anti.repeater", false) 
            removeEventHandler("onClientGUIClick", GUIEditor.button[1], cancelShots) 
  
            end, 10000, 1 ) 
            addEventHandler("onClientGUIClick", GUIEditor.button[1], cancelShots) 
  
        end 
    end 
    end) --HERE IT GIVES ME ERROR ) EXPECTED TO CLOSE THE FUNCTION 
     
  
  
  
  
  
 function cancelShots() 
 if source == GUIEditor.button[1] then 
guiSetProperty( GUIEditor.button[1], "Disabled", "False" ) 
else 
guiSetProperty( GUIEditor.button[1], "Disabled", "True" ) 
end 
end 

Link to comment
addEventHandler("onClientGUIClick", GUIEditor.button[1], 
function() 
        setElementData(localPlayer, "anti.repeater", true) 
        if ( getElementData(localPlayer, "anti.repeater") == true ) then 
            
            timer[source] = setTimer( function() 
        guiSetProperty( GUIEditor.button[1], "Disabled", "False" ) 
            setElementData(localPlayer, "anti.repeater", false) 
            removeEventHandler("onClientGUIClick", GUIEditor.button[1], cancelShots) 
  
            end, 10000, 1 ) 
            addEventHandler("onClientGUIClick", GUIEditor.button[1], cancelShots) 
  
        end 
    end) 
  
  
  
  
  
 function cancelShots() 
 if source == GUIEditor.button[1] then 
guiSetProperty( GUIEditor.button[1], "Disabled", "False" ) 
else 
guiSetProperty( GUIEditor.button[1], "Disabled", "True" ) 
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...