Forum

> > CS2D > Scripts > My menu (for kill player) don't work
Forums overviewCS2D overview Scripts overviewLog in to reply

English My menu (for kill player) don't work

4 replies
To the start Previous 1 Next To the start

old My menu (for kill player) don't work

Crash13
User Off Offline

Quote
I am again with problems. I have edited a script. All is fine, but when i press to kill a player then kill all players... And for kick, slap, etc is too. Why?

I want when i press On Button "Kill" , etc --> get me another menu with all players online... like HC script

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Admins = {33373}    ------------ i puted here my usgn!

addhook("serveraction","adminaction")
function adminaction(id,b)
	if b == 1 then
		for _, usgn in ipairs(Admins) do
			if player(id,'usgn') == usgn then
				menu(id,"Admin Menu,Kill,Kick,Slap,Change Team,Restart Round")
				return 1
			end
		end
	end
end

addhook("menu","adminmenu")
function adminmenu(id,t,b)
	if t=="Admin Menu" then
		if b==1 then
			for _, pl in ipairs(player(0, "tableliving")) do
				parse("killplayer " ..pl) --- i think here is my problem
			end
		end
	end
end
edited 1×, last 03.01.12 07:26:13 pm

old Solved

EP
User Off Offline

Quote
Spoiler >
Works

old Re: My menu (for kill player) don't work

Crash13
User Off Offline

Quote
user EP has written
Spoiler >
Works


Thanks

old Re: My menu (for kill player) don't work

Jynxxx
User Off Offline

Quote
Here is a much shorter one that Flacko made, found it in the old lua scrpting forum.
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
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview