Thanks for reading
Scripts
Counting player lua request
Counting player lua request
1

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
When a player presses F2: x = x + 1; if x == 5: all players who pressed F2 get killed;
Zeik sayed: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
Dousea: Oh, not bad
. I need to learn how to write simpler scripts in lua. We need to fix this code, because all players who press F2 and reach the result, f2/players table need to be reset.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
1
