Something like this should work, not the best code so feel free to edit however you want.
hook.Add("PlayerInitialSpawn", "SitOut_Joined", function( ply )
ply.SOCount = 0 -- Yes, they can avoid it by rejoining.
end)
local function SitOut(ply, cmd, args)
if !args[1] then return "" end
if ply:IsAdmin() then
local target
for k,v in pairs(player.GetAll()) do
if string.find(string.lower(v:Nick()), string.lower(args[1])) then
target = v
break
end
end
if target and target:IsValid() then
target.SOCount = target.SOCount+1
for k,v in pairs(player.GetAll()) do
if target.SOCount == 1 then
v:ChatPrint( target:Nick().." is sitting out one round!")
else
v:ChatPrint( target:Nick().." is sitting out the next "..target.SOCount.." rounds!")
end
end
else
ply:ChatPrint( args[1].." not found!")
end
else
ply:ChatPrint( "This is not the console command you are looking for.")
end
end
concommand.Add("ttt_sitout", SitOut)
local function SitOut2(ply, cmd, args)
if !args[1] then return "" end
if ply:IsAdmin() then
local target
for k,v in pairs(player.GetAll()) do
if string.find(string.lower(v:Nick()), string.lower(args[1])) then
target = v
break
end
end
if target and target:IsValid() then
if target.SOCount > 0 then
target.SOCount = target.SOCount-1
for k,v in pairs(player.GetAll()) do
if target.SOCount == 1 then
v:ChatPrint( target:Nick().." is sitting out one round!")
elseif target.SOCount > 1 then
v:ChatPrint( target:Nick().." is sitting out the next "..target.SOCount.." rounds!")
elseif target.SOCount == 0 then
v:ChatPrint( target:Nick().." is no longer sitting out any rounds!")
end
end
else
ply:ChatPrint( target:Nick().." doesn't have to sit out any rounds!")
end
else
ply:ChatPrint( args[1].." not found!")
end
else
ply:ChatPrint( "This is not the console command you are looking for.")
end
end
concommand.Add("ttt_nositout", SitOut2)
hook.Add("TTTBeginRound", "SitOut_Begin", function()
for k,v in pairs(player.GetAll()) do
if v.SOCount > 0 then
if not v:IsSpec() then
v:Kill()
end
v:SetTeam(TEAM_SPEC)
v:SetRole(ROLE_INNOCENT)
v:Spawn()
v.SOCount = v.SOCount-1
if v.SOCount == 1 then
v:ChatPrint( "You must sit out this round and the following round!" )
elseif v.SOCount > 1 then
v:ChatPrint( "You must sit out this round and the next "..v.SOCount.." rounds!" )
elseif v.SOCount < 1 then
v:ChatPrint( "You must sit out this round!" )
end
end
end
end)