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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
pna = {
	adminList = {16770};
	
	funcs = {
		splitString = function(str, match)
			local wordTable = {}
			for word in string.gmatch(str, match) do
				table.insert(wordTable, word)
			end
			return wordTable
		end;
		
		isAdmin = function(id)
			for k, v in pairs(pna.adminList) do
				if player(id, 'usgn') == v then
					return true
				end
			end
			return false
		end;
	};
	
	hooks = {
		say = function(id, text)
			local cmd = pna.funcs.splitString(text, '[^%s]+')
			if pna.funcs.isAdmin(id) then
				if cmd[1] == '!slap' then
					local pid = tonumber(cmd[2])
					parse('sethealth '.. pid ..' '.. player(pid, 'health') - 10)
					parse('sv_sound2 '.. pid ..' player/hit'.. math.random(1, 3) ..'.wav')
					return 1
				elseif cmd[1] == '!kick' then
					local pid = tonumber(cmd[2])
					parse('kick '.. pid)
					return 1
				elseif cmd[1] == '!ban' then
					local pid = tonumber(cmd[2])
					parse('banip '.. player(pid, 'ip'))
					return 1
				elseif cmd[1] == '!freeze' then
					local pid = tonumber(cmd[2])
					parse('speedmod '.. pid ..' -100')
					return 1
				elseif cmd[1] == '!spec' then
					local pid = tonumber(cmd[2])
					parse('makespec '.. pid)
					return 1
				elseif cmd[1] == '!deaths' then
					local pid = tonumber(cmd[2])
					local deaths = tonumber(cmd[3])
					parse('setdeaths '.. pid ..' '.. player(pid, 'deaths') + deaths)
					return 1
				elseif cmd[1] == '!equip' then
					local pid = tonumber(cmd[2])
					local item = tonumber(cmd[3])
					parse('equip '.. pid ..' '.. item)
					return 1
				elseif cmd[1] == '!score' then
					local pid = tonumber(cmd[2])
					local score = tonumber(cmd[3])
					parse('setscore '.. pid ..' '.. player(pid, 'score') + score)
					return 1
				elseif cmd[1] == '!heal' then
					local pid = tonumber(cmd[2])
					parse('sethealth '.. pid ..' '.. player(pid, 'health') + 10)
					return 1
				elseif cmd[1] == '!unfreeze' then
					local pid = tonumber(cmd[2])
					parse('speedmod '.. pid ..' 0')
					return 1
				elseif cmd[1] == '!speedmod' then
					local pid = tonumber(cmd[2])
					local speed = tonumber(cmd[3])
					parse('speedmod '.. pid ..' '.. speed)
					return 1
				elseif cmd[1] == '!maxhp' then
					local pid = tonumber(cmd[2])
					local health = tonumber(cmd[3])
					parse('setmaxhealth '.. pid ..' '.. health)
					return 1
				elseif cmd[1] == '!bring' then
					local pid = tonumber(cmd[2])
					parse('setpos '.. pid ..' '.. player(id, 'x') ..' '.. player(id, 'y'))
					return 1
				elseif cmd[1] == '!goto' then
					local pid = tonumber(cmd[2])
					parse('setpos '.. id ..' '.. player(pid, 'x') ..' '.. player(pid, 'y'))
					return 1
				end
			end
		end;
	};
}
addhook('say', 'pna.hooks.say')