redid how speed works and enforcing knives more aggresively on zombies

This commit is contained in:
jenz 2024-01-30 21:04:10 +01:00
parent 962d6ce67f
commit 625e455cd4

View File

@ -858,16 +858,35 @@ public Action LoadClasses()
//----------------------------------------------------------------------------------------------------
public void OnMapStart()
{
g_iToolsVelocity = FindDataMapInfo(0, "m_vecAbsVelocity");
g_iWave = 1;
//load content
AddDownloadContent();
LoadClasses();
LoadExtraSettings();
loadWeapons();
CreateTimer(2.0, Timer_CheckIfBotsStuck, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
CreateTimer(g_fZMSounds, Timer_zombieSounds, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
g_iToolsVelocity = FindDataMapInfo(0, "m_vecAbsVelocity");
g_iWave = 1;
//load content
AddDownloadContent();
LoadClasses();
LoadExtraSettings();
loadWeapons();
CreateTimer(2.0, Timer_CheckIfBotsStuck, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
CreateTimer(g_fZMSounds, Timer_zombieSounds, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
CreateTimer(2.0, Timer_FixKNife, INVALID_HANDLE, TIMER_REPEAT);
}
//just checking the knife when they spawn is appereantly not good enough. this is just repeating what Timer_StopProtection does.
public Action Timer_FixKNife(Handle timer, any userid)
{
for (int client = 0; client < MaxClients; client++)
{
if (IsValidClient(client) && IsPlayerAlive(client))
{
if (GetPlayerWeaponSlot(client, CS_SLOT_KNIFE) == -1) //just making sure everybody has a knife. otherwise giving them one
{
GivePlayerItem(client, "weapon_knife");
CreateTimer(1.0, Timer_SwitchKnife, GetClientOfUserId(client));
}
}
}
return Plugin_Handled;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
@ -940,17 +959,6 @@ public void OnClientDisconnect(int client)
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public MRESReturn DHook_GetPlayerMaxSpeed(int client, Handle hReturn)
{
if (client < 1 || client > MaxClients || !IsClientInGame(client) || !IsPlayerAlive(client))
return MRES_Ignored;
DHookSetReturn(hReturn, StringToFloat(g_cSpeed[g_iSpeedIndex[client]][g_iLength]));
return MRES_Override;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void Event_roundStart(Handle event, const char[] name, bool dontBroadcast)
{
g_bRoundInProgress = false;
@ -1584,6 +1592,8 @@ public Action ModelSelection(int client, int state, int modelIndex)
g_bFallDamage[client] = true;
else
g_bFallDamage[client] = false;
//setting the class speed simply.
SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", StringToFloat(g_cSpeed[g_iSpeedIndex[client]][g_iLength]));
if (state < 2)
{
CreateTimer(g_fZMSpawnProtection, Timer_StopProtection, GetClientUserId(client));
@ -1715,9 +1725,10 @@ public Action Timer_StopProtection(Handle timer, any userid)
int client = GetClientOfUserId(userid);
if (client == 0)
return Plugin_Continue;
if (IsValidClient(client))
if (IsValidClient(client) && IsPlayerAlive(client))
{
g_bClientProtection[client] = false;
Client_ChangeWeapon(client, "weapon_knife");
if (GetPlayerWeaponSlot(client, CS_SLOT_KNIFE) == -1) //just making sure everybody has a knife. otherwise giving them one
{
GivePlayerItem(client, "weapon_knife");