Forum

> > CS2D > Scripts > Bullet push script
Forums overviewCS2D overview Scripts overviewLog in to reply

English Bullet push script

2 replies
To the start Previous 1 Next To the start

old Re: Bullet push script

Cure Pikachu
User Off Offline

Quote
Yeah, like here:
user Dousea, thread cs2d 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
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.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview