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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
kt = {x1 = {}, y1 = {}, x2 = {}, y2 = {}}
function zone(x1, y1, x2, y2)
table.insert(kt.x1, x1)
table.insert(kt.x2, x2)
table.insert(kt.y1, y1)
table.insert(kt.y2, y2)
end
--Settings
zone(25,3,40,19) -- Zone coö.
attack_limit = 3
atk_msg = "No shopattacking! - %s"
for i = 1, 32 do
kt[i] = attack_limit
end
function f2(id)
for ix1, x1 in ipairs(kt.x1) do
for iy1, y1 in ipairs(kt.y1) do
for ix2, x2 in ipairs(kt.x2) do
for iy2, y2 in ipairs(kt.y2) do
if ix1 == iy1 and iy1 == ix2 and ix2 == iy2 then
if player(id, "tilex") < x2 and player(id, "tilex") > x1 and player(id, "tiley") > y1 and player(id, "tiley") < y2 then
return true
end
end
end
end
end
end
return false
end
addhook("attack","attack_hook")
function attack_hook(id)
if f2(id) then
msg2(id,string.format(atk_msg, kt[id]..'/'..attack_limit))
if kt[id] <= 0 then
parse("kick "..id.."; No shopattacking!")
end
kt[id] = kt[id] - 1
end
end
addhook([[leave]], [[leave_hook]])
function leave_hook(id, r)
kt[id] = attack_limit
end