Jump to content

Time to wait


S3Nn4oXx

Recommended Posts

Store the tick count in a table and check to see if the time is long enough:

local anti_spam_tick = {} 
  
addCommandHandler('/cmdname', function(player) 
 if (not anti_spam_tick[player] or (anti_spam_tick[player] and getTickCount() - anti_spam_tick[player] > 5000) --[[ 5 seconds ]]) then 
  anti_spam_tick[player] = getTickCount() 
  -- do something 
 else 
  outputChatBox('You must wait 5 seconds', player) 
 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...