See the code:
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
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
chests = { 	["1"] = { 		xPos = 6, 		yPos = 4, 		items = {10,30}, 		chance = 40, 		delay = 30 	}, 	["2"] = { 		xPos = 18, 		yPos = 12, 		items = {45,69}, 		chance = 20, 		delay = 60	} } addhook("use","t_use") function t_use(id) 	local r = math.random(0,100) 	for k,v in pairs(chests) do 		if player(id,"tilex")==chests[k].xPos and player(id,"tiley")==(chests[k].yPos+1) then 				if r <= chests[k].chance then 					local it = math.random(1,#chests[k].items) 					msg2(id,"You gained a weapon "..chests[k].items[it]) 					parse("equip "..id.." "..chests[k].items[it]) 				else 					msg2(id,"Empty") 				end 		end 	end end