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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
--------------------------------------------------
-- UT+Quake Sounds Script by Unreal Software --
-- 22.02.2009 - www.UnrealSoftware.de --
-- Adds UT and Quake Sounds to your Server --
--------------------------------------------------
--** Ported By Lee Gao: http://tgvserver.info **--
quakeMod_module = {}
--***********--
--*Variables*--
--***********--
quakeMod_sound = "fun"
quakeMod_timeout = 3
quakeMod_timer = {}
quakeMod_level = {}
--************--
--*Initialize*--
--************--
function quakeMod_init(arg)
	--init the arrays so they don't return nil.
	quakeMod_level=initArray(32)
	quakeMod_timer=initArray(32)
end
quakeMod_module.init = function(arg) quakeMod_init(arg) end
--******--
--*Acts*--
--******--
quakeMod_module.acts = {}
--Sample command - sampleAct - parameters {p, typ, cmd}
function quakeMod_qklevel(p, x, cmd)
	local n = p
	if (cmd and tonumber(cmd)) then n = tonumber(cmd) end
	if quakeMod_level[n] then
		msg2(p, player(n,"name").." scored "..quakeMod_level[n].." kills")
	end
end
--Add the sampleAct command to the acts list - Do not forget to use all lower for the name of the field
quakeMod_module.acts.qklevel = function(p, x, cmd) quakeMod_qklevel(p, x, cmd) end
function quakeMod_qktimeout(p, x, cmd)
	local n = p
	if (cmd and tonumber(cmd)) then n = tonumber(cmd) end
	if quakeMod_timer[n] then
		msg2(p, player(n,"name").." have "..math.floor(quakeMod_timeout-(os.clock()-quakeMod_timer[n])).." seconds until his level is reset")
	end
end
--Add the sampleAct command to the acts list - Do not forget to use all lower for the name of the field
quakeMod_module.acts.qktimeout = function(p, x, cmd) quakeMod_qktimeout(p, x, cmd) end
--************--
--*Admin Acts*--
--************--
--Admin Acts
quakeMod_module.admacts = {}
--Admin Privilege
quakeMod_module.privilege = {}
--Sample command - sampleAdmAct - parameters {p, typ, cmd}
function quakeMod_setSound(p, x, cmd)
	if (cmd and type(cmd) == "string") then
		if (io.open(cmd.."/prepare.wav") or cmd == "no") then
			quakeMod_sound = cmd;
			msg2(p, "cvar qk_sound set to \'"..cmd.."\'")
		end
	end
end
--Add the sampleAdmAct command to the acts and privilege list - Do not forget to use all lower for the name of the field
quakeMod_module.admacts.qksetsound = function(p, x, cmd) quakeMod_setSound(p, x, cmd) end
quakeMod_module.privilege.qksetsound= "a"
--Sample command - sampleAdmAct - parameters {p, typ, cmd}
function quakeMod_setTimeout(p, x, cmd)
	if (cmd and tonumber(cmd)) then
		quakeMod_timeout = tonumber(cmd);
		msg2(p, "cvar qk_timeout set to \'"..cmd.."\'")
	end
end
--Add the sampleAdmAct command to the acts and privilege list - Do not forget to use all lower for the name of the field
quakeMod_module.admacts.qksettimeout = function(p, x, cmd) quakeMod_setTimeout(p, x, cmd) end
quakeMod_module.privilege.qksettimeout= "a"
--*******--
--*Hooks*--
--*******--
--startround
function quakeMod_startround()
	--start round stuff
	parse("sv_sound \""..quakeMod_sound.."/prepare.wav\"");
end
quakeMod_module.startround = function() quakeMod_startround() end
function quakeMod_kill(killer,victim,weapon)
	--On kill
if (os.clock()-quakeMod_timer[killer])>quakeMod_timeout then
quakeMod_level[killer]=0;
end
quakeMod_level[killer]=quakeMod_level[killer]+1;
	 local level = quakeMod_level[killer]
quakeMod_timer[killer]=os.clock();
-- HUMILIATION? (KNIFEKILL)
if (weapon==50) then
-- HUMILIATION!
parse("sv_sound \""..quakeMod_sound.."/humiliation.wav\"");
msg (player(killer,"name").." humiliated "..player(victim,"name").."!");
	 end
-- REGULAR KILL
if (level==1) then
-- Single Kill! Nothing Special!
elseif (level==2) then
parse("sv_sound \""..quakeMod_sound.."/doublekill.wav\"");
msg (player(killer,"name").." made a Doublekill!");
elseif (level==3) then
parse("sv_sound \""..quakeMod_sound.."/multikill.wav\"");
msg (player(killer,"name").." made a Multikill!");
elseif (level==4) then
parse("sv_sound \""..quakeMod_sound.."/ultrakill.wav\"");
msg (player(killer,"name").." made an ULTRAKILL!");
elseif (level==5) then
parse("sv_sound \""..quakeMod_sound.."/monsterkill.wav\"");
msg (player(killer,"name").." made a MO-O-O-O-ONSTERKILL-ILL-ILL!");
else
parse("sv_sound \""..quakeMod_sound.."/unstoppable.wav\"");
msg (player(killer,"name").." is UNSTOPPABLE! "..level.." KILLS!");
end
end
quakeMod_module.kill = function(arg1, arg2, arg3) quakeMod_kill(arg1, arg2, arg3) end
--********--
--*Return*--
--********--
return quakeMod_module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
--Simulated Round
--Start the round
--Then have Player 1 magically kill 5 people in the course of 3 seconds.
hook_init()
hook_startround()
hook_kill(1, 2, 40)
sleep(1)
hook_kill(1, 2, 40)
hook_kill(1, 3, 40)
sleep(1)
hook_kill(1, 4, 40)
sleep(1)
hook_kill(1, 2, 50)
hook_say(1, "/qk_level")
hook_say(1, "/qk_level 2")
hook_say(1, "/qk_timeout 1")
sleep(1)
hook_say(1, "/qk_timeout 1")
hook_say(1, "@login admin pass")
hook_say(1, "@qk_setTimeout 10")
hook_say(1, "/qk_timeout 1") -- Note, this should return 9 since we've already used one of those seconds.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Debug message from testMod_init
Srv	Server executed command: sv_sound "fun/prepare.wav"
Slp	Sleeping for 1 seconds
Srv	Server executed command: sv_sound "fun/doublekill.wav"
All	Player 1 made a Doublekill!
Srv	Server executed command: sv_sound "fun/multikill.wav"
All	Player 1 made a Multikill!
Slp	Sleeping for 1 seconds
Srv	Server executed command: sv_sound "fun/ultrakill.wav"
All	Player 1 made an ULTRAKILL!
Slp	Sleeping for 1 seconds
Srv	Server executed command: sv_sound "fun/humiliation.wav"
All	Player 1 humiliated Player 2!
Srv	Server executed command: sv_sound "fun/monsterkill.wav"
All	Player 1 made a MO-O-O-O-ONSTERKILL-ILL-ILL!
1	Player 1 scored 5 kills
1	Player 2 scored 0 kills
1	Player 1 have 3 seconds until his level is reset
Slp	Sleeping for 1 seconds
1	Player 1 have 2 seconds until his level is reset
1	User "admin" logged in successfully, your privilege mask is "a"
1	cvar qk_timeout set to '10 '
1	Player 1 have 9 seconds until his level is reset