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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
function initArray(s,v)
local t = {}
for i=1,s do
t[i] = v
end
return t
end
function strtok(s,tok)
local buff = {}
tok = tok or " "
tok = "[^"..tok.."]+"
for w in string.gmatch(s,tok) do
table.insert(buff,w)
end
return buff
end
function getPlayersByTeam(team)
local list = player(0,"table")
local str = initArray(math.floor(#list/8)+1,"")
players = {}
local pages = 1
for i=1, #list do
if player(list[i],"team") == team then
str[math.floor(#players/8)+1] = str[math.floor(#players/8)+1]..","..player(list[i],"name").."|"..list[i]
table.insert(players,list[i])
end
end
return {str,players}
end
addhook("serveraction","svac")
function svac(id,action)
if action == 1 then
menu(id,"Kick - Team Menu,Terrorist,Counter-Terrorist")
end
end
addhook("menu","menu_click")
function menu_click(id,title,button)
if title=="Kick - Team Menu" then
if button == 1 then
local a = getPlayersByTeam(1)
local menustr = "Kick Ts Page 1"..a[1][1]
if #a[2] > 8 then
menustr = menustr..",NextPage"
end
menu(id,menustr)
elseif button == 2 then
local a = getPlayersByTeam(2)
local menustr = "Kick CTs Page 1"..a[1][1]
if #a[2] > 8 then
menustr = menustr..",NextPage"
end
menu(id,menustr)
end
else
local split = strtok(title)
local page = tonumber(split[#split])
local team = 0
if split[2] == "Ts" then team = 1 elseif split[2] == "CTs" then
team = 2
end
if button < 9 then
parse("kick "..getPlayersByTeam(team)[2][8*(page-1)+button])
else
local a = getPlayersByTeam(team)
local t_str = ""
if team==1 then t_str="Ts" elseif team==2 then
t_str="CTs"
end
local menustr = "Kick "..t_str.." Page "..(page+1)..a[1][page+1]
if #a/8 > page then
menustr = menustr..",NextPage"
end
menu(id,menustr)
end
end
end