Garry's Mod

Garry's Mod

Prophunters
ju 3 Nov, 2018 @ 8:25am
Set a team limit
I'm always playing with 2 friends, so there are 2 props and 1 hunter. But next round there are 2 hunters and 1 prop. It's quite annoying. Is there something i can do to set a limit to 1 for the Hunter's team ?
Last edited by ju; 3 Nov, 2018 @ 8:26am
< >
Showing 1-15 of 21 comments
Valou 💜 10 Nov, 2018 @ 1:48pm 
Same problem
pamlol 11 Nov, 2018 @ 10:30am 
same
LeXouille 15 Nov, 2018 @ 1:46am 
There is no quite an option rigth now.
You can try alter the
concommand.Add("car_jointeam", function (ply, com, args)
(line 5980)
and/or
function GM:CheckTeamBalance()
(line 6019)
witch are the functions that controle the join and balance of a team

However, know that i think it might broke the part of "new round" of the mod as the change in team will be something like X hunters and 1 props....
Try it and tell us
Cedene 18 Nov, 2018 @ 7:55am 
Hi, you can try this in sv_teams.lua




function GM:TeamsSetupPlayer(ply)
local cops = team.NumPlayers(2)
local robbers = team.NumPlayers(3)
if cops >= 1 then
ply:SetTeam(3)
else
ply:SetTeam(2)
end
end

concommand.Add("car_jointeam", function (ply, com, args)
local curteam = ply:Team()
local newteam = tonumber(args[1] or "") or 0
if newteam == 1 && curteam != 1 then

ply:SetTeam(newteam)
if ply:Alive() then
ply:Kill()
end
local ct = ChatText()
ct:Add(ply:Nick())
ct:Add(" changed team to ")
ct:Add(team.GetName(newteam), team.GetColor(newteam))
ct:SendAll()

elseif newteam >= 2 && newteam <= 3 && newteam != curteam then

local ct = ChatText()
ct:Add("Team full, you cannot join")
ct:Send(ply)

end

end)

function GM:CheckTeamBalance()
if !self.TeamBalanceCheck || self.TeamBalanceCheck < CurTime() then
self.TeamBalanceCheck = CurTime() + 3 * 60 // check every 3 minutes

local hunter = team.NumPlayers(2)
if hunter > 1 then // Il doit y avoir un seul hunter
self.TeamBalanceTimer = CurTime() + 30 // balance in 30 seconds
for k,ply in pairs(player.GetAll()) do
ply:ChatPrint("Auto team balance in 30 seconds")
end
end
end
if self.TeamBalanceTimer && self.TeamBalanceTimer < CurTime() then
self.TeamBalanceTimer = nil
self:BalanceTeams()
end
end

function GM:BalanceTeams(nokill)
local hunter = team.NumPlayers(2)
while hunter > 1 do
local players = team.GetPlayers(2)
local ply = players[math.random(#players)]
ply:SetTeam(3)
if !nokill && ply:Alive() then
ply:Kill()
end
local ct = ChatText()
ct:Add(ply:Nick())
ct:Add(" est devenue un ")
ct:Add(team.GetName(smallerTeam), team.GetColor(smallerTeam))
ct:SendAll()
hunter = hunter - 1
end
end

function GM:SwapTeams()
for k, ply in pairs(player.GetAll()) do
ply:SetTeam(3)
end
local players = team.GetPlayers(3)
local ply = players[math.random(#players)]
ply:SetTeam(2)
if !nokill && ply:Alive() then
ply:Kill()
end
local ct = ChatText()
ct:Add("Teams have been swapped", Color(50, 220, 150))
ct:SendAll()
end
Cousito 20 Nov, 2018 @ 1:19pm 
up
Waxyz 21 Nov, 2018 @ 4:50am 
Does it work?
Cedene 21 Nov, 2018 @ 9:23am 
yes it works I use it, besides it's me who did it.

it allows to have only 1 random hunter.

So if you are 5, it will be 1 hunter and 4 props
Waxyz 21 Nov, 2018 @ 9:43am 
i can't find sv_teams.lua

where is it please?
Cedene 21 Nov, 2018 @ 9:48am 
In your server : prophunters\gamemode\sv_teams.lua
Waxyz 21 Nov, 2018 @ 9:52am 
don't have it... can you add me pls?
Mimi 22 Nov, 2018 @ 2:19pm 
hi captain spirit, is there any way to use your code if i haven't rent a server ?
Hakatron 26 Nov, 2018 @ 4:04pm 
Originally posted by Captain Spirit:
Hi, you can try this in sv_teams.lua




function GM:TeamsSetupPlayer(ply)
local cops = team.NumPlayers(2)
local robbers = team.NumPlayers(3)
if cops >= 1 then
ply:SetTeam(3)
else
ply:SetTeam(2)
end
end

concommand.Add("car_jointeam", function (ply, com, args)
local curteam = ply:Team()
local newteam = tonumber(args[1] or "") or 0
if newteam == 1 && curteam != 1 then

ply:SetTeam(newteam)
if ply:Alive() then
ply:Kill()
end
local ct = ChatText()
ct:Add(ply:Nick())
ct:Add(" changed team to ")
ct:Add(team.GetName(newteam), team.GetColor(newteam))
ct:SendAll()

elseif newteam >= 2 && newteam <= 3 && newteam != curteam then

local ct = ChatText()
ct:Add("Team full, you cannot join")
ct:Send(ply)

end

end)

function GM:CheckTeamBalance()
if !self.TeamBalanceCheck || self.TeamBalanceCheck < CurTime() then
self.TeamBalanceCheck = CurTime() + 3 * 60 // check every 3 minutes

local hunter = team.NumPlayers(2)
if hunter > 1 then // Il doit y avoir un seul hunter
self.TeamBalanceTimer = CurTime() + 30 // balance in 30 seconds
for k,ply in pairs(player.GetAll()) do
ply:ChatPrint("Auto team balance in 30 seconds")
end
end
end
if self.TeamBalanceTimer && self.TeamBalanceTimer < CurTime() then
self.TeamBalanceTimer = nil
self:BalanceTeams()
end
end

function GM:BalanceTeams(nokill)
local hunter = team.NumPlayers(2)
while hunter > 1 do
local players = team.GetPlayers(2)
local ply = players[math.random(#players)]
ply:SetTeam(3)
if !nokill && ply:Alive() then
ply:Kill()
end
local ct = ChatText()
ct:Add(ply:Nick())
ct:Add(" est devenue un ")
ct:Add(team.GetName(smallerTeam), team.GetColor(smallerTeam))
ct:SendAll()
hunter = hunter - 1
end
end

function GM:SwapTeams()
for k, ply in pairs(player.GetAll()) do
ply:SetTeam(3)
end
local players = team.GetPlayers(3)
local ply = players[math.random(#players)]
ply:SetTeam(2)
if !nokill && ply:Alive() then
ply:Kill()
end
local ct = ChatText()
ct:Add("Teams have been swapped", Color(50, 220, 150))
ct:SendAll()
end

Where is the sv_teams.lua file when we don't own a server ? I've just downloaded the Prophunters gamemode to play casually with some friends but I don't have a 'Prohunters' folder in steammaps > gamemodes (only base, sandbox and terrortown actually). Thank you !
ju 12 Dec, 2018 @ 2:04pm 
Thank you guys ! I was recently unactive but I have to say it again thanks a lot
Manas 21 Jan, 2019 @ 11:06am 
I can not find either sv_teams.lua too
Pouia Pouia 29 Jan, 2019 @ 8:01am 
Originally posted by Hakatron:
Originally posted by Captain Spirit:
Hi, you can try this in sv_teams.lua




function GM:TeamsSetupPlayer(ply)
local cops = team.NumPlayers(2)
local robbers = team.NumPlayers(3)
if cops >= 1 then
ply:SetTeam(3)
else
ply:SetTeam(2)
end
end

concommand.Add("car_jointeam", function (ply, com, args)
local curteam = ply:Team()
local newteam = tonumber(args[1] or "") or 0
if newteam == 1 && curteam != 1 then

ply:SetTeam(newteam)
if ply:Alive() then
ply:Kill()
end
local ct = ChatText()
ct:Add(ply:Nick())
ct:Add(" changed team to ")
ct:Add(team.GetName(newteam), team.GetColor(newteam))
ct:SendAll()

elseif newteam >= 2 && newteam <= 3 && newteam != curteam then

local ct = ChatText()
ct:Add("Team full, you cannot join")
ct:Send(ply)

end

end)

function GM:CheckTeamBalance()
if !self.TeamBalanceCheck || self.TeamBalanceCheck < CurTime() then
self.TeamBalanceCheck = CurTime() + 3 * 60 // check every 3 minutes

local hunter = team.NumPlayers(2)
if hunter > 1 then // Il doit y avoir un seul hunter
self.TeamBalanceTimer = CurTime() + 30 // balance in 30 seconds
for k,ply in pairs(player.GetAll()) do
ply:ChatPrint("Auto team balance in 30 seconds")
end
end
end
if self.TeamBalanceTimer && self.TeamBalanceTimer < CurTime() then
self.TeamBalanceTimer = nil
self:BalanceTeams()
end
end

function GM:BalanceTeams(nokill)
local hunter = team.NumPlayers(2)
while hunter > 1 do
local players = team.GetPlayers(2)
local ply = players[math.random(#players)]
ply:SetTeam(3)
if !nokill && ply:Alive() then
ply:Kill()
end
local ct = ChatText()
ct:Add(ply:Nick())
ct:Add(" est devenue un ")
ct:Add(team.GetName(smallerTeam), team.GetColor(smallerTeam))
ct:SendAll()
hunter = hunter - 1
end
end

function GM:SwapTeams()
for k, ply in pairs(player.GetAll()) do
ply:SetTeam(3)
end
local players = team.GetPlayers(3)
local ply = players[math.random(#players)]
ply:SetTeam(2)
if !nokill && ply:Alive() then
ply:Kill()
end
local ct = ChatText()
ct:Add("Teams have been swapped", Color(50, 220, 150))
ct:SendAll()
end

Where is the sv_teams.lua file when we don't own a server ? I've just downloaded the Prophunters gamemode to play casually with some friends but I don't have a 'Prohunters' folder in steammaps > gamemodes (only base, sandbox and terrortown actually). Thank you !

Found the file once I extracted the .gma file of the extention with "gmad.exe". But what's inside is the exact same thing as I have. Still, built it again, published it for my friends, and there is always equal number of player on each teams.. I don't understand why you have the best prop hunt mode, with no collision bug, nice taunt & all, but not this simplest function of limiting the number of hunters ?

How can I do this ?
< >
Showing 1-15 of 21 comments
Per page: 1530 50