if a player picks a zombie boss then the kill will count now. also added a capacity allowing some players to play as zombies instead of humans voluntarily

This commit is contained in:
jenz 2025-07-14 20:31:01 +02:00
parent 415b263a04
commit eae6109b87
2 changed files with 46 additions and 5 deletions

View File

@ -17,6 +17,7 @@
"ambientLoopDuration" "60.3"
"bossSound" "ambient/zr/satanic_demona.mp3"
"bossLoopDuration" "155.3"
"MaxPlayersZM" "3"
}
}

View File

@ -1,6 +1,6 @@
#pragma semicolon 1
#define PLUGIN_AUTHOR "jenz, https://steamcommunity.com/id/type_moon/"
#define PLUGIN_VERSION "1.3"
#define PLUGIN_VERSION "1.4"
#define g_dIndexes 128
#define g_dLength 256
#define CSGO_KNOCKBACK_BOOST 251.0
@ -17,7 +17,7 @@
#include <smlib>
//smrpg not letting health be overwritten by zr classes
#tryinclude <smrpg_health>
//#tryinclude <smrpg_health>
#pragma newdecls required
//#pragma dynamic 131072
@ -74,6 +74,7 @@ int g_iHumanCount;
int g_iZombieCount;
int g_iZombieBossIndex[g_dIndexes];
int g_iBossBotCount;
int g_iZMPlayerCapacity;
float g_fKnockBackIndex[g_dIndexes + 1];
float g_fJumpHeightIndex[g_dIndexes + 1];
@ -232,6 +233,28 @@ public Action CheckPlayerTeam(Handle timer, any userid)
return Plugin_Continue;
}
//if somebody selects the zombie team they can be zombies now. but with a limit to how many.
if (GetClientTeam(client) == CS_TEAM_T && g_iClientRespawnCount[client] > 0)
{
int zmPlayers = 0;
for (int i = 1; i < MaxClients; i++)
{
if (IsValidClient(i) && !IsFakeClient(i) && !IsClientSourceTV(i) && GetClientTeam(i) == CS_TEAM_T)
{
zmPlayers++;
}
}
if (g_iZMPlayerCapacity > zmPlayers)
{
g_iClientRespawnCount[client] = 0;
PrintToChat(client, "You voluntarily switched to the zombie team. you cant go back to humans for the rest of the round.");
}
else
{
PrintToChat(client, "%i players are already on the zombie team. Thats the maximum so you cant switch voluntarily.");
}
}
if (g_iClientRespawnCount[client] > 0)
{
ChangeClientTeam(client, CS_TEAM_CT); //default putting humans to CT team
@ -1008,6 +1031,14 @@ public void LoadExtraSettings()
else
g_fBossSoundLoopDuration = 10.0;
}
if (StrContains(l_cLine, "MaxPlayersZM") > -1)
{
ReplaceStrings(l_cLine, "MaxPlayersZM");
if (StringToInt(l_cLine) > 1)
g_iZMPlayerCapacity = StringToInt(l_cLine);
else
g_iZMPlayerCapacity = 1;
}
}
delete l_hFile;
}
@ -1227,9 +1258,9 @@ public void Event_roundStart(Handle event, const char[] name, bool dontBroadcast
{
if (IsValidClient(i) && !IsClientSourceTV(i))
{
g_bClientIsBoss[i] = false; //just to make sure both bots and real players are reset.
if (IsFakeClient(i))
{
g_bClientIsBoss[i] = false;
CreateTimer(0.3, Timer_delayedSelectWaveBasedZM, GetClientUserId(i));
continue;
}
@ -1801,6 +1832,13 @@ public Action SelectWaveBasedZM(int client, int state)
}
}
//checking if a player on zombie team picked a boss skin
if (state == 1 && g_bIsBossRound && !g_bClientIsBoss[client] && g_iZombieBossIndex[g_iClientZMClasses[client]])
{
//lets simply say we keep the original boss bots and any player on zombie team can additionally have the boss skins too.
g_bClientIsBoss[client] = true;
}
//im just getting desperate at this point for fixing the client crash by adding random ass delays.
CreateTimer(0.3, Timer_delayedModelSelection, GetClientUserId(client));
return Plugin_Handled;
@ -1999,10 +2037,12 @@ public Action Timer_SetSpeed(Handle timer, any userid)
// smrpg
//checking if the health perk is used by the player, this basically makes the hp setting in the config useless most of the time.
//but looks like people just anyways will want CT to always have 100 HP.
/*
if (SMRPG_Health_GetClientMaxHealth(client) == 100)
{
SetEntityHealth(client, StringToInt(g_cHealth[g_iSpeedDelayClient[client]][g_iLength]));
}
*/
}
}
return Plugin_Handled;
@ -2114,8 +2154,8 @@ public Action UpdateWaveCount(int client)
}
if (g_bIsBossRound)
{
//we only reduce zombie count if the killed bot had a boss zombie class.
//if the killed bot instead had a zombie class of a minion we do not reduce the zombie count.
//we only reduce zombie count if the killed bot/player had a boss zombie class.
//if the killed bot/player instead had a zombie class of a minion we do not reduce the zombie count.
if (g_bClientIsBoss[client])
{
g_iZMCount--;