Welcome, Guest. Please login or register.
Did you miss your activation email?
December 04, 2024, 08:33:46 AM
Home Help Login Register
News: Trouble in Terrorist Town? Site here, forum here.

Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Command help
Pages: [1]
Author Topic: Command help  (Read 6252 times)
Bovarist
Poster

Posts: 2


« on: February 09, 2012, 11:01:01 PM »

How would one go about making a command that would force someone to move to the spectator team for a set amount of rounds? Something like ttt_force_spectate [name] 2 or !sitout [name] [#]
sniperduck
Poster

Posts: 178


|:NxS:| Staff! :D


« Reply #1 on: February 10, 2012, 12:06:59 AM »

I think you would have to code your own... its not a built in command.

Overtime these forums have made me an asshole. ;D (TTT subforum)
|:NxS:| Custom TTT Server: source.nxs-gaming.com:27016
|:NxS:| Vanilla TTT Server: source.nxs-gaming.com:27016
|:NxS:| Fretta: <COMING SOON>
Bovarist
Poster

Posts: 2


« Reply #2 on: February 10, 2012, 12:12:11 AM »

That's what I'm asking.
Mr. Gash
Poster

Posts: 382


www.nonerdsjustgeeks.com


« Reply #3 on: February 10, 2012, 02:48:17 AM »

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)
Pages: [1]
Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Command help « previous next »
Jump to:  


Login with username, password and session length

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines
Page created in 0.01 seconds with 17 queries.