fixed round termination when one zombie and fixed reserve ammo

This commit is contained in:
jenz 2024-01-30 15:06:52 +01:00
parent 552a81ac14
commit c907d9e99f

View File

@ -171,7 +171,7 @@ public Action Timer_CheckIfRestartNeeded(Handle timer, any userid)
if (activePlayers == 1)
{
PrintToChatAll("First Player joining. Restarting the round...");
CS_TerminateRound(4.0, CSRoundEnd_Draw, false);
CS_TerminateRound(4.0, CSRoundEnd_Draw, true);
}
return Plugin_Handled;
}
@ -268,7 +268,7 @@ public Action Cmd_ChangeWave(int client, int args)
{
g_iWave = l_iWave;
PrintToChatAll("Admin %N Changing to Day %i: %s", client, g_iWave, g_cDaysTitles[g_iWave - 1]);
CS_TerminateRound(4.0, CSRoundEnd_Draw, false);
CS_TerminateRound(4.0, CSRoundEnd_Draw, true);
}
else
{
@ -471,7 +471,7 @@ public void ZmarketGetWeapon(int client, int index)
l_iEntity = CreateEntityByName(g_cWeaponEntity[index][g_iLength]);
if (l_iEntity == -1)
{
ReplyToCommand(client, "Error occured");
ReplyToCommand(client, "Error occured. cry to jenz");
return;
}
GetClientAbsOrigin(client, l_fClientPos);
@ -485,6 +485,7 @@ public void ZmarketGetWeapon(int client, int index)
CS_DropWeapon(client, l_iWeapon, false, true);
AcceptEntityInput(l_iWeapon, "Kill");
}
DispatchKeyValueInt(l_iEntity, "ammo", 4500);
TeleportEntity(l_iEntity, l_fClientPos, NULL_VECTOR, NULL_VECTOR);
DispatchSpawn(l_iEntity);
SetEntProp(client, Prop_Send, "m_iAccount", l_iClientCash - g_iWeaponPrice[index]);
@ -1152,7 +1153,7 @@ public void LoadWave(int wave)
{
g_iWave = 1;
PrintToChatAll("Finished last Day! Restarting...");
CS_TerminateRound(5.0, CSRoundEnd_Draw, false);
CS_TerminateRound(5.0, CSRoundEnd_Draw, true);
}
delete kv;
delete l_hFile;
@ -1778,7 +1779,7 @@ public Action UpdateWaveCount(int client)
}
}
PrintToChatAll("All Humans died!");
CS_TerminateRound(4.0, CSRoundEnd_TerroristWin, false);
CS_TerminateRound(4.0, CSRoundEnd_TerroristWin, true);
return Plugin_Handled;
}
else if (GetClientTeam(client) == CS_TEAM_T)
@ -1789,12 +1790,30 @@ public Action UpdateWaveCount(int client)
if (g_iZMCount == 0 && g_bRoundInProgress)
{
PrintToChatAll("Won Round!");
CS_TerminateRound(4.0, CSRoundEnd_CTWin, false);
CS_TerminateRound(4.0, CSRoundEnd_CTWin, true);
g_iWave++;
g_bRoundInProgress = false;
}
return Plugin_Continue;
}
public Action CS_OnTerminateRound(float& delay, CSRoundEndReason& reason)
{
//generally we only want to block round termination when all (or the only) zombies are dead but the count requires that there
//are more left to kill. we wait for the zombie to respawn so we can kill him again until g_iZMCount reaches 0.
if (g_iZMCount > 0)
{
for (int i = 1; i <= MaxClients; i++)
{
if (IsValidClient(i) && IsPlayerAlive(i) && GetClientTeam(i) == CS_TEAM_CT)
{
return Plugin_Handled;
}
}
}
return Plugin_Changed;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------