Can someone create this?
Forum
CS2D Scripts Bullet push scriptBullet push script
2 replies 1
Can someone create this?
Dousea, Knockback Script? has written
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
36
37
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
36
37
addhook("hit","hithook") function hithook(id,source,weapon) 	if (itemtype(weapon,"slot") == 1 or itemtype(weapon,"slot") == 2 or weapon == 74) then 		if player(id,"team") == 1 then 			knockback(source,id,weapon) 		end 	end end function knockcheck(x,y,rotation,knock) 	local breaks, op1, op2 	for distance = 5, math.ceil(knock), 2 do 		op1 = x + math.cos(rotation) * distance 		op2 = y + math.sin(rotation) * distance 		if (not tile(math.ceil(op1 / 32) - 1,math.ceil(op2 / 32) - 1,"walkable")) then 			breaks = true 			break 		end 	end 	return breaks end function knockback(source,id,weapon) 	if (itemtype(weapon,"slot") == 1 or itemtype(weapon,"slot") == 2 or weapon == 74) then 		local knock = itemtype(weapon,"dmg") / 2 		local rotation = player(source,"rot") 		if (rotation < -90) then 			rotation = rotation + 360 		end 		local angle = math.rad(math.abs(rotation + 90)) - math.pi 		x = player(id,"x") + math.cos(angle) * knock 		y = player(id,"y") + math.sin(angle) * knock 		if (not knockcheck(player(id,"x"),player(id,"y"),angle,knock)) then 			parse("setpos "..id.." "..x.." "..y) 		end 	end end
I modified it a bit because you said you wanted it to affect terrorists only.
1