From 625e455cd419eac2ef2f73a0b482aa2d8e164152 Mon Sep 17 00:00:00 2001 From: jenz Date: Tue, 30 Jan 2024 21:04:10 +0100 Subject: [PATCH] redid how speed works and enforcing knives more aggresively on zombies --- ZombieRiot/scripting/unloze_zr.sp | 53 +++++++++++++++++++------------ 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/ZombieRiot/scripting/unloze_zr.sp b/ZombieRiot/scripting/unloze_zr.sp index b2446bc6..17414515 100644 --- a/ZombieRiot/scripting/unloze_zr.sp +++ b/ZombieRiot/scripting/unloze_zr.sp @@ -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");