English Riot control script:request

9 replies
Goto Page
To the start Previous 1 Next To the start
10.06.12 05:11:54 pm
Up
Bolt
User
Offline Off
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.
10.06.12 05:23:46 pm
Up
EP
User
Offline Off
READ MY OTHER ANSWER (DOWN)
edited 1×, last 10.06.12 05:59:09 pm
10.06.12 05:34:07 pm
Up
Alistaire
User
Offline Off
You could make it into a 'for' loop, skipping many unneeded copies of the same script.

Code:
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
10.06.12 05:57:41 pm
Up
EP
User
Offline Off
Code:
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
10.06.12 06:04:03 pm
Up
Bolt
User
Offline Off
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?
10.06.12 06:05:53 pm
Up
Alistaire
User
Offline Off
You know it's just Sinus and Cosinus. Learn it at school.
10.06.12 06:07:17 pm
Up
Bolt
User
Offline Off
I know what it's sinus and cosinus, but for what interesting can I use it?
10.06.12 06:10:01 pm
Up
Alistaire
User
Offline Off
For angles in triangles with a 90 degrees corner.
10.06.12 06:10:14 pm
Up
EP
User
Offline Off
You can manipulate angles with them.
10.06.12 06:15:33 pm
Up
Bolt
User
Offline Off
Ok, I'll try it, thanks, guys
To the start Previous 1 Next To the start