Forum
CS2D Scripts Jail teleporter scriptJail teleporter script
19 replies 1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
weaponhit = 4 teleport_hit_damage = false position = { {86, 75}; } addhook("hit", "_hit") function _hit(v, s, w) 	if player(s, "team") == 2 and player(v, "team") == 1 and w == weaponhit then 		local randomnum = math.random (1, #position) 		local x = position[randomnum][1] *32+16 		local y = position[randomnum][2] *32+16 		parse ("setpos "..v.." "..x.." "..y) 		if teleport_hit_damage then return 0 else return 1 end 	end end
How the code works:
Every time you hit a terrorist with p228 when you are a counter-terrorist, the script will find a random place from the table called position and teleport the terrorist to that place. If teleport_hit_damage is true then the hit deals damage, otherwise it will not deal any damage to the teleported terrorist.
Make sure you add
1
;
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
xjail = 1 yjail = 1 addhook("hit","huit") function huit(id,s,x,y) local wpn = player(id,"weapontype") if wpn==6 then parse("setpos "..id.." "..xjail*32-16 .." "..yjail*32-16) return 1 end end
Change 6 number to your weapon id
hope there is no errors
/oh i was too slow.
edited 1×, last 30.05.15 07:14:27 pm
edited 2×, last 29.05.19 01:04:07 pm
That's what Talented Doge is concerned about. You place a player and then move him to the center of tile BEFORE it.
For example, the way Talented Doge, the person would be put to the middle of tile 86|75 whereas you write position as 1|1 but the player is actually placed to 0|0. In most cases it's not a problem but it can lead to confusion (or even getting stuck in a wall) so writing +16 is better than -16
----------------
Edited a bit, now players can disable the teleport function by himself.
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
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
use = {} weaponhit = 4 teleport_hit_damage = false position = { {86, 75}; } addhook("hit", "_hit") addhook("join", "_join") addhook("serveraction", "_sva") function _hit(v, s, w) if player(s, "team") == 2 and player(v, "team") == 1 and w == weaponhit and use[s] then local randomnum = math.random (1, #position) local x = position[randomnum][1] *32+16 local y = position[randomnum][2] *32+16 parse ("setpos "..v.." "..x.." "..y) if teleport_hit_damage then return 0 else return 1 end end end function _sva(p, b) 	if b == 1 and use[p] and player(p, "team") == 2 then 		use[p] = false 		msg2(p, "Teleport gun off!") 	elseif b == 1 and player(p, "team") == 2 then 		use[p] = true 		msg2(p, "Teleport gun on!") 	end end function _join(p) 	use[p] = true end
edited 1×, last 29.05.19 01:03:52 pm
edited 1×, last 29.05.19 01:03:31 pm
edited 1×, last 29.05.19 01:03:27 pm
Tested, works.
edited 1×, last 29.05.19 01:03:22 pm
And will be better if here will be timer, i dont remember but Rainoth or someone else helped me with the same problem.
edited 1×, last 29.05.19 01:02:36 pm
everyone is so supportive and helpful!
thank you!
very much appreciated!
---
oh and i furgot!
if you still can:
i actually needed it to be a glock that has the 2 functions-
func 1: teleport to x;y
func 2: stun/freeze (speedmod- 0)
--
if u still can!
1