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
function initArray2(f,v)
local cmd={}
for c=1,f do
cmd[c]=v
end
return cmd
end
isLockedInSpec=initArray2(32,false)
admin=1
addhook("say","SpecLock")
function SpecLock(id,t)
if (player(id,"usgn")==admin and t:sub(1,5)=="!lock") then
local lockedID=tonumber(t:sub(6))
if (lockedID>0 and lockedID<=32 and player(lockedID,"exists")) then
isLockedInSpec[lockedID]=true
msg(player(id,"name").." has locked "..player(lockedID,"name").." in spectators!")
end
end
if (player(id,"usgn")==admin and t:sub(1,7)=="!unlock") then
local unlockID=tonumber(t:sub(8))
if (unlockID>0 and unlockID<=32 and player(unlockID,"exists") and isLockedInSpec[unlockID]) then
isLockedInSpec[unlockID]=false
msg(player(id,"name").." has unlocked "..player(lockedID,"name").." from spectators!")
end
end
end
addhook("team","noRejoinWhenLocked")
function noRejoinWhenLocked(id,t)
if (isLockedInSpec[id]) then
if (t~=0) then
return 1
msg2(id,"You are locked in spectators - you can't join any other team!")
end
end
end