LUA Question - attempt to index field
Deleted UserHere is script:
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
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
function array(m)
	local array = {}
	for id = 1, m do
		array[id] = 0
	end
	return array
end
function nonil()
	local nonil
	if nonil == nil then nonil = 0 end
	return nonil
end
tnti = {}
tnt = nonil()
function tntspawn(xxx,yyy)
	local img = image("gfx/mm/tnt.bmp",xxx*32+16,yyy*32+16,0)
	tnti[img].x = {xxx*32}
	tnti[img].y = {yyy*32}
end
addhook('use', 'mm_use')
function mm_use(id,x,y)
	for i = 1, #tnti do
		if tnti[i].x == player(id, 'tilex') and tnti[i].y == player(id, 'tiley') then
			msg('TnT tAken')
		end
	end
end
addhook('say', 'D')
function D(id,t)
	tntspawn(player(id, 'tilex'), player(id, 'tiley'))
end
Error: When I say something appear error:
1
line 20, Attempt to index field '?' (a nil value)
Guys I cant fix it, please help!
LUA Question - attempt to index field
1 

Offline
Marcell