Talk:Creating Teams

From Valve Developer Community
Jump to: navigation, search

Worked great for me, thanks

I'm making a mod based on HL2MP and this worked really well for me. The only thing that didn't work for me was getting the #Variable_Name stuff in the menu resource file to map to the language-specific text file, oh well.

// User:Airuike


compile errors

Hi i just tried this with creating teames and it didnt work as i wanted to. Well when i type Chooseteam in console the menu brings up. But if i select any of these buttons it would happen nothing. And also.. when i spawn it would randomly spawn as a combine or rebel.

// User:OlloX3


I get these error when compiling player.cpp

player.cpp

.\player.cpp(5673) : error C2065: 'TEAM_COMBINE' : undeclared identifier .\player.cpp(5673) : error C2227: left of '->GetNumPlayers' must point to class/struct/union/generic type .\player.cpp(5673) : error C2065: 'TEAM_REBELS' : undeclared identifier .\player.cpp(5673) : error C2227: left of '->GetNumPlayers' must point to class/struct/union/generic type Creating browse information file...


if I comment out the code thats from the tutorial it compiles without error.--Jadepanther 06:41, 10 Feb 2007 (PST)

See this-
TEAM_COMBINE and TEAM_REBELS should NOT be defined here unless you are modding a from-scratch Source SDK. Here we are modding a deathmatch SDK, so the two teams have already been defined in an enum in hl2mpgamerules.h
If you're making a multiplayer mod, shouldn't you be using the deathmatch sdk? --Daedalus 21:18, 10 Feb 2007 (PST)

Implementing Tutorial

i have tried on multiple occasions to get this working for the "Modify Half-life 2 multiplayer" base for my mod. and it inst playing ball. whenever it loads a map with 2 spawns defined as info_player _combine and info_player_rebels it just crashes. what on earth is wrong? when i create a map with info_player_start it works :S

You have to add an info_player_start where you want spectators to spawn. Otherwise it just crashes out. Take a look at the crash dump for more info! --Robinjam 19:29, 15 Jul 2007 (PDT)

Odd Problem

I thought I followed this tutorial fairly well, but I have an odd problem. Right when SDK Base loads up, the menu comes up but you can't click anything, and then odd purple/black boxes cover up the menu and an "Ok" box shows up, and when you click it, the team menu comes up and makes you choose a team...before you've even started a game =\ When you choose a team, it spawns your character as if you're in a game, but it's still in the main menu. Doesn't make any sense to me. Also, the titles that start with "#" aren't replaced. Once you've chosen the team, you're able to click on Find Server, Create Server, and all of those. Once you create a server and are in, those purple & black boxes come back up and it's the same thing, though it's actually when it's supposed to come up. The "#" titles still aren't replaced, though. If you leave the server and go back to the main menu, the main menu's normal. It's only on the original start up that it does that. Anyone got any ideas? Thanks!

EDIT: It turns out it only does this in SDK Base, but doesn't when I use HL2 Deathmatch for the applanuch id. The the problem with the titles still exists. Any ideas? --CreepyNerd 18:26, 30 Aug 2007 (PDT)

Compiling error

I get this error when compiling after using this tutorial.

Error 1 error C2664: 'CMapOverview::CMapOverview(const char *)' : cannot convert parameter 1 from 'CBaseViewport *const ' to 'const char *' c:\aportalmonkey\src\cl_dll\game_controls\baseviewport.cpp 206


which points to this section in the code

else if ( Q_strcmp(PANEL_OVERVIEW, szPanelName) == 0 ) { newpanel = new CMapOverview( this ); } Ideas? --VampoRainze

I got the same error and commented out the section giving the error. Sloppy, but i haven't noticed any serious problems. PoopShipDestroyer 23:37, 28 Jan 2008 (PST)


You need to change the class it makes to your panel class: --Lodle 19:47, 23 Feb 2008 (PST)
	else if ( Q_strcmp(PANEL_OVERVIEW, szPanelName) == 0 )
	{
		newpanel = new CMYCLASS( this );
	}


I did this to fix that error: --Pretador 21:30, 16 Jun 2011 (PST)

/*	else if ( Q_strcmp(PANEL_OVERVIEW, szPanelName) == 0 )
	{
		newpanel = new CMapOverview( this );
	}
	
*/	else if ( Q_strcmp(PANEL_TEAM, szPanelName) == 0 )
	{
		newpanel = new CTeamMenu( this );
	}

Creating Multiplayer Mods

When I attempt to click "Modify Half-life 2 Multiplayer" the option is greyed out. Any ideas?

GET hl2 dm before u can get modify hl2 mp

Changes in command functions

I think that the CTeamplayRules::ClientCommand and CBasePlayer::ClientCommand functions got changed somewhere along the line. I have the most recent MP SDK (I think), and in the code I have, they are given as:

bool CTeamplayRules::ClientCommand( const char *pcmd, CBaseEntity *pEdict )
bool CBasePlayer::ClientCommand( const char *cmd )

, slightly different from what is assumed in the tutorial. This causes several compile errors (for obvious reasons), but there are some easy fixes:

1

In teamplay_gamerules.cpp, under CTeamplayRules:ClientCommand, change:

if( BaseClass::ClientCommand( pEdict, args ) )

to:

if( BaseClass::ClientCommand( pcmd, pEdict ) )

2

In player.cpp, under CBasePlayer:ClientCommand change:

if ( args.ArgC() < 2 )

to:

if ( engine->Cmd_Argc() < 2 )

, and change:

int team = atoi( args.Arg(1) );

to:

int team = atoi ( engine->Cmd_Argv ( 1 ) );

It should work, I believe.

--Sonny jim 16:06, 24 Dec 2008 (PST)


Just edited this so people can see it (couldnt before cos of some wiki code problem?)... Helped me heaps

weird team change

Whenever mmy character dies or joins from spectaror he doesnt spawn or respawn. how can i fix it