Hey list,
been trying to get AutoAssign to work, got as far as to making it
actually join instead of dumping you back into spectate or not working
at all.. but now I'm stuck
To get autoassign to work I'm employing the basic if teamplay = 1 and
you join team 0(unassigned) then it's supposed to move you to either
Rebels or Combine, instead in a teamplay game your not moved so you join
the game as unnasigned, you then take on the spawnpoints of
info_player_deathmatch instead of info_player_insertteamname which are
placed randomly on the map. Also you don't show up on the scoreboard.
The mod is in Ep1 and using the command mp_teamplay each map can be set
to be either deathmatch or team deatmatch(spawns for teams are in a
bunker, deathmatch spawns are scattered across the map)
Here's the code I'm using in player.cpp in the function bool
CBasePlayer::ClientCommand(const char *cmd):
(code concerning spectate commands above)
else if ( stricmp( cmd, "jointeam" ) == 0 ) //start jointeam
{
if (engine->Cmd_Argc() < 2 )
return true;
int team = atoi( engine->Cmd_Argv(1) );
//don't do anything if you join your own team
if ( team == GetTeamNumber() )
return true;
CTeam *pCombine = g_Teams[TEAM_COMBINE];
CTeam *pRebels = g_Teams[TEAM_REBELS];
//auto assign if you join team 0
if ( GetTeamNumber() == 0 )
{
if ( HL2MPRules()->IsTeamplay() == true )
{
if ( pCombine == NULL || pRebels == NULL )
{
ChangeTeam( random->RandomInt( TEAM_COMBINE,
TEAM_REBELS ) );
}
else
{
if ( pCombine->GetNumPlayers() >
pRebels->GetNumPlayers() )
{
ChangeTeam( TEAM_REBELS );
}
else if ( pCombine->GetNumPlayers() <
pRebels->GetNumPlayers() )
{
ChangeTeam( TEAM_COMBINE );
}
else
{
ChangeTeam( random->RandomInt( TEAM_COMBINE,
TEAM_REBELS ) );
}
}
}
}
if ( !IsDead() )
{
if ( GetTeamNumber() != TEAM_UNASSIGNED )
{
CommitSuicide();
IncrementFragCount(1); //adds 1 frag to balance out
the 1 subtracted for killing yourself
}
}
ChangeTeam( team );
return true;
} //end jointeam
return true;
}
return false;
}
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders