[HL2:DM] 3 Teams
- Painkiller
- Senior Member
- Posts: 751
- Joined: Sun Mar 01, 2015 8:09 am
- Location: Germany
- Contact:
[HL2:DM] 3 Teams
A 3 team based plugin.
I also want to be able to play the Spectator and automatically select the team at game start.
Who could do that for me?
Thanks in Advance
I also want to be able to play the Spectator and automatically select the team at game start.
Who could do that for me?
Thanks in Advance
- Painkiller
- Senior Member
- Posts: 751
- Joined: Sun Mar 01, 2015 8:09 am
- Location: Germany
- Contact:
Re: [HL2:DM] 3 Teams
Did anyone have an idea?
- Painkiller
- Senior Member
- Posts: 751
- Joined: Sun Mar 01, 2015 8:09 am
- Location: Germany
- Contact:
Re: [HL2:DM] 3 Teams
Can someone help me,please?
Re: [HL2:DM] 3 Teams
Syntax: Select all
from players.entity import Player
from events import Event
from filters.players import PlayerIter
import operator
from cvars import ConVar
count = {}
@Event('player_activate')
def player_connect(ev):
teamplay = ConVar('mp_teamplay').get_int()
if teamplay == 1:
userid = int(ev['userid'])
team = get_team()
player = Player.from_userid(userid)
player.team_index = team
def get_team():
count[1] = 0
count[2] = 0
count[3] = 0
for player in PlayerIter():
if player.team_index == 1:
count[1] += 1
if player.team_index == 2:
count[2] += 1
if player.team_index == 3:
count[3] += 1
return min(count.items(), key=operator.itemgetter(1))[0]
- Painkiller
- Senior Member
- Posts: 751
- Joined: Sun Mar 01, 2015 8:09 am
- Location: Germany
- Contact:
Re: [HL2:DM] 3 Teams
19:20:37 HLSW Information: Verbinde zu 176.9.155.153:28060 ...
19:20:37 sp info
19:20:37
IMPORTANT: Please copy the full output.
--------------------------------------------------------
Checksum : 7b3b484c8f9936548dd32d99afcf3275
Date : 2018-06-18 17:20:54.589205
OS : Linux-4.4.0-79-generic-x86_64-with-debian-jessie-sid
Game : hl2dm
SP version : 653
Github commit : e5c043f1c5d7e15aaaca30d8f6341363002d1240
Server plugins:
00: DoS Attack Fixer, www.sourceop.com
01: Metamod:Source 1.10.7-dev
02: PlayerLimitRemover, www.sourceop.com
03: Spawn/Chat Protection; by Bernt Nilsson, version 3.3.5 beta 2
04: Source.Python, (C) 2012-2018, Source.Python Team.
SP plugins:
00: download
01: team
--------------------------------------------------------
19:23:22 sp plugin reload team
19:23:22 [SP] Unloading plugin 'team'...
[SP] Successfully unloaded plugin 'team'.
[SP] Loading plugin 'team'...
[SP] Successfully loaded plugin 'team'.
Unfortunately I do not see a 3 team,
it loads normally without errors.
19:20:37 sp info
19:20:37
IMPORTANT: Please copy the full output.
--------------------------------------------------------
Checksum : 7b3b484c8f9936548dd32d99afcf3275
Date : 2018-06-18 17:20:54.589205
OS : Linux-4.4.0-79-generic-x86_64-with-debian-jessie-sid
Game : hl2dm
SP version : 653
Github commit : e5c043f1c5d7e15aaaca30d8f6341363002d1240
Server plugins:
00: DoS Attack Fixer, www.sourceop.com
01: Metamod:Source 1.10.7-dev
02: PlayerLimitRemover, www.sourceop.com
03: Spawn/Chat Protection; by Bernt Nilsson, version 3.3.5 beta 2
04: Source.Python, (C) 2012-2018, Source.Python Team.
SP plugins:
00: download
01: team
--------------------------------------------------------
19:23:22 sp plugin reload team
19:23:22 [SP] Unloading plugin 'team'...
[SP] Successfully unloaded plugin 'team'.
[SP] Loading plugin 'team'...
[SP] Successfully loaded plugin 'team'.
Unfortunately I do not see a 3 team,
it loads normally without errors.
Re: [HL2:DM] 3 Teams
There is no team to see. The plugin will check how many players are on each team and the one with the lowest players will be chosen for new players.
So if Team Rebel has 2 players, Team Combine has 2 players and Team Spectators has 1, then you will be assigned to Team spectator.
I'm not sure what else you wanted. You want a menu to choose your team or what?
So if Team Rebel has 2 players, Team Combine has 2 players and Team Spectators has 1, then you will be assigned to Team spectator.
I'm not sure what else you wanted. You want a menu to choose your team or what?
- Painkiller
- Senior Member
- Posts: 751
- Joined: Sun Mar 01, 2015 8:09 am
- Location: Germany
- Contact:
Re: [HL2:DM] 3 Teams
Yes, a choice and the spectator should indeed be playable and not fly through the area.
Ja eine auswahl und der spectator sollte ja spielbar sein (rumlaufen können)und nicht durch die gegend fliegen.
Ja eine auswahl und der spectator sollte ja spielbar sein (rumlaufen können)und nicht durch die gegend fliegen.
Re: [HL2:DM] 3 Teams
The team is playable for me:

And what about choosing teams. In an ESC menu or how?
I just saw how to cut some lines too:
Also this only works when mp_teamplay is 1

And what about choosing teams. In an ESC menu or how?
I just saw how to cut some lines too:
Syntax: Select all
from players.entity import Player
from events import Event
from filters.players import PlayerIter
import operator
from cvars import ConVar
count = {}
@Event('player_activate')
def player_connect(ev):
teamplay = ConVar('mp_teamplay').get_int()
if teamplay == 1:
userid = int(ev['userid'])
team = get_team()
player = Player.from_userid(userid)
player.team_index = team
def get_team():
count[1] = 0
count[2] = 0
count[3] = 0
for player in PlayerIter():
count[player.team_index] += 1
return min(count.items(), key=operator.itemgetter(1))[0]
Also this only works when mp_teamplay is 1
- Painkiller
- Senior Member
- Posts: 751
- Joined: Sun Mar 01, 2015 8:09 am
- Location: Germany
- Contact:
Re: [HL2:DM] 3 Teams
mp_teamplay is on.
The selection would be very cool about the motd.
Is that possible?

I'm sorry for me Does the plugin not work.
I also have a Linux root
The selection would be very cool about the motd.
Is that possible?
I'm sorry for me Does the plugin not work.
I also have a Linux root
Re: [HL2:DM] 3 Teams
You will not See the spectator Team until someone is in it.
- Painkiller
- Senior Member
- Posts: 751
- Joined: Sun Mar 01, 2015 8:09 am
- Location: Germany
- Contact:
Re: [HL2:DM] 3 Teams
I'm aware,
I am jointeam 1
this is a spectator but i could only fly.
I am jointeam 1
this is a spectator but i could only fly.
Re: [HL2:DM] 3 Teams
My Plugin does Not interfere with jointeam so that might be why it does Not Work.
- Painkiller
- Senior Member
- Posts: 751
- Joined: Sun Mar 01, 2015 8:09 am
- Location: Germany
- Contact:
Re: [HL2:DM] 3 Teams
What do I have to do then?
Would it also be possible for the team to choose the motd.txt if that works?
Would it also be possible for the team to choose the motd.txt if that works?
Re: [HL2:DM] 3 Teams
This will take care of the jointeam problem:
Now can use 4 teams.
jointeam 0 = Team Unassigned
jointeam 1 = Team Spectator
jointeam 2 = Team Combine
jointeam 3 = Team Rebel
Now can use 4 teams.
jointeam 0 = Team Unassigned
jointeam 1 = Team Spectator
jointeam 2 = Team Combine
jointeam 3 = Team Rebel
Syntax: Select all
from players.entity import Player
from events import Event
from filters.players import PlayerIter
import operator
from cvars import ConVar
from commands.client import ClientCommand
from commands import CommandReturn
from messages import SayText2
import random
count = {}
@Event('player_activate')
def player_connect(ev):
teamplay = ConVar('mp_teamplay').get_int()
if teamplay == 1:
userid = int(ev['userid'])
team = get_team()
player = Player.from_userid(userid)
player.team_index = team
def get_team():
count[1] = 0
count[2] = 0
count[3] = 0
for player in PlayerIter():
count[player.team_index] += 1
return min(count.items(), key=operator.itemgetter(1))[0]
@ClientCommand('jointeam')
def join_test(command,index):
team_to_join = int(command[1])
if team_to_join > 3:
team_to_join = 0
player = Player(index)
player.team_index = team_to_join
if team_to_join == 0:
team_message = "Unassigned"
if team_to_join == 1:
team_message = "Specator"
if team_to_join == 2:
team_message = "Combine"
if team_to_join == 3:
team_message = "Rebel"
SayText2("\x04%s \x03changed to Team \x04%s" % (player.name,team_message)).send()
return CommandReturn.BLOCK
- Painkiller
- Senior Member
- Posts: 751
- Joined: Sun Mar 01, 2015 8:09 am
- Location: Germany
- Contact:
Re: [HL2:DM] 3 Teams
Now it seems to be funtioning.
Also team 0 works
Now you only need a choice when joins.
Good work
Edit: I noticed that I often get kicked out of the game.
Is there autokick_disabler for SP?
Also team 0 works
Now you only need a choice when joins.
Good work
Edit: I noticed that I often get kicked out of the game.
Is there autokick_disabler for SP?
Last edited by Painkiller on Tue Jun 19, 2018 1:33 pm, edited 1 time in total.
Re: [HL2:DM] 3 Teams
Syntax: Select all
from players.entity import Player
from events import Event
from filters.players import PlayerIter
import operator
from cvars import ConVar
from commands.client import ClientCommand
from commands import CommandReturn
from messages import SayText2
import random
count = {}
@Event('player_activate')
def player_connect(ev):
teamplay = ConVar('mp_teamplay').get_int()
if teamplay == 1:
userid = int(ev['userid'])
team = get_team()
player = Player.from_userid(userid)
player.team_index = team
def get_team():
count[1] = 0
count[2] = 0
count[3] = 0
for player in PlayerIter():
count[player.team_index] += 1
return min(count.items(), key=operator.itemgetter(1))[0]
@ClientCommand('jointeam')
def join_test(command,index):
team_to_join = int(command[1])
if team_to_join > 3:
team_to_join = 0
player = Player(index)
player.team_index = team_to_join
player.client_command("kill", True)
if team_to_join == 0:
team_message = "Unassigned"
if team_to_join == 1:
team_message = "Specator"
if team_to_join == 2:
team_message = "Combine"
if team_to_join == 3:
team_message = "Rebel"
SayText2("\x04%s \x03changed to Team \x04%s" % (player.name,team_message)).send()
return CommandReturn.BLOCK
This version will kill you when using jointeam, so people cannot abuse it.
Also I am not familiar with MODT editing so I cannot help you with that.
- Painkiller
- Senior Member
- Posts: 751
- Joined: Sun Mar 01, 2015 8:09 am
- Location: Germany
- Contact:
Re: [HL2:DM] 3 Teams
motd can html
it just lacks something where it refers I think.
Edit: Team 0 immediately refers to team 2 or 3
After mapchange you are assigned another team that is bad.
Edit 2: If possible, please make an ESC menu?
it just lacks something where it refers I think.
Edit: Team 0 immediately refers to team 2 or 3
After mapchange you are assigned another team that is bad.
Edit 2: If possible, please make an ESC menu?
Re: [HL2:DM] 3 Teams
This is a version with ESC Menu.
The plugin now works like this:
When you join you will be assigned to the team with the lowest players and you are sent an ESC Menu too.
Then you have the option to write !team in the chat to open up the ESC Menu again. You can also still use jointeam if you want
Edit: I just saw your complaints about the unassigned team and you are right, on spawn it will choose a team from the two "real" ones. So in the version above I removed the Unassigned Team as it seems to have unexpected behavior.
The plugin now works like this:
When you join you will be assigned to the team with the lowest players and you are sent an ESC Menu too.
Then you have the option to write !team in the chat to open up the ESC Menu again. You can also still use jointeam if you want
Syntax: Select all
from players.entity import Player
from events import Event
from filters.players import PlayerIter
import operator
from cvars import ConVar
from commands.client import ClientCommand
from commands import CommandReturn
from messages import SayText2
from commands.say import SayCommand
from menus.esc import SimpleESCMenu,SimpleESCOption
import random
count = {}
@SayCommand("!team")
def team_command(command, index, team=None):
choose_team_menu.send(index)
@Event('player_activate')
def player_connect(ev):
teamplay = ConVar('mp_teamplay').get_int()
if teamplay == 1:
userid = int(ev['userid'])
team = get_team()
player = Player.from_userid(userid)
player.team_index = team
choose_team_menu.send(player.index)
def get_team():
count[1] = 0
count[2] = 0
count[3] = 0
for player in PlayerIter():
count[player.team_index] += 1
return min(count.items(), key=operator.itemgetter(1))[0]
def choose_team_select(menu,index,choice):
Player(index).client_command("jointeam %s" % choice.choice_index)
Player(index).client_command("kill", True)
def choose_team_build(menu,index):
option = SimpleESCOption(1,'Spectator Team')
menu.append(option)
option = SimpleESCOption(2,'Combine Team')
menu.append(option)
option = SimpleESCOption(3,'Rebel Team')
menu.append(option)
choose_team_menu = SimpleESCMenu(select_callback=choose_team_select, build_callback=choose_team_build, title="Choose your team")
@ClientCommand('jointeam')
def join_test(command,index):
team_to_join = int(command[1])
if team_to_join > 3 or team_to_join < 1:
team_to_join = random.randint(1, 3)
player = Player(index)
player.team_index = team_to_join
player.client_command("kill", True)
player.team_index = team_to_join
if team_to_join == 1:
team_message = "Specator"
if team_to_join == 2:
team_message = "Combine"
if team_to_join == 3:
team_message = "Rebel"
SayText2("\x04%s \x03changed to Team \x04%s" % (player.name,team_message)).send()
return CommandReturn.BLOCK
Edit: I just saw your complaints about the unassigned team and you are right, on spawn it will choose a team from the two "real" ones. So in the version above I removed the Unassigned Team as it seems to have unexpected behavior.
- Painkiller
- Senior Member
- Posts: 751
- Joined: Sun Mar 01, 2015 8:09 am
- Location: Germany
- Contact:
Re: [HL2:DM] 3 Teams
The chat command !team does not work.
After mapchange you are still thrown into another team.
Could you stay in the same team?
Edit: I tested it again on a new server.
As far as everything seems to work.
Only the mapchange does not work.
He always throws into team 1 (spec)
After mapchange you are still thrown into another team.
Could you stay in the same team?
Edit: I tested it again on a new server.
As far as everything seems to work.
Only the mapchange does not work.
He always throws into team 1 (spec)
Last edited by Painkiller on Tue Jun 19, 2018 3:08 pm, edited 1 time in total.
Re: [HL2:DM] 3 Teams
Just an fyi, but you don't need to explicitly import ESCMenu/Option for hl2mp, as that is the default for that game (since it doesn't support Radio Menus):
https://github.com/Source-Python-Dev-Te ... t__.py#L13
https://github.com/Source-Python-Dev-Te ... t__.py#L13
Who is online
Users browsing this forum: No registered users and 64 guests