Forum

> > CS2D > Scripts > is it possible to stop button spamming?
Forums overviewCS2D overview Scripts overviewLog in to reply

English is it possible to stop button spamming?

4 replies
To the start Previous 1 Next To the start

old is it possible to stop button spamming?

loldlold123
User Off Offline

Quote
hello guys,im asking about is it possible to stop "menu button" spamming,like if there is msg which shows up when you press to menu button,some people spams it,so how to stop ? just there are so many menus and is there general solve for all of them?

old Re: is it possible to stop button spamming?

Alistaire
User Off Offline

Quote
Add a timer?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
spamprot = {}
for i = 1, 32 do spamprot[i] = 0 end

addhook('usebutton', 'AA_usebutton')

function AA_usebutton(id, x, y)
	function respamprot(i)
		spamprot[i] = 0
	end
	if spamprot[id] ~= 1 then
-- ALL BUTTON CODE AND SHIT YOU WANNA ADD
		spamprot[id] = 1
		timer(2000, 'respamprot', id)
	end
end

old Re: is it possible to stop button spamming?

Avo
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
spamprot = {}
for i = 1, 32 do spamprot[i] = 0 end
time=2

addhook("menu","_menu")
function _menu(id,title,button)
	if spamprot[id]==0 then
		spamprot[id]=1
		timer(time*1000, 'reset_spamprot', id)

		--// YOUR MENUS HERE
		if title=="Menu of HH" then
			if button==1 then
				--//some code here
			elseif button==2 then
				--some code here
			end
		end
	end
end
function reset_spamprot(id)
	spamprot[id]=0
end

Not shortest, but should work.
edited 1×, last 12.07.12 11:21:04 am
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview