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

Commit

Permalink
Cleared get slots APis
Browse files Browse the repository at this point in the history
  • Loading branch information
marqdevx committed Feb 29, 2024
1 parent b394af0 commit 5299ef1
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ GAME_EVENT_F(round_announce_last_round_half){

GAME_EVENT_F(round_prestart)
{
if (coaches.Count() < 1 || g_bEnableCoach) return;
if (coaches.Count() < 1 || !g_bEnableCoach) return;

FOR_EACH_VEC(coaches,i){
CCSPlayerController *pTarget = (CCSPlayerController *)g_pEntitySystem->GetBaseEntity((CEntityIndex)(coaches[i]->GetPlayerSlot() + 1));
CCSPlayerController *pTarget = CCSPlayerController::FromSlot(coaches[i]->GetPlayerSlot());

if(!pTarget) return; //avoid crash if coach is not connected
//ClientPrint(pTarget, HUD_PRINTTALK, "coach slot side %i", coaches[i]->m_iTeamNum());

Expand All @@ -113,7 +113,7 @@ GAME_EVENT_F(round_prestart)
pTarget->ChangeTeam(CS_TEAM_SPECTATOR);

//pTarget->GetPawn()->CommitSuicide(false, true);

if(half_last_round && !swapped_teams){
if(currentTeam == CS_TEAM_CT){
newTeam = CS_TEAM_T;
Expand All @@ -123,7 +123,7 @@ GAME_EVENT_F(round_prestart)
}else{
newTeam = currentTeam;
}

CHandle<CCSPlayerController> hController = pTarget->GetHandle();

new CTimer(0.15f, false, [hController, newTeam]()
Expand All @@ -146,9 +146,9 @@ GAME_EVENT_F(round_prestart)
return -1.0f;
});

return -1.0f;
return -0.15f;
});

if(half_last_round) half_last_round = false;
}
}
Expand All @@ -158,7 +158,7 @@ GAME_EVENT_F(round_start)
if (coaches.Count() < 1) return;

FOR_EACH_VEC(coaches,i){
CCSPlayerController *pTarget = (CCSPlayerController *)g_pEntitySystem->GetBaseEntity((CEntityIndex)(coaches[i]->GetPlayerSlot() + 1));
CCSPlayerController *pTarget = CCSPlayerController::FromSlot(coaches[i]->GetPlayerSlot());

coaches[i]->m_pInGameMoneyServices->m_iAccount = 0;

Expand All @@ -176,7 +176,7 @@ GAME_EVENT_F(round_poststart)
if (coaches.Count() < 1 || !g_bEnableCoach) return;

FOR_EACH_VEC(coaches,i){
CCSPlayerController *pTarget = (CCSPlayerController *)g_pEntitySystem->GetBaseEntity((CEntityIndex)(coaches[i]->GetPlayerSlot() + 1));
CCSPlayerController *pTarget = CCSPlayerController::FromSlot(coaches[i]->GetPlayerSlot());

coaches[i]->m_pInGameMoneyServices->m_iAccount = 0;

Expand All @@ -192,8 +192,8 @@ GAME_EVENT_F(round_freeze_end)
if (coaches.Count() < 1 || !g_bEnableCoach) return;

FOR_EACH_VEC(coaches,i){
CCSPlayerController *pTarget = (CCSPlayerController *)g_pEntitySystem->GetBaseEntity((CEntityIndex)(coaches[i]->GetPlayerSlot() + 1));
CCSPlayerController *pTarget = CCSPlayerController::FromSlot(coaches[i]->GetPlayerSlot());

if(!pTarget) return; //avoid crash if coach is not connected

int currentTeam = pTarget->m_iTeamNum;
Expand Down

0 comments on commit 5299ef1

Please sign in to comment.