vesa-omar hat geschrieben
Ok, Im trying to do when you throw an Smoke it freeze's the one's it hit.
But i cant get it to work
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
--Weapons--
addhook("projectile","hnsteam_smokecus")
function hnsteam_smokecus(id,weapon,x,y)
if (weapon==53) then
		parse('effect "colorsmoke" ' ..x.. ' ' ..y.. ' 140 96 0 0 128')
		parse('effect "colorsmoke" ' ..x.. ' ' ..y.. ' 140 96 0 0 128')
		return 1
	end
end
addhook("hit","hnsteam_smokefreeze")
function hnsteam_freeze(target,weapon)
if (weapon==53) then
		parse("speedmod "..target.." -100")
		return 1
	end
end
Help Please
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
RANGE = 300
addhook("projectile","hnsteam_smokecus")
function hnsteam_smokecus(id,weapon,x,y)
	if (weapon==53) then
		parse('effect "colorsmoke" ' ..x.. ' ' ..y.. ' 140 96 0 0 128')
		parse('effect "colorsmoke" ' ..x.. ' ' ..y.. ' 140 96 0 0 128')
		
		for _i,v in ipairs(player(0,"table")) do
			if(_i ~= id) then
				local _x,_y = player(_i,"x"),player(_i,"y")
				local dx,dy = _x - x,_y-y
				local dist = math.sqrt(dx*dx + dy*dy)
				if dist<RANGE then
					parse("speedmod ".._i.." -100")
				end
			end
		 end
		return 1
	end
end
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
function flashed(p,fx,fy,flashradius)	
	local px,py = player(p,"x"),player(p,"y")
	local dx,dy = fx - px,fy-py		
	local dist = math.sqrt(dx*dx + dy*dy)
	
	if(dist > flashradius) then
		return false
	end
	local angle = (math.atan2(dy,dx) - math.pi / 2)%(math.pi)	
	if(fx >px) then
		angle = angle - math.pi
	end
	
	for i = 0,math.floor(dist),10 do
		local xt =fx +math.sin(angle)*i
		local yt = fy - math.cos(angle)*i					
		if(tile(xt/32,yt/32,"wall")) then
			return false
		end
	end
	return true
end
addhook("projectile","my_projectile")
function my_projectile(id,weapon,x,y)	
	if(weapon ==52) then
		for _i,_v in ipairs(player(0,"table")) do
			if(flashed(_i,x,y,500))then
				msg(player(id,"name").." flashed: "..player(_i,"name"))
			end
		end
	end
end