Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Commit

Permalink
Clean pause behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
marqdevx committed Mar 6, 2024
1 parent c0925eb commit b0bb542
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions src/commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,34 +404,32 @@ CON_COMMAND_CHAT(pause, "Request pause")

int iPlayer = player->GetPlayerSlot();

CBasePlayerController* pPlayer = (CBasePlayerController*)g_pEntitySystem->GetBaseEntity((CEntityIndex)(player->GetPlayerSlot() + 1));
match_paused = true;
if(match_paused) {
ClientPrint(player, HUD_PRINTTALK, CHAT_PREFIX" Match already paused");
return;
}

g_pEngineServer2->ServerCommand("mp_pause_match");

ClientPrintAll(HUD_PRINTTALK, CHAT_PREFIX"\4%s \1requested a pause", player->GetPlayerName());

match_paused = true;
ct_ready = false;
t_ready = false;
}

CON_COMMAND_CHAT(unpause, "Request unpause")
{
if(!g_bEnablePause)
if(!g_bEnablePause || !player)
return;

if (!player)
if (!match_paused){
ClientPrint(player, HUD_PRINTTALK, CHAT_PREFIX"Match is not paused yet, type \5 .pause");
return;
}

if(!match_paused)
return;

CBasePlayerController* pPlayer = (CBasePlayerController*)g_pEntitySystem->GetBaseEntity((CEntityIndex)(player->GetPlayerSlot() + 1));

int teamSide = pPlayer->m_iTeamNum();
if( teamSide == CS_TEAM_T && !t_ready){
int teamSide = player->m_iTeamNum();
if(teamSide == CS_TEAM_T && !t_ready){
t_ready = true;
}else if( teamSide == CS_TEAM_CT && !ct_ready){
}else if(teamSide == CS_TEAM_CT && !ct_ready){
ct_ready = true;
}

Expand Down

0 comments on commit b0bb542

Please sign in to comment.