1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
addhook("join","nowjoin") function nowjoin(id) 	PLAYERS[id].tmp = {img ={}} end addhook("leave","nowleave") function nowleave(id,reason) 	if PLAYERS[id] and PLAYERS[id].tmp then 		freeimage(PLAYERS[id].tmp.img) 		PLAYERS[id].tmp = nil 	end end addhook("spawn","nowspawn") function nowspawn(id) 	if PLAYERS[id].tmp.img.image then --ERROR here Attempt to index field 'img'(A number value) 		freeimage(PLAYERS[id].tmp.img) 	end 	PLAYERS[id].tmp.img = image("gfx/pvp" .. PLAYERS[id].PVP.. ".png",0,0,200+id) end
I can't give the whole script because it's quite long and complicated, but I get the error whenever I spawn after I die except the first time I spawn on the server.
The
1
freeimage(PLAYERS[id].tmp.img)