Added cvar mp_auto_join_team

This commit is contained in:
s1lentq 2016-06-15 16:26:46 +07:00
parent e57371d0f4
commit aaf1d9648e
15 changed files with 124 additions and 37 deletions

View File

@ -30,6 +30,7 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure'
| mp_auto_reload_weapons | 0 | 0 | 1 | Automatically reload each weapon on player spawn<br/>`0` disabled<br/>`1` enabled | | mp_auto_reload_weapons | 0 | 0 | 1 | Automatically reload each weapon on player spawn<br/>`0` disabled<br/>`1` enabled |
| mp_refill_bpammo_weapons | 0 | 0 | 2 | Refill amount of backpack ammo up to the max <br/>`0` disabled<br/>`1` refill backpack ammo on player spawn<br/>`2` refill backpack ammo on each weapon reload | | mp_refill_bpammo_weapons | 0 | 0 | 2 | Refill amount of backpack ammo up to the max <br/>`0` disabled<br/>`1` refill backpack ammo on player spawn<br/>`2` refill backpack ammo on each weapon reload |
| bot_deathmatch | 0 | 0 | 1 | Set's the mode for the zBot <br/>`0` disabled<br/>`1` enable mode Deathmatch and not allow to do the scenario | | bot_deathmatch | 0 | 0 | 1 | Set's the mode for the zBot <br/>`0` disabled<br/>`1` enable mode Deathmatch and not allow to do the scenario |
| mp_auto_join_team | 0 | 0 | 1 | Automatically joins the team <br/>`0` disabled<br/>`1` enable (Use in conjunction with the cvar humans_join_team any/CT/T) |
## How to install zBot for CS 1.6? ## How to install zBot for CS 1.6?
* Extract all the files from an [archive](regamedll/extra/zBot/bot_profiles.zip?raw=true) * Extract all the files from an [archive](regamedll/extra/zBot/bot_profiles.zip?raw=true)

7
dist/game.cfg vendored
View File

@ -70,3 +70,10 @@ mp_refill_bpammo_weapons 0
// //
// Default value: "0" // Default value: "0"
bot_deathmatch 0 bot_deathmatch 0
// Automatically joins the team
// 0 - disabled
// 1 - enable (Use in conjunction with the cvar humans_join_team any/CT/T)
//
// Default value: "0"
mp_auto_join_team 0

View File

@ -211,11 +211,25 @@ void __API_HOOK(ShowMenu)(CBasePlayer *pPlayer, int bitsValidSlots, int nDisplay
MESSAGE_END(); MESSAGE_END();
} }
LINK_HOOK_VOID_CHAIN(ShowVGUIMenu, (CBasePlayer *pPlayer, int MenuType, int BitMask, char *szOldMenu, bool bForceOldMenu), pPlayer, MenuType, BitMask, szOldMenu, bForceOldMenu); LINK_HOOK_VOID_CHAIN(ShowVGUIMenu, (CBasePlayer *pPlayer, int MenuType, int BitMask, char *szOldMenu), pPlayer, MenuType, BitMask, szOldMenu);
void __API_HOOK(ShowVGUIMenu)(CBasePlayer *pPlayer, int MenuType, int BitMask, char *szOldMenu, bool bForceOldMenu) void __API_HOOK(ShowVGUIMenu)(CBasePlayer *pPlayer, int MenuType, int BitMask, char *szOldMenu)
{ {
if (!bForceOldMenu && (pPlayer->m_bVGUIMenus || MenuType > VGUI_Menu_Buy_Item)) #ifdef REGAMEDLL_ADD
if (CSGameRules()->ShouldSkipShowMenu()) {
CSGameRules()->MarkShowMenuSkipped();
pPlayer->m_iMenu = Menu_OFF;
return;
}
if (pPlayer->CSPlayer()->m_bForceShowMenu) {
ShowMenu(pPlayer, BitMask, -1, 0, szOldMenu);
return;
}
#endif
if (pPlayer->m_bVGUIMenus || MenuType > VGUI_Menu_Buy_Item)
{ {
MESSAGE_BEGIN(MSG_ONE, gmsgVGUIMenu, NULL, pPlayer->pev); MESSAGE_BEGIN(MSG_ONE, gmsgVGUIMenu, NULL, pPlayer->pev);
WRITE_BYTE(MenuType); WRITE_BYTE(MenuType);
@ -1736,7 +1750,11 @@ BOOL __API_HOOK(HandleMenu_ChooseTeam)(CBasePlayer *player, int slot)
return FALSE; return FALSE;
} }
if (team != SPECTATOR && !player->IsBot()) if (team != SPECTATOR && !player->IsBot()
#ifdef REGAMEDLL_ADD
&& auto_join_team.value != 1.0f
#endif
)
{ {
int humanTeam = UNASSIGNED; int humanTeam = UNASSIGNED;
@ -1751,7 +1769,12 @@ BOOL __API_HOOK(HandleMenu_ChooseTeam)(CBasePlayer *player, int slot)
if (humanTeam != UNASSIGNED && team != humanTeam) if (humanTeam != UNASSIGNED && team != humanTeam)
{ {
// TODO: These localization strings are not defined on the client CS 1.6, only for CZero
#ifdef REGAMEDLL_FIXES
ClientPrint(player->pev, HUD_PRINTCENTER, (team == TERRORIST) ? "Humans can only be CT!" : "Humans can only be terrorists!");
#else
ClientPrint(player->pev, HUD_PRINTCENTER, (team == TERRORIST) ? "#Humans_Join_Team_CT" : "#Humans_Join_Team_T"); ClientPrint(player->pev, HUD_PRINTCENTER, (team == TERRORIST) ? "#Humans_Join_Team_CT" : "#Humans_Join_Team_T");
#endif
return FALSE; return FALSE;
} }
} }
@ -1799,33 +1822,38 @@ BOOL __API_HOOK(HandleMenu_ChooseTeam)(CBasePlayer *player, int slot)
SET_MODEL(ENT(player->pev), "models/player.mdl"); SET_MODEL(ENT(player->pev), "models/player.mdl");
} }
if (!CSGameRules()->IsCareer()) #ifdef REGAMEDLL_ADD
if (!CSGameRules()->ShouldSkipShowMenu())
#endif
{ {
switch (team) if (!CSGameRules()->IsCareer())
{ {
case CT: switch (team)
if (g_bIsCzeroGame) {
ShowVGUIMenu(player, VGUI_Menu_Class_CT, (MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_4 | MENU_KEY_5 | MENU_KEY_6), "#CT_Select"); case CT:
else if (g_bIsCzeroGame)
ShowVGUIMenu(player, VGUI_Menu_Class_CT, (MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_4 | MENU_KEY_5), "#CT_Select"); ShowVGUIMenu(player, VGUI_Menu_Class_CT, (MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_4 | MENU_KEY_5 | MENU_KEY_6), "#CT_Select");
break; else
ShowVGUIMenu(player, VGUI_Menu_Class_CT, (MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_4 | MENU_KEY_5), "#CT_Select");
break;
case TERRORIST: case TERRORIST:
if (g_bIsCzeroGame) if (g_bIsCzeroGame)
ShowVGUIMenu(player, VGUI_Menu_Class_T, (MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_4 | MENU_KEY_5 | MENU_KEY_6), "#Terrorist_Select"); ShowVGUIMenu(player, VGUI_Menu_Class_T, (MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_4 | MENU_KEY_5 | MENU_KEY_6), "#Terrorist_Select");
else else
ShowVGUIMenu(player, VGUI_Menu_Class_T, (MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_4 | MENU_KEY_5), "#Terrorist_Select"); ShowVGUIMenu(player, VGUI_Menu_Class_T, (MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_4 | MENU_KEY_5), "#Terrorist_Select");
break; break;
}
} }
}
player->m_iMenu = Menu_ChooseAppearance; player->m_iMenu = Menu_ChooseAppearance;
// Show the appropriate Choose Appearance menu // Show the appropriate Choose Appearance menu
// This must come before ClientKill() for CheckWinConditions() to function properly // This must come before ClientKill() for CheckWinConditions() to function properly
if (player->pev->deadflag == DEAD_NO) if (player->pev->deadflag == DEAD_NO)
{ {
ClientKill(player->edict()); ClientKill(player->edict());
}
} }
// Switch their actual team... // Switch their actual team...
@ -2575,6 +2603,21 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
case Menu_ChooseTeam: case Menu_ChooseTeam:
{ {
#ifdef REGAMEDLL_ADD
if (!player->m_bVGUIMenus || player->CSPlayer()->m_bForceShowMenu)
{
player->CSPlayer()->m_bForceShowMenu = false;
if (!HandleMenu_ChooseTeam(player, slot))
{
player->m_iMenu = Menu_ChooseTeam;
if (player->m_iJoiningState == JOINED)
ShowVGUIMenu(player, VGUI_Menu_Team, (MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_5 | MENU_KEY_0), "#IG_Team_Select");
else
ShowVGUIMenu(player, VGUI_Menu_Team, (MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_5), "#Team_Select");
}
}
#else
if (!player->m_bVGUIMenus && !HandleMenu_ChooseTeam(player, slot)) if (!player->m_bVGUIMenus && !HandleMenu_ChooseTeam(player, slot))
{ {
player->m_iMenu = Menu_ChooseTeam; player->m_iMenu = Menu_ChooseTeam;
@ -2583,6 +2626,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
else else
ShowVGUIMenu(player, VGUI_Menu_Team, (MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_5), "#Team_Select"); ShowVGUIMenu(player, VGUI_Menu_Team, (MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_5), "#Team_Select");
} }
#endif
break; break;
} }
case Menu_IGChooseTeam: case Menu_IGChooseTeam:
@ -2807,9 +2851,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
else if (FStrEq(pcmd, "chooseteam")) else if (FStrEq(pcmd, "chooseteam"))
{ {
if (player->m_iMenu == Menu_ChooseAppearance) if (player->m_iMenu == Menu_ChooseAppearance)
{
return; return;
}
if (player->m_bTeamChanged) if (player->m_bTeamChanged)
{ {

View File

@ -121,8 +121,8 @@ void respawn(entvars_t *pev, BOOL fCopyCorpse = FALSE);
void ClientKill(edict_t *pEntity); void ClientKill(edict_t *pEntity);
void ShowMenu(CBasePlayer *pPlayer, int bitsValidSlots, int nDisplayTime, BOOL fNeedMore, char *pszText); void ShowMenu(CBasePlayer *pPlayer, int bitsValidSlots, int nDisplayTime, BOOL fNeedMore, char *pszText);
void ShowMenu_(CBasePlayer *pPlayer, int bitsValidSlots, int nDisplayTime, BOOL fNeedMore, char *pszText); void ShowMenu_(CBasePlayer *pPlayer, int bitsValidSlots, int nDisplayTime, BOOL fNeedMore, char *pszText);
void ShowVGUIMenu(CBasePlayer *pPlayer, int MenuType, int BitMask, char *szOldMenu, bool bForceOldMenu = false); void ShowVGUIMenu(CBasePlayer *pPlayer, int MenuType, int BitMask, char *szOldMenu);
void ShowVGUIMenu_(CBasePlayer *pPlayer, int MenuType, int BitMask, char *szOldMenu, bool bForceOldMenu = false); void ShowVGUIMenu_(CBasePlayer *pPlayer, int MenuType, int BitMask, char *szOldMenu);
void ListPlayers(CBasePlayer *current); void ListPlayers(CBasePlayer *current);
void ProcessKickVote(CBasePlayer *pVotingPlayer, CBasePlayer *pKickPlayer); void ProcessKickVote(CBasePlayer *pVotingPlayer, CBasePlayer *pKickPlayer);
TeamName SelectDefaultTeam(); TeamName SelectDefaultTeam();

View File

@ -104,6 +104,7 @@ cvar_t roundrespawn_time = { "mp_roundrespawn_time", "20", 0, 20.0f, nullptr };
cvar_t auto_reload_weapons = { "mp_auto_reload_weapons", "0", 0, 0.0f, nullptr }; cvar_t auto_reload_weapons = { "mp_auto_reload_weapons", "0", 0, 0.0f, nullptr };
cvar_t refill_bpammo_weapons = { "mp_refill_bpammo_weapons", "0", 0, 0.0f, nullptr }; // Useful for mods like DeathMatch, GunGame, ZombieMod etc cvar_t refill_bpammo_weapons = { "mp_refill_bpammo_weapons", "0", 0, 0.0f, nullptr }; // Useful for mods like DeathMatch, GunGame, ZombieMod etc
cvar_t freeforall = { "mp_freeforall", "0", FCVAR_SERVER, 0.0f, nullptr }; cvar_t freeforall = { "mp_freeforall", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t auto_join_team = { "mp_auto_join_team", "0", 0, 0.0f, nullptr };
void GameDLL_Version_f() void GameDLL_Version_f()
{ {
@ -234,6 +235,7 @@ void EXT_FUNC GameDLLInit()
CVAR_REGISTER(&auto_reload_weapons); CVAR_REGISTER(&auto_reload_weapons);
CVAR_REGISTER(&refill_bpammo_weapons); CVAR_REGISTER(&refill_bpammo_weapons);
CVAR_REGISTER(&freeforall); CVAR_REGISTER(&freeforall);
CVAR_REGISTER(&auto_join_team);
// print version // print version
CONSOLE_ECHO("ReGameDLL build: " __TIME__ " " __DATE__ " (" APP_VERSION_STRD ")\n"); CONSOLE_ECHO("ReGameDLL build: " __TIME__ " " __DATE__ " (" APP_VERSION_STRD ")\n");

View File

@ -141,6 +141,7 @@ extern cvar_t roundrespawn_time;
extern cvar_t auto_reload_weapons; extern cvar_t auto_reload_weapons;
extern cvar_t refill_bpammo_weapons; extern cvar_t refill_bpammo_weapons;
extern cvar_t freeforall; extern cvar_t freeforall;
extern cvar_t auto_join_team;
#endif #endif

View File

@ -600,6 +600,8 @@ public:
void SetCareerMatchLimit(int minWins, int winDifference); void SetCareerMatchLimit(int minWins, int winDifference);
bool IsInCareerRound(); bool IsInCareerRound();
void CareerRestart(); void CareerRestart();
bool ShouldSkipShowMenu() const { return m_bSkipShowMenu; }
void MarkShowMenuSkipped() { m_bSkipShowMenu = false; }
bool ShouldSkipSpawn() const { return m_bSkipSpawn; } bool ShouldSkipSpawn() const { return m_bSkipSpawn; }
void MarkSpawnSkipped() { m_bSkipSpawn = false; } void MarkSpawnSkipped() { m_bSkipSpawn = false; }
void PlayerJoinedTeam(CBasePlayer *pPlayer) { } void PlayerJoinedTeam(CBasePlayer *pPlayer) { }
@ -735,6 +737,7 @@ protected:
bool m_bSkipSpawn; bool m_bSkipSpawn;
// custom // custom
bool m_bSkipShowMenu;
bool m_bNeededPlayers; bool m_bNeededPlayers;
float m_flEscapeRatio; float m_flEscapeRatio;
}; };

View File

@ -3523,6 +3523,12 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(PlayerThink)(CBasePlayer *pPlayer)
{ {
team = MENU_SLOT_TEAM_CT; team = MENU_SLOT_TEAM_CT;
} }
#ifdef REGAMEDLL_ADD
else if (!Q_stricmp(humans_join_team.string, "any") && auto_join_team.value != 0.0f)
{
team = MENU_SLOT_TEAM_RANDOM;
}
#endif
else else
{ {
if (allow_spectators.value == 0.0f) if (allow_spectators.value == 0.0f)
@ -3536,6 +3542,17 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(PlayerThink)(CBasePlayer *pPlayer)
if (team != MENU_SLOT_TEAM_UNDEFINED && !pPlayer->IsBot()) if (team != MENU_SLOT_TEAM_UNDEFINED && !pPlayer->IsBot())
{ {
#ifdef REGAMEDLL_ADD
m_bSkipShowMenu = (auto_join_team.value != 0.0f);
HandleMenu_ChooseTeam(pPlayer, team);
if (team != MENU_SLOT_TEAM_SPECT && (IsCareer() || m_bSkipShowMenu))
{
// slot 6 - chooses randomize the appearance to model player
HandleMenu_ChooseAppearance(pPlayer, 6);
}
m_bSkipShowMenu = false;
#else
HandleMenu_ChooseTeam(pPlayer, team); HandleMenu_ChooseTeam(pPlayer, team);
if (team != MENU_SLOT_TEAM_SPECT && IsCareer()) if (team != MENU_SLOT_TEAM_SPECT && IsCareer())
@ -3543,6 +3560,7 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(PlayerThink)(CBasePlayer *pPlayer)
// slot 6 - chooses randomize the appearance to model player // slot 6 - chooses randomize the appearance to model player
HandleMenu_ChooseAppearance(pPlayer, 6); HandleMenu_ChooseAppearance(pPlayer, 6);
} }
#endif
} }
} }
} }

View File

@ -426,8 +426,12 @@ public:
virtual bool IsBombPlanted() = 0; virtual bool IsBombPlanted() = 0;
public: public:
bool ShouldSkipShowMenu() const { return m_bSkipShowMenu; }
void MarkShowMenuSkipped() { m_bSkipShowMenu = false; }
bool ShouldSkipSpawn() const { return m_bSkipSpawn; } bool ShouldSkipSpawn() const { return m_bSkipSpawn; }
void MarkSpawnSkipped() { m_bSkipSpawn = false; } void MarkSpawnSkipped() { m_bSkipSpawn = false; }
float TimeRemaining() { return m_iRoundTimeSecs - gpGlobals->time + m_fRoundCount; } float TimeRemaining() { return m_iRoundTimeSecs - gpGlobals->time + m_fRoundCount; }
bool IsMatchStarted() { return (m_fTeamCount != 0.0f || m_fCareerRoundMenuTime != 0.0f || m_fCareerMatchMenuTime != 0.0f); } bool IsMatchStarted() { return (m_fTeamCount != 0.0f || m_fCareerRoundMenuTime != 0.0f || m_fCareerMatchMenuTime != 0.0f); }
@ -522,6 +526,7 @@ public:
bool m_bSkipSpawn; bool m_bSkipSpawn;
// custom // custom
bool m_bSkipShowMenu;
bool m_bNeededPlayers; bool m_bNeededPlayers;
float m_flEscapeRatio; float m_flEscapeRatio;
}; };

View File

@ -210,8 +210,8 @@ typedef IVoidHookChain<class CBasePlayer *, int, int, BOOL, char *> IReGameHook_
typedef IVoidHookChainRegistry<class CBasePlayer *, int, int, BOOL, char *> IReGameHookRegistry_ShowMenu; typedef IVoidHookChainRegistry<class CBasePlayer *, int, int, BOOL, char *> IReGameHookRegistry_ShowMenu;
// ShowVGUIMenu hook // ShowVGUIMenu hook
typedef IVoidHookChain<class CBasePlayer *, int, int, char *, bool> IReGameHook_ShowVGUIMenu; typedef IVoidHookChain<class CBasePlayer *, int, int, char *> IReGameHook_ShowVGUIMenu;
typedef IVoidHookChainRegistry<class CBasePlayer *, int, int, char *, bool> IReGameHookRegistry_ShowVGUIMenu; typedef IVoidHookChainRegistry<class CBasePlayer *, int, int, char *> IReGameHookRegistry_ShowVGUIMenu;
// CHalfLifeMultiplay::FShouldSwitchWeapon hook // CHalfLifeMultiplay::FShouldSwitchWeapon hook
typedef IHookChain<BOOL, class CBasePlayer *, class CBasePlayerItem *> IReGameHook_CSGameRules_FShouldSwitchWeapon; typedef IHookChain<BOOL, class CBasePlayer *, class CBasePlayerItem *> IReGameHook_CSGameRules_FShouldSwitchWeapon;

View File

@ -51,7 +51,7 @@ class CCSArmoury: public CCSEntity {};
class CCSPlayer: public CCSMonster { class CCSPlayer: public CCSMonster {
public: public:
CCSPlayer() CCSPlayer() : m_bForceShowMenu(false)
{ {
m_szModel[0] = '\0'; m_szModel[0] = '\0';
} }
@ -83,6 +83,7 @@ public:
CBasePlayer *BasePlayer() const; CBasePlayer *BasePlayer() const;
public: public:
char m_szModel[32]; char m_szModel[32];
bool m_bForceShowMenu;
}; };
class CAPI_Bot: public CCSPlayer {}; class CAPI_Bot: public CCSPlayer {};

View File

@ -210,8 +210,8 @@ typedef IVoidHookChain<class CBasePlayer *, int, int, BOOL, char *> IReGameHook_
typedef IVoidHookChainRegistry<class CBasePlayer *, int, int, BOOL, char *> IReGameHookRegistry_ShowMenu; typedef IVoidHookChainRegistry<class CBasePlayer *, int, int, BOOL, char *> IReGameHookRegistry_ShowMenu;
// ShowVGUIMenu hook // ShowVGUIMenu hook
typedef IVoidHookChain<class CBasePlayer *, int, int, char *, bool> IReGameHook_ShowVGUIMenu; typedef IVoidHookChain<class CBasePlayer *, int, int, char *> IReGameHook_ShowVGUIMenu;
typedef IVoidHookChainRegistry<class CBasePlayer *, int, int, char *, bool> IReGameHookRegistry_ShowVGUIMenu; typedef IVoidHookChainRegistry<class CBasePlayer *, int, int, char *> IReGameHookRegistry_ShowVGUIMenu;
// CHalfLifeMultiplay::FShouldSwitchWeapon hook // CHalfLifeMultiplay::FShouldSwitchWeapon hook
typedef IHookChain<BOOL, class CBasePlayer *, class CBasePlayerItem *> IReGameHook_CSGameRules_FShouldSwitchWeapon; typedef IHookChain<BOOL, class CBasePlayer *, class CBasePlayerItem *> IReGameHook_CSGameRules_FShouldSwitchWeapon;

View File

@ -51,7 +51,7 @@ class CCSArmoury: public CCSEntity {};
class CCSPlayer: public CCSMonster { class CCSPlayer: public CCSMonster {
public: public:
CCSPlayer() CCSPlayer() : m_bForceShowMenu(false)
{ {
m_szModel[0] = '\0'; m_szModel[0] = '\0';
} }
@ -90,6 +90,7 @@ public:
CBasePlayer *BasePlayer() const; CBasePlayer *BasePlayer() const;
public: public:
char m_szModel[32]; char m_szModel[32];
bool m_bForceShowMenu;
}; };
class CAPI_Bot: public CCSPlayer {}; class CAPI_Bot: public CCSPlayer {};

View File

@ -205,8 +205,8 @@ typedef IVoidHookChainImpl<CBasePlayer *, int, int, BOOL, char *> CReGameHook_Sh
typedef IVoidHookChainRegistryImpl<CBasePlayer *, int, int, BOOL, char *> CReGameHookRegistry_ShowMenu; typedef IVoidHookChainRegistryImpl<CBasePlayer *, int, int, BOOL, char *> CReGameHookRegistry_ShowMenu;
// ShowVGUIMenu hook // ShowVGUIMenu hook
typedef IVoidHookChainImpl<CBasePlayer *, int, int, char *, bool> CReGameHook_ShowVGUIMenu; typedef IVoidHookChainImpl<CBasePlayer *, int, int, char *> CReGameHook_ShowVGUIMenu;
typedef IVoidHookChainRegistryImpl<CBasePlayer *, int, int, char *, bool> CReGameHookRegistry_ShowVGUIMenu; typedef IVoidHookChainRegistryImpl<CBasePlayer *, int, int, char *> CReGameHookRegistry_ShowVGUIMenu;
// CHalfLifeMultiplay::FShouldSwitchWeapon hook // CHalfLifeMultiplay::FShouldSwitchWeapon hook
typedef IHookChainClassImpl<BOOL, class CHalfLifeMultiplay, CBasePlayer *, CBasePlayerItem *> CReGameHook_CSGameRules_FShouldSwitchWeapon; typedef IHookChainClassImpl<BOOL, class CHalfLifeMultiplay, CBasePlayer *, CBasePlayerItem *> CReGameHook_CSGameRules_FShouldSwitchWeapon;

View File

@ -67,6 +67,7 @@ bool CCSPlayer::JoinTeam(TeamName team)
UTIL_ScreenFade(pPlayer, Vector(0, 0, 0), 0.001, 0, 0, FFADE_IN); UTIL_ScreenFade(pPlayer, Vector(0, 0, 0), 0.001, 0, 0, FFADE_IN);
} }
CSGameRules()->CheckWinConditions();
return true; return true;
} }
case CT: case CT:
@ -79,6 +80,10 @@ bool CCSPlayer::JoinTeam(TeamName team)
pPlayer->m_iIgnoreGlobalChat = IGNOREMSG_NONE; pPlayer->m_iIgnoreGlobalChat = IGNOREMSG_NONE;
pPlayer->m_iTeamKills = 0; pPlayer->m_iTeamKills = 0;
if (pPlayer->m_iAccount < int(startmoney.value)) {
pPlayer->m_iAccount = int(startmoney.value);
}
pPlayer->pev->solid = SOLID_NOT; pPlayer->pev->solid = SOLID_NOT;
pPlayer->pev->movetype = MOVETYPE_NOCLIP; pPlayer->pev->movetype = MOVETYPE_NOCLIP;
pPlayer->pev->effects = EF_NODRAW; pPlayer->pev->effects = EF_NODRAW;
@ -122,6 +127,7 @@ bool CCSPlayer::JoinTeam(TeamName team)
pPlayer->m_iTeam = team; pPlayer->m_iTeam = team;
pPlayer->TeamChangeUpdate(); pPlayer->TeamChangeUpdate();
CSGameRules()->CheckWinConditions();
return true; return true;
} }