fixing scaleability and health. also making scalebility for player a float

This commit is contained in:
jenz 2024-01-28 22:13:34 +01:00
parent 4b01705bba
commit 15e53c7759

View File

@ -42,7 +42,7 @@ char g_cWeaponCommand[g_dIndexes][g_dLength];
int g_iLength = g_dLength - 1; int g_iLength = g_dLength - 1;
int g_iWave; int g_iWave;
int g_iZMScaleability; float g_iZMScaleability;
int g_iZMCount; int g_iZMCount;
int g_iToolsVelocity; //from zombie reloaded int g_iToolsVelocity; //from zombie reloaded
int g_iClientZMClasses[g_dIndexes]; int g_iClientZMClasses[g_dIndexes];
@ -72,11 +72,11 @@ float g_fBotStuckPush;
bool g_bSwitchingIndex; bool g_bSwitchingIndex;
bool g_bRoundInProgress; bool g_bRoundInProgress;
bool g_bShouldBeHuman[g_dIndexes];
bool g_bShouldBeZM[g_dIndexes];
bool g_bFallDamage[g_dIndexes]; bool g_bFallDamage[g_dIndexes];
bool g_bClientProtection[g_dIndexes]; bool g_bClientProtection[g_dIndexes];
bool g_bRestartRound = true;
Handle g_hClientZMCookie; Handle g_hClientZMCookie;
Handle g_hClientHumanCookie; Handle g_hClientHumanCookie;
@ -115,7 +115,6 @@ public void OnPluginStart()
HookEvent("player_spawn", ApplySettings, EventHookMode_Post); HookEvent("player_spawn", ApplySettings, EventHookMode_Post);
HookEvent("round_start", Event_roundStart, EventHookMode_Post); HookEvent("round_start", Event_roundStart, EventHookMode_Post);
HookEvent("player_death", Event_OnPlayerDeath, EventHookMode_Post); HookEvent("player_death", Event_OnPlayerDeath, EventHookMode_Post);
HookEvent("player_connect", Event_OnFullConnect, EventHookMode_Pre);
HookEvent("player_hurt", EventPlayerHurt, EventHookMode_Pre); HookEvent("player_hurt", EventPlayerHurt, EventHookMode_Pre);
HookEvent("player_jump", EventPlayerJump, EventHookMode_Post); HookEvent("player_jump", EventPlayerJump, EventHookMode_Post);
@ -128,12 +127,58 @@ public void OnPluginStart()
RegAdminCmd("sm_human", Cmd_Humanize, ADMFLAG_BAN); RegAdminCmd("sm_human", Cmd_Humanize, ADMFLAG_BAN);
RegAdminCmd("sm_infect", Cmd_Zombienize, ADMFLAG_BAN); RegAdminCmd("sm_infect", Cmd_Zombienize, ADMFLAG_BAN);
} }
public Action ApplySettings(Event event, const char[] name, bool dontBroadcast)
{
int activePlayers = 0;
for (int i = 1; i < MaxClients; i++)
{
if (IsValidClient(i) && !IsFakeClient(i) && (GetClientTeam(i) == CS_TEAM_CT || GetClientTeam(i) == CS_TEAM_T))
{
activePlayers++;
}
if (activePlayers > 1)
{
break;
}
}
if (activePlayers == 1 && g_bRestartRound)
{
PrintToChatAll("First Player joining. Restarting the round...");
g_bRestartRound = false;
CS_TerminateRound(4.0, CSRoundEnd_Draw, false);
}
else if (activePlayers == 0)
{
g_bRestartRound = true;
}
int client = GetClientOfUserId(event.GetInt("userid"));
if (!IsValidClient(client) || !IsPlayerAlive(client) || IsClientSourceTV(client))
{
return Plugin_Handled;
}
if (!IsFakeClient(client) && g_iClientRespawnCount[client] < 1) //player ran out of human respawns and will be zm instead.
{
SelectWaveBasedZM(client, 1);
}
else if (IsFakeClient(client)) //bot getting respawned as zm
{
SelectWaveBasedZM(client, 0);
}
else
{
SelectWavebasedHuman(client); //player getting respawned as human
}
return Plugin_Handled;
}
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
// Purpose: // Purpose:
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
public Action Cmd_LoadManually(int client, int args) public Action Cmd_LoadManually(int client, int args)
{ {
//LoadClasses();
AddDownloadContent(); AddDownloadContent();
return Plugin_Handled; return Plugin_Handled;
} }
@ -265,16 +310,19 @@ public void findTarget(int client, int state)
PrintToChat(client, "Found no specific Target!"); PrintToChat(client, "Found no specific Target!");
return; return;
} }
if (!IsPlayerAlive(targets[0]))
{
PrintToChat(client, "Target is not alive. Cant be turned human or zombie.");
return;
}
if (state == 0) if (state == 0)
{ {
PrintToChat(client, "Humanized: %N", targets[0]); PrintToChat(client, "Humanized: %N", targets[0]);
g_bShouldBeHuman[targets[0]] = true;
SelectWavebasedHuman(targets[0]); SelectWavebasedHuman(targets[0]);
} }
else else
{ {
PrintToChat(client, "Infected: %N", targets[0]); PrintToChat(client, "Infected: %N", targets[0]);
g_bShouldBeZM[targets[0]] = true;
SelectWaveBasedZM(targets[0], 1); SelectWaveBasedZM(targets[0], 1);
} }
} }
@ -519,7 +567,7 @@ public int Zombieclass_Menu(Menu menu, MenuAction action, int client, int select
g_iClientZMClasses[client] = selection + g_iZMBeginindex; g_iClientZMClasses[client] = selection + g_iZMBeginindex;
IntToString(g_iClientZMClasses[client], l_cInfo, sizeof(l_cInfo)); IntToString(g_iClientZMClasses[client], l_cInfo, sizeof(l_cInfo));
SetClientCookie(client, g_hClientZMCookie, l_cInfo); SetClientCookie(client, g_hClientZMCookie, l_cInfo);
if (g_bSwitchingIndex && GetClientTeam(client) == CS_TEAM_T) if (g_bSwitchingIndex && GetClientTeam(client) == CS_TEAM_T && IsPlayerAlive(client)) //beginning of round, is correct team and alive
{ {
SelectWaveBasedZM(client, 1); SelectWaveBasedZM(client, 1);
} }
@ -540,8 +588,9 @@ public int Humanclass_Menu(Menu menu, MenuAction action, int client, int selecti
char l_cInfo[4]; char l_cInfo[4];
IntToString(selection, l_cInfo, sizeof(l_cInfo)); IntToString(selection, l_cInfo, sizeof(l_cInfo));
SetClientCookie(client, g_hClientHumanCookie, l_cInfo); SetClientCookie(client, g_hClientHumanCookie, l_cInfo);
g_iClientHumanClasses[client] = selection; g_iClientHumanClasses[client] = selection;
if (g_bSwitchingIndex && GetClientTeam(client) == CS_TEAM_CT) if (g_bSwitchingIndex && GetClientTeam(client) == CS_TEAM_CT && IsPlayerAlive(client)) //beginning of round, is correct team and alive
{ {
SelectWavebasedHuman(client); SelectWavebasedHuman(client);
} }
@ -768,12 +817,10 @@ public void OnClientPostAdminCheck(int client)
{ {
g_bClientProtection[client] = false; g_bClientProtection[client] = false;
g_bFallDamage[client] = false; g_bFallDamage[client] = false;
g_bShouldBeHuman[client] = false;
g_bShouldBeZM[client] = false;
g_fKnockBackIndex[client] = 1.0; g_fKnockBackIndex[client] = 1.0;
g_fJumpHeightIndex[client] = 1.0; g_fJumpHeightIndex[client] = 1.0;
g_fJumpDistanceIndex[client] = 1.0; g_fJumpDistanceIndex[client] = 1.0;
g_iClientRespawnCount[client] = 0; g_iClientRespawnCount[client] = g_iClientRespawnCountNum;
char sCookieValue[12]; char sCookieValue[12];
GetClientCookie(client, g_hClientZMCookie, sCookieValue, sizeof(sCookieValue)); GetClientCookie(client, g_hClientZMCookie, sCookieValue, sizeof(sCookieValue));
if (sCookieValue[0]) if (sCookieValue[0])
@ -794,6 +841,7 @@ public void OnClientPostAdminCheck(int client)
g_iClientHumanClasses[client] = 0; g_iClientHumanClasses[client] = 0;
} }
SetAdminGroups(client); SetAdminGroups(client);
SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
// Purpose: // Purpose:
@ -816,8 +864,6 @@ public void OnClientDisconnect(int client)
{ {
g_bClientProtection[client] = false; g_bClientProtection[client] = false;
g_bFallDamage[client] = false; g_bFallDamage[client] = false;
g_bShouldBeHuman[client] = false;
g_bShouldBeZM[client] = false;
g_fKnockBackIndex[client] = 1.0; g_fKnockBackIndex[client] = 1.0;
g_fJumpHeightIndex[client] = 1.0; g_fJumpHeightIndex[client] = 1.0;
g_fJumpDistanceIndex[client] = 1.0; g_fJumpDistanceIndex[client] = 1.0;
@ -840,11 +886,11 @@ public MRESReturn DHook_GetPlayerMaxSpeed(int client, Handle hReturn)
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
public void Event_roundStart(Handle event, const char[] name, bool dontBroadcast) public void Event_roundStart(Handle event, const char[] name, bool dontBroadcast)
{ {
int l_iHumanPlayers;
g_bRoundInProgress = false; g_bRoundInProgress = false;
g_bSwitchingIndex = true; g_bSwitchingIndex = true;
CreateTimer(g_fSwitchingTimer, Timer_switchingModel, INVALID_HANDLE); CreateTimer(g_fSwitchingTimer, Timer_switchingModel, INVALID_HANDLE);
RetrieveWaveSettings(g_iWave); RetrieveWaveSettings(g_iWave);
for (int i = 1; i <= MaxClients; i++) for (int i = 1; i <= MaxClients; i++)
{ {
if (IsValidClient(i) && !IsClientSourceTV(i)) if (IsValidClient(i) && !IsClientSourceTV(i))
@ -852,12 +898,12 @@ public void Event_roundStart(Handle event, const char[] name, bool dontBroadcast
if (IsFakeClient(i)) if (IsFakeClient(i))
{ {
SelectWaveBasedZM(i, 0); SelectWaveBasedZM(i, 0);
continue;
} }
else if (GetClientTeam(i) > CS_TEAM_SPECTATOR) g_iClientRespawnCount[i] = g_iClientRespawnCountNum; //even if not spawned in yet it should be set for every real player.
if (IsPlayerAlive(i))
{ {
g_iClientRespawnCount[i] = g_iClientRespawnCountNum;
SelectWavebasedHuman(i); SelectWavebasedHuman(i);
l_iHumanPlayers++;
} }
} }
} }
@ -912,13 +958,26 @@ public void LoadWave(int wave)
if (kv.JumpToKey(l_cJumptokey, false)) if (kv.JumpToKey(l_cJumptokey, false))
{ {
g_bRoundInProgress = true; g_bRoundInProgress = true;
g_iZMScaleability = kv.GetNum("PlayerScaleAbility", 5); g_iZMScaleability = kv.GetFloat("PlayerScaleAbility", 5.0);
g_fZMHealthScaleability = kv.GetFloat("HealthScaleAbility", 1.0); g_fZMHealthScaleability = kv.GetFloat("HealthScaleAbility", 1.0);
g_iZMCount = kv.GetNum("Zombie Count", 5); g_iZMCount = kv.GetNum("Zombie Count", 5);
if (g_iZMScaleability > 0)
int additional_zombie_per_player = RoundFloat(g_iZMCount * g_iZMScaleability);
int l_iPlayers;
for (int i = 1; i <= MaxClients; i++)
{ {
g_iZMCount *= g_iZMScaleability; if (IsValidClient(i) && !IsFakeClient(i) && CS_TEAM_CT == GetClientTeam(i))
{
l_iPlayers++;
} }
}
l_iPlayers -= 1; //first player equals the zombie count.
//first player takes the zombie count, each additional player adds to additional_zombie_per_player
//if 1 player then additional_zombie_per_player * 0. so just g_iZMCount
g_iZMCount += additional_zombie_per_player * l_iPlayers;
g_iClientRespawnCountNum = kv.GetNum("Respawns", 5); g_iClientRespawnCountNum = kv.GetNum("Respawns", 5);
l_iBotQuote = kv.GetNum("bot_scaling", 1); l_iBotQuote = kv.GetNum("bot_scaling", 1);
SettingBotQoute(l_iBotQuote); SettingBotQoute(l_iBotQuote);
@ -1086,13 +1145,11 @@ public void SettingBotQoute(int botscale)
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
public void addBots(int botcount) public void addBots(int botcount)
{ {
//ServerCommand("bot_kick"); if (botcount > 44)
for (int i = 0; i < botcount; i++)
{ {
if (i > 44) //probably will be turned into a convar somewhen. botcount = 44;
continue;
ServerCommand("bot_add_t");
} }
ServerCommand("bot_quota %i", botcount);
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
// Purpose: // Purpose:
@ -1157,10 +1214,10 @@ public void CreateDefaultWave()
} }
KeyValues kv = CreateKeyValues("Waves"); KeyValues kv = CreateKeyValues("Waves");
kv.JumpToKey("Wave 1", true); kv.JumpToKey("Wave 1", true);
g_iZMScaleability = 5; g_iZMScaleability = 5.0;
g_fZMHealthScaleability = 1.0; g_fZMHealthScaleability = 1.0;
g_iZMCount = 2; g_iZMCount = 2;
kv.SetNum("PlayerScaleAbility", g_iZMScaleability); kv.SetFloat("PlayerScaleAbility", g_iZMScaleability);
kv.SetFloat("HealthScaleAbility", g_fZMHealthScaleability); kv.SetFloat("HealthScaleAbility", g_fZMHealthScaleability);
kv.SetNum("Zombie Count", g_iZMCount); //creates 10 zombies per player kv.SetNum("Zombie Count", g_iZMCount); //creates 10 zombies per player
kv.SetNum("Respawns", 5); kv.SetNum("Respawns", 5);
@ -1322,95 +1379,18 @@ public void ReadingClassValuesFromFile(int index, char[] Line)
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
// Purpose: // Purpose:
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
public Action Event_OnFullConnect(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(GetEventInt(event, "userid"));
if (!client || !IsClientInGame(client))
return Plugin_Continue;
for (int i = 1; i <= MaxClients; i++)
{
if (IsValidClient(i) && IsPlayerAlive(i) && GetClientTeam(i) == CS_TEAM_CT)
{
ChangeClientTeam(client, CS_TEAM_T);
if (!IsPlayerAlive(client))
CS_RespawnPlayer(client);
else
ApplySettingsEvent(client);
return Plugin_Continue;
}
}
ChangeClientTeam(client, CS_TEAM_CT);
ServerCommand("mp_restartgame 1");
return Plugin_Continue;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action ApplySettings(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));
ApplySettingsEvent(client);
return Plugin_Handled;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action ApplySettingsEvent(int client)
{
if (!IsValidClient(client))
return Plugin_Handled;
if (g_bShouldBeHuman[client])
{
SelectWavebasedHuman(client);
g_bShouldBeHuman[client] = false;
}
else if (g_bShouldBeZM[client])
{
SelectWaveBasedZM(client, 1);
g_bShouldBeZM[client] = false;
}
else if (IsFakeClient(client))
{
SelectWaveBasedZM(client, 0);
}
else if (g_iClientRespawnCount[client] > 0)
{
SelectWavebasedHuman(client);
}
else
{
SelectWaveBasedZM(client, 1);
}
return Plugin_Continue;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public bool shouldApplySettings(int client, int team, int teamDest)
{
if (team != teamDest)
{
ChangeClientTeam(client, teamDest);
if (!IsPlayerAlive(client))
CS_RespawnPlayer(client);
else
ApplySettingsEvent(client);
return false;
}
return true;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action SelectWavebasedHuman(int client) public Action SelectWavebasedHuman(int client)
{ {
if (!IsValidClient(client)) if (!IsValidClient(client))
return Plugin_Handled; return Plugin_Handled;
int l_iTeam = GetClientTeam(client);
if (shouldApplySettings(client, l_iTeam, CS_TEAM_CT)) if (GetClientTeam(client) == CS_TEAM_T)
{ {
ModelSelection(client, 2, g_iClientHumanClasses[client]); ChangeClientTeam(client, CS_TEAM_CT); //default putting humans to CT team
CS_RespawnPlayer(client); //respawning because changeclientteam kills the player on css
} }
ModelSelection(client, 2, g_iClientHumanClasses[client]);
return Plugin_Continue; return Plugin_Continue;
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
@ -1420,11 +1400,18 @@ public Action SelectWaveBasedZM(int client, int state)
{ {
if (!IsValidClient(client)) if (!IsValidClient(client))
return Plugin_Handled; return Plugin_Handled;
int l_iTeam = GetClientTeam(client);
if (GetClientTeam(client) == CS_TEAM_CT)
{
ChangeClientTeam(client, CS_TEAM_T); //default putting bots to t
CS_RespawnPlayer(client); //respawning because changeclientteam kills the player on css
}
//state 0 was bot, state 1 was real player.
if (!IsValidClient(client))
return Plugin_Handled;
int l_iZMIndex; int l_iZMIndex;
int l_ibotIndex; int l_ibotIndex;
if (shouldApplySettings(client, l_iTeam, CS_TEAM_T))
{
if (state == 0) if (state == 0)
{ {
for (int i = 0; i < g_dIndexes; i++) for (int i = 0; i < g_dIndexes; i++)
@ -1461,8 +1448,7 @@ public Action SelectWaveBasedZM(int client, int state)
} }
} }
} }
ModelSelection(client, state, g_iClientZMClasses[client]); ModelSelection(client, 1, g_iClientZMClasses[client]);
}
return Plugin_Handled; return Plugin_Handled;
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
@ -1470,7 +1456,7 @@ public Action SelectWaveBasedZM(int client, int state)
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
public Action ModelSelection(int client, int state, int modelIndex) public Action ModelSelection(int client, int state, int modelIndex)
{ {
//state 0 = zombie bots, state 1 = zombie players, state 2 = human players //state 1 = zombie players, state 2 = human players
char l_cUniqueModel[g_dLength]; char l_cUniqueModel[g_dLength];
int l_iModelIndex; int l_iModelIndex;
l_iModelIndex = modelIndex; l_iModelIndex = modelIndex;
@ -1482,6 +1468,8 @@ public Action ModelSelection(int client, int state, int modelIndex)
{ {
Format(l_cUniqueModel, sizeof(l_cUniqueModel), g_cHumanClasses[l_iModelIndex][g_iLength]); Format(l_cUniqueModel, sizeof(l_cUniqueModel), g_cHumanClasses[l_iModelIndex][g_iLength]);
} }
for (int i = 0; i < g_dIndexes; i++) for (int i = 0; i < g_dIndexes; i++)
{ {
if (strlen(g_cUniqueName[i][g_iLength]) < 1) if (strlen(g_cUniqueName[i][g_iLength]) < 1)
@ -1493,13 +1481,13 @@ public Action ModelSelection(int client, int state, int modelIndex)
if (StrContains(g_cModelPath[i][g_iLength], "mdl") == -1) if (StrContains(g_cModelPath[i][g_iLength], "mdl") == -1)
{ {
//incorrect modelpaths crash at SetEntityModel //incorrect modelpaths crash at SetEntityModel
LoadClasses(); //LoadClasses();
ForcePlayerSuicide(client); //ForcePlayerSuicide(client);
return Plugin_Continue; return Plugin_Continue;
} }
SetEntityModel(client, g_cModelPath[i][g_iLength]); SetEntityModel(client, g_cModelPath[i][g_iLength]);
SDKUnhook(client, SDKHook_OnTakeDamage, OnTakeDamage);
SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
g_bClientProtection[client] = true; g_bClientProtection[client] = true;
if (StrContains(g_cNoFallDmg[i][g_iLength], "YES") > -1) if (StrContains(g_cNoFallDmg[i][g_iLength], "YES") > -1)
g_bFallDamage[client] = true; g_bFallDamage[client] = true;
@ -1508,15 +1496,27 @@ public Action ModelSelection(int client, int state, int modelIndex)
if (state < 2) if (state < 2)
{ {
CreateTimer(g_fZMSpawnProtection, Timer_StopProtection, client); CreateTimer(g_fZMSpawnProtection, Timer_StopProtection, client);
Client_SetActiveWeapon(client, GetPlayerWeaponSlot(client, 2)); //Client_SetActiveWeapon(client, GetPlayerWeaponSlot(client, 2));
} }
else else
{ {
CreateTimer(g_fHumanSpawnProtection, Timer_StopProtection, client); CreateTimer(g_fHumanSpawnProtection, Timer_StopProtection, client);
Client_SetActiveWeapon(client, GetPlayerWeaponSlot(client, 1)); //Client_SetActiveWeapon(client, GetPlayerWeaponSlot(client, 1));
}
if (state < 2) //setting the zombie health here using the HealthScaleAbility.
{
int l_iPlayers;
for (int j = 1; j <= MaxClients; j++)
{
if (IsValidClient(j) && !IsFakeClient(j) && CS_TEAM_CT == GetClientTeam(j))
{
l_iPlayers++;
}
}
l_iPlayers -= 1; //first player indicates the full health of the class, each additional uses scaleability health.
int additional_zombie_health_per_player = RoundFloat(g_fZMHealthScaleability * StringToInt(g_cHealth[i][g_iLength]));
SetEntityHealth(client, StringToInt(g_cHealth[i][g_iLength]) + (additional_zombie_health_per_player * l_iPlayers));
} }
if (state < 2 && RoundFloat(g_fZMHealthScaleability * 10.0) > 0.0)
SetEntityHealth(client, StringToInt(g_cHealth[i][g_iLength]) * RoundFloat(g_fZMHealthScaleability * 10.0) / 10);
else else
SetEntityHealth(client, StringToInt(g_cHealth[i][g_iLength])); SetEntityHealth(client, StringToInt(g_cHealth[i][g_iLength]));
g_iSpeedIndex[client] = i; g_iSpeedIndex[client] = i;
@ -1625,14 +1625,15 @@ public Action Timer_Respawn(Handle timer, any userid)
if (client == 0) if (client == 0)
return Plugin_Continue; return Plugin_Continue;
if (!IsValidClient(client) || IsPlayerAlive(client) || GetClientTeam(client) <= CS_TEAM_SPECTATOR) if (!IsValidClient(client) || IsPlayerAlive(client) || (GetClientTeam(client) != CS_TEAM_T && GetClientTeam(client) != CS_TEAM_CT))
{ {
return Plugin_Continue; return Plugin_Continue;
} }
UpdateWaveCount(client); UpdateWaveCount(client);
if (!IsFakeClient(client) && g_iClientRespawnCount[client] < 1) if (!IsFakeClient(client) && g_iClientRespawnCount[client] < 1)
{ {
ChangeClientTeam(client, CS_TEAM_T); ChangeClientTeam(client, CS_TEAM_T); //ran out of respawns for CT
} }
else if (IsFakeClient(client) && GetClientTeam(client) != CS_TEAM_T) else if (IsFakeClient(client) && GetClientTeam(client) != CS_TEAM_T)
{ {
@ -1640,7 +1641,7 @@ public Action Timer_Respawn(Handle timer, any userid)
} }
else if (!IsFakeClient(client) && GetClientTeam(client) != CS_TEAM_CT) else if (!IsFakeClient(client) && GetClientTeam(client) != CS_TEAM_CT)
{ {
ChangeClientTeam(client, CS_TEAM_CT); ChangeClientTeam(client, CS_TEAM_CT); //default putting humans to CT team
} }
CS_RespawnPlayer(client); CS_RespawnPlayer(client);
return Plugin_Continue; return Plugin_Continue;
@ -1669,6 +1670,14 @@ public Action Event_OnPlayerDeath(Handle event, const char[] name, bool dontBroa
} }
else else
{ {
if (g_iClientRespawnCount[client] > 0)
{
PrintToChat(client, "You have %i respawns left as human. You will respawn in %f seconds.", g_iClientRespawnCount[client], g_fRespawnTimer);
}
else
{
PrintToChat(client, "You will respawn as a zombie in %f seconds.", g_fRespawnTimer);
}
CreateTimer(g_fRespawnTimer, Timer_Respawn, GetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE); CreateTimer(g_fRespawnTimer, Timer_Respawn, GetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE);
} }
return Plugin_Continue; return Plugin_Continue;
@ -1679,7 +1688,6 @@ public Action Event_OnPlayerDeath(Handle event, const char[] name, bool dontBroa
public Action UpdateWaveCount(int client) public Action UpdateWaveCount(int client)
{ {
//PrintToChatAll("Player %N died", client); //PrintToChatAll("Player %N died", client);
char l_cCount[g_dIndexes];
if (GetClientTeam(client) == CS_TEAM_CT) if (GetClientTeam(client) == CS_TEAM_CT)
{ {
g_iClientRespawnCount[client]--; g_iClientRespawnCount[client]--;
@ -1697,7 +1705,10 @@ public Action UpdateWaveCount(int client)
else if (GetClientTeam(client) == CS_TEAM_T) else if (GetClientTeam(client) == CS_TEAM_T)
{ {
g_iZMCount--; g_iZMCount--;
SetHudTextParams(-0.5, 0.8, 10.0, 255, 0, 255, 255, 1, 0.1, 0.1, 0.1); //not using hudtext anymore
/*
char l_cCount[g_dIndexes];
SetHudTextParams(-0.4, 0.8, 10.0, 255, 0, 255, 255, 1, 0.1, 0.1, 0.1);
for (int i = 1; i <= MaxClients; i++) for (int i = 1; i <= MaxClients; i++)
{ {
if (IsValidClient(i) && !IsFakeClient(i)) if (IsValidClient(i) && !IsFakeClient(i))
@ -1706,6 +1717,8 @@ public Action UpdateWaveCount(int client)
ShowHudText(i, 3, l_cCount); ShowHudText(i, 3, l_cCount);
} }
} }
*/
PrintHintTextToAll("Remaining Zombies: %i", g_iZMCount);
} }
if (g_iZMCount == 0 && g_bRoundInProgress) if (g_iZMCount == 0 && g_bRoundInProgress)
{ {