Forum

> > CS2D > Scripts > is it possible to stop button spamming?
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch is it possible to stop button spamming?

4 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt is it possible to stop button spamming?

loldlold123
User Off Offline

Zitieren
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?

alt Re: is it possible to stop button spamming?

Alistaire
User Off Offline

Zitieren
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

alt Re: is it possible to stop button spamming?

Avo
User Off Offline

Zitieren
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.
1× editiert, zuletzt 12.07.12 11:21:04
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht