Forum

> > CS2D > Scripts > Riot control script:request
Forums overviewCS2D overview Scripts overviewLog in to reply

English Riot control script:request

9 replies
To the start Previous 1 Next To the start

old Riot control script:request

Avo
User Off Offline

Quote
I've got a problem and I hope somebody has got idea how it should be.

If player1 tries to move on tile on which is player2 with Tactical shield, player1 won't move on this tile.

With this CT's would be able to make Tactical shields wall, that doesn't pass TT's.

Just like in cs 1.6.

old Re: Riot control script:request

Alistaire
User Off Offline

Quote
You could make it into a 'for' loop, skipping many unneeded copies of the same script.

1
2
3
4
5
6
7
for j = -1, 1 do
	for k = -1, 1 do
		if player(i, 'tilex') == x + j and player(i, 'tiley') == x + k and player(i, 'weapontype') == 41 then
			walk = true
		end
	end
end

old Re: Riot control script:request

EP
User Off Offline

Quote
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
function math.pointfollow(x,y,rot,speed)
	return x-math.sin(rot-3.14)*speed,y-math.cos(rot-3.14)*speed
end
function math.dist(x1,y1,x2,y2) 
	local xx = x2-x1
	local yy = y2-y1
	return math.sqrt(xx^2+yy^2)
end
addhook("move","a")
function a(id,x,y)
	local pls = player(0,"tableliving")
	for _,i in ipairs(pls) do
		if i ~= id then
			if player(i,"exists") then
				if math.dist(player(id,"x"),player(id,"y"),player(i,"x"),player(i,"y")) <= 32 then
					if player(i,"weapontype") == 41 then
						local rot = math.atan2(player(id,"x") - player(i,"x"),player(id,"y") - player(i,"y"))
						local xx,yy = math.pointfollow(player(id,"x"),player(id,"y"),rot-math.rad(180),-5)
						parse("setpos "..id.." "..xx.." "..yy)
					end
				end
			end
		end
	end
end
This one works, not perfectly but it works

old Re: Riot control script:request

Avo
User Off Offline

Quote
weeeeee, it works, you're genius

I just have got one question, but I don't want to create new thread; could somebody explain how math.sin and math.cos works and what can I do with it?
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview