1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
function echo(id,...) 	s = "" 	for i,v in ipairs(arg) do 		s = s..tostring(v).." " 	end 	 	msg2(id,s) end addhook("usebutton","h_usebutton") function h_usebutton(id,x,y) 	--echo(id,x*32,y*32) 	dir = entity(x,y,"int1") 	tg = entity(x,y,"trigger")	 	 	local px,py = x*32,y*32 	local minx,maxx,miny,maxy = px,px+32,py,py+32 	 	local playerx,playery = player(id,"x"),player(id,"y") 	 	if playerx < maxx and playerx > minx and playery < maxy and playery > miny then 		--echo(id,"valid trigger") 	else 		echo(id,"invalid trigger, hack detected!") 		parse("trigger "..tg) -- trigger again to undo 	end end
This is for server hosters who were bothered by people that use the button hack.
Problem was that a button could be activated from large distance ( 10x10 tiles or sth) when using packet editing software. This script prevents that buttons can be used from large distance. It was very annoying in rpg and prison maps.