Thanks for reading
Forum
CS2D Scripts Counting player lua requestCounting player lua request
7 replies 1
Thanks for reading
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
addhook('serveraction', 'serveractionHook') a = 0 function count(id) 	a = a + 1 	if a == 5 then 		a = 0 		parse('killplayer '..id) 	end end function serveractionHook(id, action) 	if action == 1 then 		count(id) 	end end
1
2
2
When a player presses F2: x = x + 1; if x == 5: all players who pressed F2 get killed;
So all 5 get killed and surely he wants the counter to reset.
Note: I think that he want to vote system. So my not tested code available to reach count = 5 by once player.
edited 1×, last 20.05.14 04:13:33 pm
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
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
x = 0 f2 = {} for id = 1, 32 do 	f2[id] = false end addhook ("serveraction", "serveractionhook") function serveractionhook (id, action) 	if (action == 1) then 		f2[id] = true 		 		x = x + 1 		 		if (x == 5) then 			x = 0 			 			for id = 1, 32 do 				if (f2[id]) then 					parse ("killplayer " .. id) 				end 			end 		edne 	end end
Note: I think that we worked on the script together, so we created 2 posts.
I think that he want to vote system. So my not tested code available to reach count = 5 by once player.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
x = 0 f2 = strkl(f2) function strkl(x) -- [start] -> [reset and/or kill] 	for i = 1, 32 do 		if (x[i]) then 			parse ("killplayer " .. i) end 		x[i] = false 	end 	return x end addhook ("serveraction", "serveractionhook") function serveractionhook (id, action) if (action == 1) then f2[id] = true x = x + 1 if (x == 5) then x = 0 			 strkl(f2) end end end
I don't know if it works...
1