Jump to content

Dear scripters, please help me with anti command flood


GuyFromPast

Recommended Posts

tell me why - im very curious..

its very easy top make one.. just save variable (new one for every player) that saves the time of last use of command, and on use check the current time and compare - if its > 6 sec or not..

u can avoid hackers if server say who used that command and who din't(its for cash)

but can u explain more about "variable" ? im newbie as u know and don't understand smart talk YET

Link to comment

maybe make 2 new functions? lock, unlock?

local lock = 0

function lock() 
lock = 1 
end 
function unlock() 
lock = 0 
end  

when execute your function add,

setTimer ( lock, 50, 1 )

setTimer ( unlock, 6000, 1 )

and also check if time its 1

if lock == 1 then outputChatBox("ERROR: You can fix once every 6 seconds.",255,0,0)

and that should work?

Link to comment

why creating function only to set one variable o_O. also that 50ms lock is .. weird

  
lock = 1 
setTimer(function() lock = 0 end, 6000, 1) 
  

but this is server side script so lock will lock for all players, if you want it to work for each player independed you have to define lock table at beginning of script:

  
lock = { } 
  

and use later something like

lock[source]=1

etc etc

but if you dont know the basics - dont try to understand me - because you wont...

Link to comment
why creating function only to set one variable o_O. also that 50ms lock is .. weird
  
lock = 1 
setTimer(function() lock = 0 end, 6000, 1) 
  

but this is server side script so lock will lock for all players, if you want it to work for each player independed you have to define lock table at beginning of script:

  
lock = { } 
  

and use later something like

lock[source]=1

etc etc

but if you dont know the basics - dont try to understand me - because you wont...

he can make it client side like i did one time :D

Link to comment

variable.. how can you script when you dont know what variable is (i think im saying this for 3rd time since 2 days, wtf?)?

this is very basic, and you shouldnt try writing a function/whatever without this knowledge..

it's like you want to drive car, you already sitting in car, even start engine, but you dont know even that vehicle have pedals :/

omg.. okay, i won't read/reply anymore in yours and Fabios topics - this doesnt have any sense.. you can ask million of questions, but nobody can help you if you sit down for a while and start to think ;/

Link to comment

If you want to disable command, you have to modify its handler. There will be no script to stop commands because there is no function to "cancel" command.. but before you start editing the command you should gain some general knowledge about Lua itself.

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