Riot control script:request
9 replies
1

10.06.12 05:11:54 pm
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.
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.
You could make it into a 'for' loop, skipping many unneeded copies of the same script.
Code:
1
2
3
4
5
6
7
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
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
Code:
This one works, not perfectly but it works 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
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
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
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?
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?
1








Riot control script:request
