1
2
3
2
3
grass.x = {} grass.y = {} grass.img = {}
1
2
3
4
5
6
7
2
3
4
5
6
7
addhook("second","_spawn") function _spawn() for i = 1,5 do grass.x[i] = math.random(1,30) grass.y[i] = math.random(1,30) grass.img[i] = image('gfx/city_kalis/grass.bmp',3,2,1) end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
addhook("attack","cut_grass") function cut_grass(id) local x = player(id,"x") local y = player(id,"y") if w == 50 then for i = 1,5 do if grass.x[i] > 0 and grass.y[i] > 0 then local dist = math.sqrt((grass.x[i]-x)^2+(grass.y[i]-y)^2) if dist < 30 then if grass.img[i] ~= nil then grass.x[i] = 0 grass.y[i] = 0 freeimage(grass.img[i]) parse("sv_msg2 "..id.." nice work") end end end end end end
Problem is :
grass.x[i],grass.y[i],grass.img[i] !
when i attack on grass [1] but my script free grass.img[1-5]