1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
addhook("attack","napad")
function napad(id)
	if player(id,"weapontype")<41 then
		for i=0,768,4 do
			local u=math.rad(player(id,"rot")-90); local x,y=player(id,"x")+math.cos(u)*i,player(id,"y")+math.sin(u)*i
			if tile(math.floor(x/32),math.floor(y/32),"walkable")==true then
				for _,od in pairs(object(0,"table")) do
					if object(od,"type")==21 then
						if object(od,"tilex")==math.floor(x/32) and object(od,"tiley")==math.floor(y/32) then
							u=math.rad(object(od,"rot")*90-90); local ox,oy=math.floor(x/32)*32+16+math.cos(u)*12,math.floor(y/32)*32+16+math.sin(u)*12
							if math.sqrt((ox-x)^2+(oy-y)^2)<8 then
								if player(id,"weapontype")~=10 or player(id,"weapontype")==10 and math.sqrt((x-player(id,"x"))^2+(y-player(id,"y"))^2)<=160 then
									parse("killobject "..od); i=768; break
								end
							end
						end
					end
				end if i==768 then break end else break
			end
		end
	end
end
I used "<41" because i'm also working on ammo for weapons. And some weapons will be changed: