edited 2×, last 12.02.12 10:14:52 am
Forum
Trash SOLVEDSOLVED
12 replies 1
edited 1×, last 11.02.12 06:14:09 pm
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("movetile","_movetile") last_tile={} function _movetile(id,x,y) 	if objectpos(x,y,"type")==2 then 		parse("setpos "..id.." "..(last_tile[id][1]*32+16).." "..(last_tile[id][2]*32+16)) 	else 		last_tile[id]={x,y} 	end end function objectpos(x,y,value) 	for _,building in ipairs(object(0,"table")) do 		if object(building,"tilex")==x and object(building,"tiley")==y then 			return object(building,value) 		end 	end 	return false end
Your a lifesaver.
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
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
addhook("movetile","_movetile") addhook("hit","_hit") barbedHits=5 parse("mp_building_health \"Barbed Wire\" "..(barbedHits*60)) function _hit(id,source,weapon) 	if weapon==255 then 		return 1 	end end last_tile={} function _movetile(id,x,y) 	if objectpos(x,y,"type")==2 then 		parse("setpos "..id.." "..(last_tile[id][1]*32+16).." "..(last_tile[id][2]*32+16)) 	else 		last_tile[id]={x,y} 	end end function objectpos(x,y,value) 	for _,building in ipairs(object(0,"table")) do 		if object(building,"tilex")==x and object(building,"tiley")==y then 			return object(building,value) 		end 	end 	return false end
Change barbedHits to how many hits you want barbed wires to survive for.
Otherwise, your been a so big lifesaver that I cant even describe it.
Make sure you do not have any conflicting hooks.
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
addhook("movetile","_movetile") addhook("hit","_wirehit") barbedHits=14 parse("mp_building_health \"Barbed Wire\" "..(barbedHits*60)) function _wirehit(id,source,weapon) if weapon==255 then return 1 end end
Make sure you are not running this with another hit hook.
There was 2 hit hooks:
adding "nz_hit" to hit function
few lines later...
adding "_hit" to hit function
So, now it works, and thank you very much!
1