From ab530bb6f122eaba2c71db415fedc7cb590bc80d Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Sun, 14 Feb 2021 02:42:32 +0200 Subject: [PATCH 01/37] updated README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b05c6a6..3bcbdf2 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ ### Zombie Panic Mod for Counter-Strike 1.6 -__Version:__ 1.0.0 +__Version:__ 1.1.0 ### Download latest: - [Releases](../../releases) From a0e123a9e9949798685ce46fab94555eca46722e Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Tue, 16 Feb 2021 04:17:20 +0200 Subject: [PATCH 02/37] fixed function names --- src/scripts/core/zp_knockback.sma | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/scripts/core/zp_knockback.sma b/src/scripts/core/zp_knockback.sma index f8efb97..f4ca79b 100644 --- a/src/scripts/core/zp_knockback.sma +++ b/src/scripts/core/zp_knockback.sma @@ -14,14 +14,14 @@ new Float:g_rgflPlayerVelocity[MAX_PLAYERS + 1][3]; public plugin_init() { register_plugin(PLUGIN, ZP_VERSION, AUTHOR); - RegisterHam(Ham_TakeDamage, "player", "OnPlayerTraceAttack", .Post = 0); - RegisterHam(Ham_TakeDamage, "player", "OnPlayerTraceAttack_Post", .Post = 1); + RegisterHam(Ham_TakeDamage, "player", "OnPlayerTakeDamage", .Post = 0); + RegisterHam(Ham_TakeDamage, "player", "OnPlayerTakeDamage_Post", .Post = 1); } -public OnPlayerTraceAttack(pPlayer) { +public OnPlayerTakeDamage(pPlayer) { pev(pPlayer, pev_velocity, g_rgflPlayerVelocity[pPlayer]); } -public OnPlayerTraceAttack_Post(pPlayer) { +public OnPlayerTakeDamage_Post(pPlayer) { set_pev(pPlayer, pev_velocity, g_rgflPlayerVelocity[pPlayer]); // reset knockback } From fa43bd10699d07e3fe9c37389b9e7ab486c163a3 Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Tue, 16 Feb 2021 05:09:45 +0200 Subject: [PATCH 03/37] added crowbar knockback + reduced damage --- src/include/zombiepanic_utils.inc | 25 +++++++++++++++++++++++ src/scripts/weapons/zp_weapon_crowbar.sma | 20 +++++++++++++++++- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/src/include/zombiepanic_utils.inc b/src/include/zombiepanic_utils.inc index b423fce..02b76b9 100644 --- a/src/include/zombiepanic_utils.inc +++ b/src/include/zombiepanic_utils.inc @@ -143,3 +143,28 @@ stock bool:UTIL_IsPlayerSpectator(pPlayer) { new iTeam = get_member(pPlayer, m_iTeam); return iTeam < 1 || iTeam > 2; } + +stock UTIL_PlayerKnockback(pVictim, pAttacker, Float:flForce = 250.0) { + static Float:vecOrigin[3]; + pev(pVictim, pev_origin, vecOrigin); + + static Float:vecAttackerOrigin[3]; + pev(pAttacker, pev_origin, vecAttackerOrigin); + + static Float:vecDir[3]; + xs_vec_sub(vecOrigin, vecAttackerOrigin, vecDir); + + static Float:vecKnockback[3]; + + new Float:flLen = xs_vec_len_2d(vecDir); + for (new i = 0; i < 2; ++i) { + vecKnockback[i] = (vecDir[i] / flLen) * flForce; + } + + vecKnockback[2] = 0.0; + + static Float:vecVelocity[3]; + pev(pVictim, pev_velocity, vecVelocity); + xs_vec_add(vecVelocity, vecKnockback, vecVelocity); + set_pev(pVictim, pev_velocity, vecVelocity); +} diff --git a/src/scripts/weapons/zp_weapon_crowbar.sma b/src/scripts/weapons/zp_weapon_crowbar.sma index ce35fc1..c897b21 100644 --- a/src/scripts/weapons/zp_weapon_crowbar.sma +++ b/src/scripts/weapons/zp_weapon_crowbar.sma @@ -5,6 +5,7 @@ #include #include #include +#include #include @@ -48,6 +49,8 @@ public plugin_precache() { public plugin_init() { register_plugin(PLUGIN, ZP_VERSION, AUTHOR); + + RegisterHam(Ham_TakeDamage, "player", "OnPlayerTakeDamage_Post", .Post = 1); } public @Weapon_Idle(this) { @@ -66,7 +69,7 @@ public @Weapon_Idle(this) { public @Weapon_PrimaryAttack(this) { new pPlayer = CW_GetPlayer(this); - new pHit = CW_DefaultSwing(this, 35.0, 0.5, 38.0); + new pHit = CW_DefaultSwing(this, 25.0, 0.5, 38.0); CW_PlayAnimation(this, 4, 0.25); if (pHit < 0) { @@ -120,3 +123,18 @@ public @Weapon_WeaponBoxSpawn(this, pWeaponBox) { public @Weapon_CanDrop(this) { return PLUGIN_HANDLED; } + +public OnPlayerTakeDamage_Post(this, pInflictor, pAttacker) { + if (!UTIL_IsPlayer(pAttacker)) { + return HAM_IGNORED; + } + + new pAttackerActiveItem = get_member(pAttacker, m_pActiveItem); + if (CW_GetHandlerByEntity(pAttackerActiveItem) != g_iCwHandler) { + return HAM_IGNORED; + } + + UTIL_PlayerKnockback(this, pAttacker, 250.0); + + return HAM_HANDLED; +} From 582dc1d6757e39ed791b7a1222a756b5a3ef3b72 Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Tue, 16 Feb 2021 05:11:58 +0200 Subject: [PATCH 04/37] fixed external fade handling --- src/scripts/core/zp_zombie_vision.sma | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/scripts/core/zp_zombie_vision.sma b/src/scripts/core/zp_zombie_vision.sma index 3e61199..0dadbc3 100644 --- a/src/scripts/core/zp_zombie_vision.sma +++ b/src/scripts/core/zp_zombie_vision.sma @@ -154,17 +154,17 @@ public OnMessage_ScreenFade(iMsgId, iMsgDest, pPlayer) { return PLUGIN_CONTINUE; } - new Float:flHoldTime = float(get_msg_arg_int(2)) / (1<<12); - if (flHoldTime > 0.0) { + new Float:flDuration = (float(get_msg_arg_int(1)) / (1<<12)) + (float(get_msg_arg_int(2)) / (1<<12)); + if (flDuration > 0.0) { if (pPlayer > 0) { - HandleExternalFade(pPlayer, flHoldTime); + HandleExternalFade(pPlayer, flDuration); } else { for (new pTargetPlayer = 1; pTargetPlayer <= MaxClients; ++pTargetPlayer) { if (!is_user_connected(pTargetPlayer)) { continue; } - HandleExternalFade(pTargetPlayer, flHoldTime); + HandleExternalFade(pTargetPlayer, flDuration); } } } From fc3c699d393b4f3208facf5c77f18925c63a9352 Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Tue, 16 Feb 2021 05:12:10 +0200 Subject: [PATCH 05/37] added blink infect on transformation --- src/scripts/core/zp_infection.sma | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/scripts/core/zp_infection.sma b/src/scripts/core/zp_infection.sma index 98c6fdc..b00d3f7 100644 --- a/src/scripts/core/zp_infection.sma +++ b/src/scripts/core/zp_infection.sma @@ -12,7 +12,7 @@ #define PLUGIN "[Zombie Panic] Infection" #define AUTHOR "Hedgehog Fog" -#define TRANSFORMATION_DELAY 60.0 +#define TRANSFORMATION_DELAY 15.0 #define TRANSFORMATION_DURATION 7.0 #define INFECTION_ICON "dmg_bio" @@ -69,6 +69,12 @@ public plugin_init() { g_pFwInfected = CreateMultiForward("ZP_Fw_PlayerInfected", ET_IGNORE, FP_CELL, FP_CELL); g_pFwTransformationDeath = CreateMultiForward("ZP_Fw_PlayerTransformationDeath", ET_IGNORE, FP_CELL); g_pFwTransformed = CreateMultiForward("ZP_Fw_PlayerTransformed", ET_IGNORE, FP_CELL); + + register_clcmd("infectme", "infectme"); +} + +public infectme(pPlayer) { + SetInfected(pPlayer, true); } public plugin_natives() { @@ -125,6 +131,7 @@ public OnPlayerPreThink_Post(pPlayer) { } EndPlayerTransformation(pPlayer); + SendBlinkEffect(pPlayer); } } else if (flTimeLeft <= TRANSFORMATION_DURATION) { if (!is_user_alive(pPlayer)) { From b46734a0a2de8d03db238ebe5b552ff0d9912552 Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Sat, 20 Feb 2021 17:02:30 +0200 Subject: [PATCH 06/37] fixed kill icons for melee weapons --- src/scripts/api/api_custom_weapons.sma | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/scripts/api/api_custom_weapons.sma b/src/scripts/api/api_custom_weapons.sma index 2594214..0303b3a 100644 --- a/src/scripts/api/api_custom_weapons.sma +++ b/src/scripts/api/api_custom_weapons.sma @@ -568,7 +568,11 @@ public OnPlayerPreThink_Post(pPlayer) { } public OnPlayerTakeDamage(pPlayer, pInflictor, pAttacker) { - g_pKillerItem = pInflictor; + if (pInflictor == pAttacker) { + g_pKillerItem = get_member(pAttacker, m_pActiveItem); + } else { + g_pKillerItem = pInflictor; + } } public OnPlayerTakeDamage_Post() { From 19e10e7feb5a94d42f72a3332c33956d7af0695c Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Sat, 20 Feb 2021 17:07:11 +0200 Subject: [PATCH 07/37] fixed auto zombie vision --- src/scripts/core/zp_zombie_vision.sma | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/scripts/core/zp_zombie_vision.sma b/src/scripts/core/zp_zombie_vision.sma index 0dadbc3..8e5a916 100644 --- a/src/scripts/core/zp_zombie_vision.sma +++ b/src/scripts/core/zp_zombie_vision.sma @@ -12,6 +12,7 @@ #define AUTHOR "Hedgehog Fog" #define TASKID_FIX_FADE 100 +#define TASKID_ACTIVATE_VISION 200 #define VISION_SCREEN_FADE_COLOR 255, 195, 195 #define VISION_EFFECT_TIME 0.5 @@ -77,7 +78,7 @@ public OnPlayerSpawn(pPlayer) { } if (get_pcvar_num(g_pCvarAuto) > 0) { - SetZombieVision(pPlayer, true); + set_task(0.1, "Task_ActivateVision", TASKID_ACTIVATE_VISION + pPlayer); } return HAM_HANDLED; @@ -85,6 +86,7 @@ public OnPlayerSpawn(pPlayer) { public OnPlayerKilled(pPlayer) { SetZombieVision(pPlayer, false); + remove_task(TASKID_ACTIVATE_VISION + pPlayer); if (!ZP_Player_IsZombie(pPlayer)) { return HAM_IGNORED; @@ -222,3 +224,9 @@ public Task_FixVisionScreenFade(iTaskId) { g_bPlayerExternalFade[pPlayer] = false; } + +public Task_ActivateVision(iTaskId) { + new pPlayer = iTaskId - TASKID_ACTIVATE_VISION; + + SetZombieVision(pPlayer, true); +} From 1b303acf9ebbf8822a082232dbf79bd3862b607b Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Sat, 20 Feb 2021 17:11:39 +0200 Subject: [PATCH 08/37] fixed condition --- src/scripts/api/api_custom_weapons.sma | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/scripts/api/api_custom_weapons.sma b/src/scripts/api/api_custom_weapons.sma index 0303b3a..58ce64f 100644 --- a/src/scripts/api/api_custom_weapons.sma +++ b/src/scripts/api/api_custom_weapons.sma @@ -568,7 +568,7 @@ public OnPlayerPreThink_Post(pPlayer) { } public OnPlayerTakeDamage(pPlayer, pInflictor, pAttacker) { - if (pInflictor == pAttacker) { + if (pAttacker && ExecuteHam(Ham_IsPlayer, pAttacker) && pInflictor == pAttacker) { g_pKillerItem = get_member(pAttacker, m_pActiveItem); } else { g_pKillerItem = pInflictor; @@ -598,16 +598,22 @@ public OnMessage_DeathMsg(iMsgId, iDest, pPlayer) { } new CW:iHandler = GetHandlerByEntity(g_pKillerItem); + log_amx("iHandler %d", iHandler); if (iHandler == CW_INVALID_HANDLER) { return PLUGIN_CONTINUE; } static szIcon[64]; GetStringData(iHandler, CW_Data_Icon, szIcon, charsmax(szIcon)); + + log_amx("CW_Data_Icon %s", szIcon); + if (szIcon[0] == '^0') { GetStringData(iHandler, CW_Data_Name, szIcon, charsmax(szIcon)); } + log_amx("szIcon %s", szIcon); + set_msg_arg_string(4, szIcon); return PLUGIN_CONTINUE; @@ -1362,6 +1368,7 @@ DefaultSwing(this, Float:flDamage, Float:flRate, Float:flDistance) { // ANCHOR: Weapon Methods CW:RegisterWeapon(iPluginId, const szName[], iWeaponId, iClipSize, iPrimaryAmmoType, iPrimaryAmmoMaxAmount, iSecondaryAmmoType, iSecondaryAmmoMaxAmount, iSlotId, iPosition, iWeaponFlags, const szIcon[], CW_Flags:iFlags) { + log_amx("szIcon %s", szIcon); new CW:iHandler = CreateWeaponData(szName); SetData(iHandler, CW_Data_PluginId, iPluginId); SetStringData(iHandler, CW_Data_Name, szName); From 595fc8929b9faea33aa35482aebe0eeb1c410b3d Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Sat, 20 Feb 2021 17:12:38 +0200 Subject: [PATCH 09/37] blocked respawn on round end --- src/scripts/core/zp_zombie_lives.sma | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/scripts/core/zp_zombie_lives.sma b/src/scripts/core/zp_zombie_lives.sma index d22a234..e6009a3 100644 --- a/src/scripts/core/zp_zombie_lives.sma +++ b/src/scripts/core/zp_zombie_lives.sma @@ -80,6 +80,10 @@ RespawnPlayer(pPlayer) { return; } + if (Round_IsRoundEnd()) { + return; + } + if (!is_user_connected(pPlayer)) { return; } From 64557b24a80a65c6ab1e969caa7ab3e87e176c5f Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Sat, 20 Feb 2021 17:20:28 +0200 Subject: [PATCH 10/37] added multiple zombies selection --- src/scripts/core/zp_gamerules.sma | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/scripts/core/zp_gamerules.sma b/src/scripts/core/zp_gamerules.sma index 512c8de..7c85d1e 100644 --- a/src/scripts/core/zp_gamerules.sma +++ b/src/scripts/core/zp_gamerules.sma @@ -17,6 +17,7 @@ #define CHOOSE_TEAM_VGUI_MENU_ID 2 #define CHOOSE_TEAM1_CLASS_VGUI_MENU_ID 26 #define CHOOSE_TEAM2_CLASS_VGUI_MENU_ID 27 +#define PLAYERS_PER_ZOMBIE 6 enum TeamPreference { TeamPreference_Human, @@ -223,10 +224,15 @@ DistributeTeams() { log_amx("Respawned %d zombies", iZombieCount); } - if (!iZombieCount) { + new iRequiredZombieCount = floatround(float(pPlayerCount) / PLAYERS_PER_ZOMBIE, floatround_ceil); + if (iZombieCount < iRequiredZombieCount) { if (pPlayerCount > 1) { log_amx("No one has chosen play zombie, a random player will be moved to the zombie team..."); - ChooseRandomZombie(); + + new iCount = iRequiredZombieCount - iZombieCount; + for (new i = 0; i < iCount; ++i) { + ChooseRandomZombie(); + } } else { log_amx("Not enough players to start"); } From dab2350f3e655ac61ecabc6eb7ff89a41c64456b Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Sat, 20 Feb 2021 17:35:24 +0200 Subject: [PATCH 11/37] zombie lives are now calculated based on players count --- assets/addons/amxmodx/configs/zombiepanic.cfg | 3 +- src/scripts/core/zp_gamerules.sma | 48 +++++++++++++------ 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/assets/addons/amxmodx/configs/zombiepanic.cfg b/assets/addons/amxmodx/configs/zombiepanic.cfg index 9440cb1..fb79c2d 100644 --- a/assets/addons/amxmodx/configs/zombiepanic.cfg +++ b/assets/addons/amxmodx/configs/zombiepanic.cfg @@ -12,7 +12,8 @@ zp_flashlight_consumption_rate 0.5 zp_flashlight_recovery_rate 0.5 // [Zombie Panic] Gamerules -zp_zombie_lives 20 +zp_zombie_lives -1 +zp_zombie_lives_per_player 2 // [Zombie Panic] Infection zp_infection_chance 10 diff --git a/src/scripts/core/zp_gamerules.sma b/src/scripts/core/zp_gamerules.sma index 7c85d1e..21a1c50 100644 --- a/src/scripts/core/zp_gamerules.sma +++ b/src/scripts/core/zp_gamerules.sma @@ -26,6 +26,7 @@ enum TeamPreference { } new g_pCvarLives; +new g_pCvarLivesPerPlayer; new g_pFwPlayerJoined; new g_pFwResult; @@ -54,7 +55,8 @@ public plugin_init() { register_clcmd("joinclass", "OnPlayerChangeTeam"); register_clcmd("drop", "OnClCmd_Drop"); - g_pCvarLives = register_cvar("zp_zombie_lives", "20"); + g_pCvarLives = register_cvar("zp_zombie_lives", "-1"); + g_pCvarLivesPerPlayer = register_cvar("zp_zombie_lives_per_player", "2"); g_pFwPlayerJoined = CreateMultiForward("ZP_Fw_PlayerJoined", ET_IGNORE, FP_CELL); @@ -104,9 +106,34 @@ public Round_Fw_NewRound() { } public Round_Fw_RoundStart() { - ZP_GameRules_SetZombieLives(ZP_GameRules_GetObjectiveMode() ? 255 : get_pcvar_num(g_pCvarLives)); DistributeTeams(); + + if (ZP_GameRules_GetObjectiveMode()) { + ZP_GameRules_SetZombieLives(255); + } else { + new iLives = get_pcvar_num(g_pCvarLives); + if (iLives == -1) { + iLives = CalculatePlayerCount(ZP_HUMAN_TEAM) * get_pcvar_num(g_pCvarLivesPerPlayer); + } + + ZP_GameRules_SetZombieLives(iLives); + } + + + for (new pPlayer = 1; pPlayer <= MaxClients; ++pPlayer) { + if (!is_user_connected(pPlayer)) { + continue; + } + + if (UTIL_IsPlayerSpectator(pPlayer)) { + continue; + } + + ExecuteHamB(Ham_CS_RoundRespawn, pPlayer); + } + CheckWinConditions(); + log_amx("New round started"); } @@ -237,18 +264,7 @@ DistributeTeams() { log_amx("Not enough players to start"); } } - - for (new pPlayer = 1; pPlayer <= MaxClients; ++pPlayer) { - if (!is_user_connected(pPlayer)) { - continue; - } - if (UTIL_IsPlayerSpectator(pPlayer)) { - continue; - } - - ExecuteHamB(Ham_CS_RoundRespawn, pPlayer); - } } ProcessZombiePlayers(iMaxZombies) { @@ -305,7 +321,7 @@ ChooseRandomZombie() { log_amx("Player ^"%n^" was randomly moved to the zombie team", pPlayer); } -CalculatePlayerCount() { +CalculatePlayerCount(iTeam = -1) { new pPlayerCount = 0; for (new pPlayer = 1; pPlayer <= MaxClients; ++pPlayer) { @@ -317,6 +333,10 @@ CalculatePlayerCount() { continue; } + if (iTeam != -1 && iTeam != get_member(pPlayer, m_iTeam)) { + continue; + } + pPlayerCount++; } From d74b70c0575e0de6c98c64fbb3d6a377a0441a16 Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Sat, 20 Feb 2021 18:02:31 +0200 Subject: [PATCH 12/37] fixed knockback conditions --- src/scripts/weapons/zp_weapon_crowbar.sma | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/scripts/weapons/zp_weapon_crowbar.sma b/src/scripts/weapons/zp_weapon_crowbar.sma index c897b21..2b627b6 100644 --- a/src/scripts/weapons/zp_weapon_crowbar.sma +++ b/src/scripts/weapons/zp_weapon_crowbar.sma @@ -129,6 +129,10 @@ public OnPlayerTakeDamage_Post(this, pInflictor, pAttacker) { return HAM_IGNORED; } + if (!rg_is_player_can_takedamage(this, pAttacker)) { + return HAM_IGNORED; + } + new pAttackerActiveItem = get_member(pAttacker, m_pActiveItem); if (CW_GetHandlerByEntity(pAttackerActiveItem) != g_iCwHandler) { return HAM_IGNORED; From 2771117e35e7dbc986b9af2931c7c6768626509f Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Sat, 20 Feb 2021 22:38:52 +0200 Subject: [PATCH 13/37] fixed knockback conditions --- src/scripts/weapons/zp_weapon_crowbar.sma | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/scripts/weapons/zp_weapon_crowbar.sma b/src/scripts/weapons/zp_weapon_crowbar.sma index 2b627b6..019bcc3 100644 --- a/src/scripts/weapons/zp_weapon_crowbar.sma +++ b/src/scripts/weapons/zp_weapon_crowbar.sma @@ -133,8 +133,12 @@ public OnPlayerTakeDamage_Post(this, pInflictor, pAttacker) { return HAM_IGNORED; } - new pAttackerActiveItem = get_member(pAttacker, m_pActiveItem); - if (CW_GetHandlerByEntity(pAttackerActiveItem) != g_iCwHandler) { + new pItem = pInflictor == pAttacker ? get_member(pAttacker, m_pActiveItem) : pInflictor; + if (pItem <= 0) { + return HAM_IGNORED; + } + + if (CW_GetHandlerByEntity(pItem) != g_iCwHandler) { return HAM_IGNORED; } From a34a607596b63af530d9c7bdcfb084f29194f582 Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Sat, 20 Feb 2021 23:56:46 +0200 Subject: [PATCH 14/37] removed dev cmd --- src/scripts/core/zp_infection.sma | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/scripts/core/zp_infection.sma b/src/scripts/core/zp_infection.sma index b00d3f7..d5c427b 100644 --- a/src/scripts/core/zp_infection.sma +++ b/src/scripts/core/zp_infection.sma @@ -69,12 +69,6 @@ public plugin_init() { g_pFwInfected = CreateMultiForward("ZP_Fw_PlayerInfected", ET_IGNORE, FP_CELL, FP_CELL); g_pFwTransformationDeath = CreateMultiForward("ZP_Fw_PlayerTransformationDeath", ET_IGNORE, FP_CELL); g_pFwTransformed = CreateMultiForward("ZP_Fw_PlayerTransformed", ET_IGNORE, FP_CELL); - - register_clcmd("infectme", "infectme"); -} - -public infectme(pPlayer) { - SetInfected(pPlayer, true); } public plugin_natives() { From 63282687ac120e061af8cfd1028d545ec7f670b3 Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Sun, 21 Feb 2021 00:05:44 +0200 Subject: [PATCH 15/37] fixed infection time --- src/scripts/core/zp_infection.sma | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/core/zp_infection.sma b/src/scripts/core/zp_infection.sma index d5c427b..ed7d98d 100644 --- a/src/scripts/core/zp_infection.sma +++ b/src/scripts/core/zp_infection.sma @@ -12,7 +12,7 @@ #define PLUGIN "[Zombie Panic] Infection" #define AUTHOR "Hedgehog Fog" -#define TRANSFORMATION_DELAY 15.0 +#define TRANSFORMATION_DELAY 60.0 #define TRANSFORMATION_DURATION 7.0 #define INFECTION_ICON "dmg_bio" From b4b410a89ca424ae8ce8267dae5b5179995ef9fe Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Mon, 22 Feb 2021 15:51:15 +0200 Subject: [PATCH 16/37] added holster animation --- src/scripts/weapons/zp_weapon_357.sma | 5 +++++ src/scripts/weapons/zp_weapon_556ar.sma | 5 +++++ src/scripts/weapons/zp_weapon_9mmhandgun.sma | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/src/scripts/weapons/zp_weapon_357.sma b/src/scripts/weapons/zp_weapon_357.sma index 3f74bec..2d4c299 100644 --- a/src/scripts/weapons/zp_weapon_357.sma +++ b/src/scripts/weapons/zp_weapon_357.sma @@ -38,6 +38,7 @@ public plugin_precache() { CW_Bind(g_iCwHandler, CWB_GetMaxSpeed, "@Weapon_GetMaxSpeed"); CW_Bind(g_iCwHandler, CWB_Spawn, "@Weapon_Spawn"); CW_Bind(g_iCwHandler, CWB_WeaponBoxModelUpdate, "@Weapon_WeaponBoxSpawn"); + CW_Bind(g_iCwHandler, CWB_Holster, "@Weapon_Holster"); ZP_Weapons_Register(g_iCwHandler, ZP_WEIGHT_MAGNUM); } @@ -105,6 +106,10 @@ public @Weapon_WeaponBoxSpawn(this, pWeaponBox) { engfunc(EngFunc_SetModel, pWeaponBox, ZP_WEAPON_MAGNUM_W_MODEL); } +public @Weapon_Holster(this) { + CW_PlayAnimation(this, 4, 16.0 / 30.0); +} + public Task_EjectBrass(iTaskId) { new pItem = iTaskId - TASKID_EJECT_BRASS; diff --git a/src/scripts/weapons/zp_weapon_556ar.sma b/src/scripts/weapons/zp_weapon_556ar.sma index 420750b..16b1586 100644 --- a/src/scripts/weapons/zp_weapon_556ar.sma +++ b/src/scripts/weapons/zp_weapon_556ar.sma @@ -38,6 +38,7 @@ public plugin_precache() { CW_Bind(g_iCwHandler, CWB_GetMaxSpeed, "@Weapon_GetMaxSpeed"); CW_Bind(g_iCwHandler, CWB_Spawn, "@Weapon_Spawn"); CW_Bind(g_iCwHandler, CWB_WeaponBoxModelUpdate, "@Weapon_WeaponBoxSpawn"); + CW_Bind(g_iCwHandler, CWB_Holster, "@Weapon_Holster"); ZP_Weapons_Register(g_iCwHandler, ZP_WEIGHT_RIFLE); } @@ -105,3 +106,7 @@ public @Weapon_Spawn(this) { public @Weapon_WeaponBoxSpawn(this, pWeaponBox) { engfunc(EngFunc_SetModel, pWeaponBox, ZP_WEAPON_RIFLE_W_MODEL); } + +public @Weapon_Holster(this) { + CW_PlayAnimation(this, 8, 12.0 / 30.0); +} diff --git a/src/scripts/weapons/zp_weapon_9mmhandgun.sma b/src/scripts/weapons/zp_weapon_9mmhandgun.sma index f78f771..c438659 100644 --- a/src/scripts/weapons/zp_weapon_9mmhandgun.sma +++ b/src/scripts/weapons/zp_weapon_9mmhandgun.sma @@ -35,6 +35,7 @@ public plugin_precache() { CW_Bind(g_iCwHandler, CWB_GetMaxSpeed, "@Weapon_GetMaxSpeed"); CW_Bind(g_iCwHandler, CWB_Spawn, "@Weapon_Spawn"); CW_Bind(g_iCwHandler, CWB_WeaponBoxModelUpdate, "@Weapon_WeaponBoxSpawn"); + CW_Bind(g_iCwHandler, CWB_Holster, "@Weapon_Holster"); ZP_Weapons_Register(g_iCwHandler, ZP_WEIGHT_PISTOL); } @@ -109,3 +110,7 @@ public @Weapon_Spawn(this) { public @Weapon_WeaponBoxSpawn(this, pWeaponBox) { engfunc(EngFunc_SetModel, pWeaponBox, ZP_WEAPON_PISTOL_W_MODEL); } + +public @Weapon_Holster(this) { + CW_PlayAnimation(this, 8, 16.0 / 20.0); +} From a7c469d8d970e127e6756d7e391549764ed865be Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Mon, 22 Feb 2021 23:33:38 +0200 Subject: [PATCH 17/37] fixed crosshair --- src/scripts/hud/zp_hud_crosshair.sma | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/scripts/hud/zp_hud_crosshair.sma b/src/scripts/hud/zp_hud_crosshair.sma index be6e4e0..b9e5635 100644 --- a/src/scripts/hud/zp_hud_crosshair.sma +++ b/src/scripts/hud/zp_hud_crosshair.sma @@ -23,7 +23,8 @@ public plugin_init() { gmsgCurWeapon = get_user_msgid("CurWeapon"); register_message(gmsgHideWeapon, "OnMessage_HideWeapon"); - + + register_event("HideWeapon", "OnEvent_HideWeapon", "be", "1=1"); register_event("CurWeapon", "OnEvent_CurWeapon", "be", "1=1"); } @@ -34,7 +35,15 @@ public OnMessage_HideWeapon(iMsgId, iMsgDest, pPlayer) { g_iPlayerHideWeapon[pPlayer] = get_msg_arg_int(1); - set_task(0.1, "Task_UpdateCrosshair", pPlayer); + return PLUGIN_CONTINUE; +} + +public OnEvent_HideWeapon(pPlayer) { + if (is_user_bot(pPlayer)) { + return PLUGIN_CONTINUE; + } + + UpdateCrosshair(pPlayer); return PLUGIN_CONTINUE; } @@ -44,15 +53,14 @@ public OnEvent_CurWeapon(pPlayer) { return PLUGIN_CONTINUE; } - set_task(0.1, "Task_UpdateCrosshair", pPlayer); + UpdateCrosshair(pPlayer); return PLUGIN_CONTINUE; } UpdateCrosshair(pPlayer) { - emessage_begin(MSG_ONE, gmsgHideWeapon, _, pPlayer); - ewrite_byte(g_iPlayerHideWeapon[pPlayer] | HIDEHUD_CROSSHAIR | BIT(7)); + ewrite_byte(g_iPlayerHideWeapon[pPlayer] | HIDEHUD_CROSSHAIR | HIDEHUD_OBSERVER_CROSSHAIR); emessage_end(); message_begin(MSG_ONE, gmsgSetFOV, _, pPlayer); @@ -75,9 +83,3 @@ UpdateCrosshair(pPlayer) { write_byte(get_member(pPlayer, m_iFOV)); message_end(); } - -public Task_UpdateCrosshair(iTaskId) { - new pPlayer = iTaskId; - - UpdateCrosshair(pPlayer); -} From e06074334838db1c39c4335eaa451581000e74b1 Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Tue, 23 Feb 2021 00:50:21 +0200 Subject: [PATCH 18/37] improved flashlight --- src/scripts/core/zp_flashlight.sma | 31 ++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/scripts/core/zp_flashlight.sma b/src/scripts/core/zp_flashlight.sma index 78ad4d0..60fe3c5 100644 --- a/src/scripts/core/zp_flashlight.sma +++ b/src/scripts/core/zp_flashlight.sma @@ -15,12 +15,12 @@ #define TASKID_FLASHLIGHT_HUD 100 -#define FLASHLIGHT_CHARGE_MAX 100.0 -#define FLASHLIGHT_CHARGE_DEF FLASHLIGHT_CHARGE_MAX +#define FLASHLIGHT_MAX_BRIGHTNESS 160.0 #define FLASHLIGHT_RATE 0.025 -#define FLASHLIGHT_MAX_DISTANCE 1024.0 +#define FLASHLIGHT_MAX_DISTANCE 768.0 #define FLASHLIGHT_MAX_CHARGE 100.0 #define FLASHLIGHT_MIN_CHARGE 0.0 +#define FLASHLIGHT_DEF_CHARGE FLASHLIGHT_MAX_CHARGE #define FLASHLIGHT_MIN_CHARGE_TO_ACTIVATE 10.0 enum PlayerFlashlight { @@ -74,7 +74,7 @@ public OnPlayerSpawn_Post(pPlayer) { } SetPlayerFlashlight(pPlayer, false); - g_rgPlayerFlashlight[pPlayer][PlayerFlashlight_Charge] = FLASHLIGHT_CHARGE_DEF; + g_rgPlayerFlashlight[pPlayer][PlayerFlashlight_Charge] = FLASHLIGHT_DEF_CHARGE; set_pev(pPlayer, pev_framerate, 1.0); return HAM_HANDLED; @@ -223,17 +223,20 @@ CreatePlayerFlashlightLight(pPlayer) { new Float:flDistance = get_distance_f(vecStart, vecEnd); if (flDistance <= FLASHLIGHT_MAX_DISTANCE) { // TODO: Remove this hardcoded shit - new Float:flRadius = 4.0 + (flDistance / 64.0); - new Float:flBrightness = floatmax(255.0 - flDistance / 4.0, 0.0); - - new iColor[3]; - for (new i = 0; i < 3; ++i) { - iColor[i] = floatround(flBrightness); + new Float:flDistanceRatio = (flDistance / FLASHLIGHT_MAX_DISTANCE); + new Float:flBrightness = FLASHLIGHT_MAX_BRIGHTNESS * (1.0 - flDistanceRatio); + if (flBrightness > 1.0) { + new iColor[3]; + for (new i = 0; i < 3; ++i) { + iColor[i] = floatround(flBrightness); + } + + new Float:flRadius = 4.0 + (16.0 * flDistanceRatio); + new iLifeTime = max(1, floatround(FLASHLIGHT_RATE * 10)); + new iDecayRate = 10 / iLifeTime; + + UTIL_Message_Dlight(vecEnd, floatround(flRadius), iColor, iLifeTime, iDecayRate); } - - new iLifeTime = max(1, floatround(FLASHLIGHT_RATE * 10)); - new iDecayRate = 10 / iLifeTime; - UTIL_Message_Dlight(vecEnd, floatround(flRadius), iColor, iLifeTime, iDecayRate); } } From 61e852f92796ac77c30b0cbccdf2725b8a56de9a Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Tue, 23 Feb 2021 01:19:59 +0200 Subject: [PATCH 19/37] removed debug messages --- src/scripts/api/api_custom_weapons.sma | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/scripts/api/api_custom_weapons.sma b/src/scripts/api/api_custom_weapons.sma index 58ce64f..c944ed8 100644 --- a/src/scripts/api/api_custom_weapons.sma +++ b/src/scripts/api/api_custom_weapons.sma @@ -598,7 +598,6 @@ public OnMessage_DeathMsg(iMsgId, iDest, pPlayer) { } new CW:iHandler = GetHandlerByEntity(g_pKillerItem); - log_amx("iHandler %d", iHandler); if (iHandler == CW_INVALID_HANDLER) { return PLUGIN_CONTINUE; } @@ -606,13 +605,10 @@ public OnMessage_DeathMsg(iMsgId, iDest, pPlayer) { static szIcon[64]; GetStringData(iHandler, CW_Data_Icon, szIcon, charsmax(szIcon)); - log_amx("CW_Data_Icon %s", szIcon); - if (szIcon[0] == '^0') { GetStringData(iHandler, CW_Data_Name, szIcon, charsmax(szIcon)); } - log_amx("szIcon %s", szIcon); set_msg_arg_string(4, szIcon); From 9c76381e588c1e6e9afd466baffd7b3ad353e43a Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Tue, 23 Feb 2021 03:16:42 +0200 Subject: [PATCH 20/37] fixed crashes due to weapon icons --- src/scripts/weapons/zp_weapon_crowbar.sma | 2 +- src/scripts/weapons/zp_weapon_handgrenade.sma | 2 +- src/scripts/weapons/zp_weapon_satchel.sma | 2 +- src/scripts/weapons/zp_weapon_swipe.sma | 3 +-- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/scripts/weapons/zp_weapon_crowbar.sma b/src/scripts/weapons/zp_weapon_crowbar.sma index 019bcc3..4ccf93a 100644 --- a/src/scripts/weapons/zp_weapon_crowbar.sma +++ b/src/scripts/weapons/zp_weapon_crowbar.sma @@ -34,7 +34,7 @@ public plugin_precache() { precache_sound(ZP_WEAPON_CROWBAR_HITBODY_SOUNDS[i]); } - g_iCwHandler = CW_Register(ZP_WEAPON_CROWBAR, CSW_KNIFE, WEAPON_NOCLIP, _, _, _, _, 2, 1, _, _, CWF_NoBulletSmoke); + g_iCwHandler = CW_Register(ZP_WEAPON_CROWBAR, CSW_KNIFE, WEAPON_NOCLIP, _, _, _, _, 2, 1, _, "crowbar", CWF_NoBulletSmoke); CW_Bind(g_iCwHandler, CWB_Idle, "@Weapon_Idle"); CW_Bind(g_iCwHandler, CWB_PrimaryAttack, "@Weapon_PrimaryAttack"); CW_Bind(g_iCwHandler, CWB_SecondaryAttack, "@Weapon_SecondaryAttack"); diff --git a/src/scripts/weapons/zp_weapon_handgrenade.sma b/src/scripts/weapons/zp_weapon_handgrenade.sma index b8dad92..2643c64 100644 --- a/src/scripts/weapons/zp_weapon_handgrenade.sma +++ b/src/scripts/weapons/zp_weapon_handgrenade.sma @@ -35,7 +35,7 @@ public plugin_precache() { } g_iAmmoId = ZP_Ammo_GetId(ZP_Ammo_GetHandler("grenade")); - g_iCwHandler = CW_Register(ZP_WEAPON_GRENADE, CSW_HEGRENADE, WEAPON_NOCLIP, g_iAmmoId, -1, 0, -1, 3, 6); + g_iCwHandler = CW_Register(ZP_WEAPON_GRENADE, CSW_HEGRENADE, WEAPON_NOCLIP, g_iAmmoId, -1, 0, -1, 3, 6, _, "handgrenade"); CW_Bind(g_iCwHandler, CWB_Idle, "@Weapon_Idle"); CW_Bind(g_iCwHandler, CWB_PrimaryAttack, "@Weapon_PrimaryAttack"); CW_Bind(g_iCwHandler, CWB_Deploy, "@Weapon_Deploy"); diff --git a/src/scripts/weapons/zp_weapon_satchel.sma b/src/scripts/weapons/zp_weapon_satchel.sma index e6cfc21..fcfdba9 100644 --- a/src/scripts/weapons/zp_weapon_satchel.sma +++ b/src/scripts/weapons/zp_weapon_satchel.sma @@ -46,7 +46,7 @@ public plugin_precache() { g_iAmmoId = ZP_Ammo_GetId(ZP_Ammo_GetHandler("satchel")); - g_iCwHandler = CW_Register(ZP_WEAPON_SATCHEL, CSW_C4, WEAPON_NOCLIP, g_iAmmoId, -1, 0, -1, 4, 5); + g_iCwHandler = CW_Register(ZP_WEAPON_SATCHEL, CSW_C4, WEAPON_NOCLIP, g_iAmmoId, -1, 0, -1, 4, 5, _, "satchel"); CW_Bind(g_iCwHandler, CWB_Idle, "@Weapon_Idle"); CW_Bind(g_iCwHandler, CWB_PrimaryAttack, "@Weapon_PrimaryAttack"); CW_Bind(g_iCwHandler, CWB_SecondaryAttack, "@Weapon_SecondaryAttack"); diff --git a/src/scripts/weapons/zp_weapon_swipe.sma b/src/scripts/weapons/zp_weapon_swipe.sma index a11c28b..b86c619 100644 --- a/src/scripts/weapons/zp_weapon_swipe.sma +++ b/src/scripts/weapons/zp_weapon_swipe.sma @@ -12,7 +12,6 @@ #define PLUGIN "[Zombie Panic] Weapon Crowbar" #define AUTHOR "Hedgehog Fog" -#define SWIPE_MODEL "swipe.mdl" #define PRIMARY_AMMO_ID 13 new CW:g_iCwHandler; @@ -29,7 +28,7 @@ public plugin_precache() { precache_sound(ZP_WEAPON_SWIPE_HIT_SOUNDS[i]); } - g_iCwHandler = CW_Register(ZP_WEAPON_SWIPE, CSW_KNIFE, WEAPON_NOCLIP, PRIMARY_AMMO_ID, -1, _, _, 2, 1, _, _, CWF_NoBulletDecal); + g_iCwHandler = CW_Register(ZP_WEAPON_SWIPE, CSW_KNIFE, WEAPON_NOCLIP, PRIMARY_AMMO_ID, _, _, _, 2, 1, _, "swipe", CWF_NoBulletDecal); CW_Bind(g_iCwHandler, CWB_Idle, "@Weapon_Idle"); CW_Bind(g_iCwHandler, CWB_PrimaryAttack, "@Weapon_PrimaryAttack"); CW_Bind(g_iCwHandler, CWB_SecondaryAttack, "@Weapon_SecondaryAttack"); From 8aa4bd5201a4562ad65a0d721ef333939a31a580 Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Tue, 23 Feb 2021 03:51:31 +0200 Subject: [PATCH 21/37] fixed pump --- src/scripts/api/api_custom_weapons.sma | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/scripts/api/api_custom_weapons.sma b/src/scripts/api/api_custom_weapons.sma index c944ed8..19a800c 100644 --- a/src/scripts/api/api_custom_weapons.sma +++ b/src/scripts/api/api_custom_weapons.sma @@ -742,16 +742,16 @@ ItemPostFrame(this) { new iPrimaryAmmoAmount = get_member(pPlayer, m_rgAmmo, iPrimaryAmmoIndex); new iSecondaryAmmoAmount = get_member(pPlayer, m_rgAmmo, iSecondaryAmmoIndex); - if (flInReload && flNextAttack <= 0.0) { - CompleteReload(this); - } - new Float:flReloadEndTime = get_member(this, m_Weapon_flNextReload); if (flReloadEndTime && flReloadEndTime < get_gametime()) { set_member(this, m_Weapon_flNextReload, 0.0); ExecuteBindedFunction(CWB_Pump, this); } + if (flInReload && flNextAttack <= 0.0) { + CompleteReload(this); + } + if ((button & IN_ATTACK2) && flNextSecondaryAttack <= 0) { if (iSecondaryAmmoIndex > 0 && !iSecondaryAmmoAmount) { set_member(this, m_Weapon_fFireOnEmpty, 1); @@ -828,6 +828,7 @@ WeaponHolster(this) { SetWeaponPrediction(pPlayer, true); set_member(this, m_Weapon_fInReload, 0); set_member(this, m_Weapon_fInSpecialReload, 0); + set_member(this, m_Weapon_flNextReload, 0.0); if (ExecuteBindedFunction(CWB_Holster, this) > PLUGIN_CONTINUE) { return; From 488183da544724698ea7f46a543301d2e279c329 Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Tue, 23 Feb 2021 03:52:36 +0200 Subject: [PATCH 22/37] fixed brass ejection --- src/scripts/weapons/zp_weapon_357.sma | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/scripts/weapons/zp_weapon_357.sma b/src/scripts/weapons/zp_weapon_357.sma index 2d4c299..6c87484 100644 --- a/src/scripts/weapons/zp_weapon_357.sma +++ b/src/scripts/weapons/zp_weapon_357.sma @@ -39,6 +39,7 @@ public plugin_precache() { CW_Bind(g_iCwHandler, CWB_Spawn, "@Weapon_Spawn"); CW_Bind(g_iCwHandler, CWB_WeaponBoxModelUpdate, "@Weapon_WeaponBoxSpawn"); CW_Bind(g_iCwHandler, CWB_Holster, "@Weapon_Holster"); + CW_Bind(g_iCwHandler, CWB_Pump, "@Weapon_Pump"); ZP_Weapons_Register(g_iCwHandler, ZP_WEIGHT_MAGNUM); } @@ -86,7 +87,7 @@ public @Weapon_PrimaryAttack(this) { public @Weapon_Reload(this) { if (CW_DefaultReload(this, 3, 2.5)) { - set_task(0.75, "Task_EjectBrass", TASKID_EJECT_BRASS + this); + set_member(this, m_Weapon_flNextReload, get_gametime() + 0.75); } } @@ -110,15 +111,9 @@ public @Weapon_Holster(this) { CW_PlayAnimation(this, 4, 16.0 / 30.0); } -public Task_EjectBrass(iTaskId) { - new pItem = iTaskId - TASKID_EJECT_BRASS; - - if (!pev_valid(pItem)) { - return; - } - - new pPlayer = CW_GetPlayer(pItem); - new iClip = get_member(pItem, m_Weapon_iClip); +public @Weapon_Pump(this) { + new pPlayer = CW_GetPlayer(this); + new iClip = get_member(this, m_Weapon_iClip); new iModelIndex = engfunc(EngFunc_ModelIndex, "models/shell.mdl"); static Float:vecOrigin[3]; From ed976548a2458479210f60b41d7077385a804774 Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Tue, 23 Feb 2021 04:04:10 +0200 Subject: [PATCH 23/37] removed debug messages --- src/scripts/api/api_custom_weapons.sma | 1 - 1 file changed, 1 deletion(-) diff --git a/src/scripts/api/api_custom_weapons.sma b/src/scripts/api/api_custom_weapons.sma index 19a800c..8284a10 100644 --- a/src/scripts/api/api_custom_weapons.sma +++ b/src/scripts/api/api_custom_weapons.sma @@ -1365,7 +1365,6 @@ DefaultSwing(this, Float:flDamage, Float:flRate, Float:flDistance) { // ANCHOR: Weapon Methods CW:RegisterWeapon(iPluginId, const szName[], iWeaponId, iClipSize, iPrimaryAmmoType, iPrimaryAmmoMaxAmount, iSecondaryAmmoType, iSecondaryAmmoMaxAmount, iSlotId, iPosition, iWeaponFlags, const szIcon[], CW_Flags:iFlags) { - log_amx("szIcon %s", szIcon); new CW:iHandler = CreateWeaponData(szName); SetData(iHandler, CW_Data_PluginId, iPluginId); SetStringData(iHandler, CW_Data_Name, szName); From c3e5e23606f339e1f591f510f15cc56a265f8de1 Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Tue, 23 Feb 2021 04:05:07 +0200 Subject: [PATCH 24/37] reduced knockback --- src/scripts/weapons/zp_weapon_crowbar.sma | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/weapons/zp_weapon_crowbar.sma b/src/scripts/weapons/zp_weapon_crowbar.sma index 4ccf93a..bc1a1eb 100644 --- a/src/scripts/weapons/zp_weapon_crowbar.sma +++ b/src/scripts/weapons/zp_weapon_crowbar.sma @@ -142,7 +142,7 @@ public OnPlayerTakeDamage_Post(this, pInflictor, pAttacker) { return HAM_IGNORED; } - UTIL_PlayerKnockback(this, pAttacker, 250.0); + UTIL_PlayerKnockback(this, pAttacker, 200.0); return HAM_HANDLED; } From e3cdf9f1fd1bb3b42ee1f4a9f1adcb7ef4e1915f Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Tue, 23 Feb 2021 04:10:58 +0200 Subject: [PATCH 25/37] improved zombie lives setup --- assets/addons/amxmodx/configs/zombiepanic.cfg | 2 +- src/scripts/core/zp_gamerules.sma | 44 +++++++++---------- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/assets/addons/amxmodx/configs/zombiepanic.cfg b/assets/addons/amxmodx/configs/zombiepanic.cfg index fb79c2d..4f3eaae 100644 --- a/assets/addons/amxmodx/configs/zombiepanic.cfg +++ b/assets/addons/amxmodx/configs/zombiepanic.cfg @@ -12,7 +12,7 @@ zp_flashlight_consumption_rate 0.5 zp_flashlight_recovery_rate 0.5 // [Zombie Panic] Gamerules -zp_zombie_lives -1 +zp_zombie_lives 0 zp_zombie_lives_per_player 2 // [Zombie Panic] Infection diff --git a/src/scripts/core/zp_gamerules.sma b/src/scripts/core/zp_gamerules.sma index 21a1c50..ef1f192 100644 --- a/src/scripts/core/zp_gamerules.sma +++ b/src/scripts/core/zp_gamerules.sma @@ -55,7 +55,7 @@ public plugin_init() { register_clcmd("joinclass", "OnPlayerChangeTeam"); register_clcmd("drop", "OnClCmd_Drop"); - g_pCvarLives = register_cvar("zp_zombie_lives", "-1"); + g_pCvarLives = register_cvar("zp_zombie_lives", "0"); g_pCvarLivesPerPlayer = register_cvar("zp_zombie_lives_per_player", "2"); g_pFwPlayerJoined = CreateMultiForward("ZP_Fw_PlayerJoined", ET_IGNORE, FP_CELL); @@ -108,30 +108,14 @@ public Round_Fw_NewRound() { public Round_Fw_RoundStart() { DistributeTeams(); - if (ZP_GameRules_GetObjectiveMode()) { - ZP_GameRules_SetZombieLives(255); - } else { - new iLives = get_pcvar_num(g_pCvarLives); - if (iLives == -1) { - iLives = CalculatePlayerCount(ZP_HUMAN_TEAM) * get_pcvar_num(g_pCvarLivesPerPlayer); - } - - ZP_GameRules_SetZombieLives(iLives); - } + new iHumanCount = CalculatePlayerCount(ZP_HUMAN_TEAM); + new iLives = ZP_GameRules_GetObjectiveMode() + ? 255 + : get_pcvar_num(g_pCvarLives) + (iHumanCount * get_pcvar_num(g_pCvarLivesPerPlayer)); + ZP_GameRules_SetZombieLives(iLives); - for (new pPlayer = 1; pPlayer <= MaxClients; ++pPlayer) { - if (!is_user_connected(pPlayer)) { - continue; - } - - if (UTIL_IsPlayerSpectator(pPlayer)) { - continue; - } - - ExecuteHamB(Ham_CS_RoundRespawn, pPlayer); - } - + RespawnPlayers(); CheckWinConditions(); log_amx("New round started"); @@ -415,6 +399,20 @@ ShuffleTeams() { ArrayDestroy(irgPlayers); } +RespawnPlayers() { + for (new pPlayer = 1; pPlayer <= MaxClients; ++pPlayer) { + if (!is_user_connected(pPlayer)) { + continue; + } + + if (UTIL_IsPlayerSpectator(pPlayer)) { + continue; + } + + ExecuteHamB(Ham_CS_RoundRespawn, pPlayer); + } +} + DispatchWin(iTeam) { Round_DispatchWin(iTeam, ZP_NEW_ROUND_DELAY); } From ffdf167edbdcf1cb9bba65207f2363c0461d6db8 Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Tue, 23 Feb 2021 04:33:45 +0200 Subject: [PATCH 26/37] fixed knockback util --- src/include/zombiepanic_utils.inc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/include/zombiepanic_utils.inc b/src/include/zombiepanic_utils.inc index 02b76b9..0f2888e 100644 --- a/src/include/zombiepanic_utils.inc +++ b/src/include/zombiepanic_utils.inc @@ -144,7 +144,7 @@ stock bool:UTIL_IsPlayerSpectator(pPlayer) { return iTeam < 1 || iTeam > 2; } -stock UTIL_PlayerKnockback(pVictim, pAttacker, Float:flForce = 250.0) { +stock UTIL_PlayerKnockback(pVictim, pAttacker, Float:flForce) { static Float:vecOrigin[3]; pev(pVictim, pev_origin, vecOrigin); @@ -154,17 +154,13 @@ stock UTIL_PlayerKnockback(pVictim, pAttacker, Float:flForce = 250.0) { static Float:vecDir[3]; xs_vec_sub(vecOrigin, vecAttackerOrigin, vecDir); - static Float:vecKnockback[3]; - new Float:flLen = xs_vec_len_2d(vecDir); - for (new i = 0; i < 2; ++i) { - vecKnockback[i] = (vecDir[i] / flLen) * flForce; - } - - vecKnockback[2] = 0.0; static Float:vecVelocity[3]; pev(pVictim, pev_velocity, vecVelocity); - xs_vec_add(vecVelocity, vecKnockback, vecVelocity); + for (new i = 0; i < 2; ++i) { + vecVelocity[i] = (vecDir[i] / flLen) * flForce; + } + set_pev(pVictim, pev_velocity, vecVelocity); } From 8a46fb0380ad27afd3c3a9ca1818567a2ed7a42c Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Tue, 23 Feb 2021 04:34:19 +0200 Subject: [PATCH 27/37] reduced knockback --- src/scripts/weapons/zp_weapon_crowbar.sma | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/weapons/zp_weapon_crowbar.sma b/src/scripts/weapons/zp_weapon_crowbar.sma index bc1a1eb..fe7cf4a 100644 --- a/src/scripts/weapons/zp_weapon_crowbar.sma +++ b/src/scripts/weapons/zp_weapon_crowbar.sma @@ -142,7 +142,7 @@ public OnPlayerTakeDamage_Post(this, pInflictor, pAttacker) { return HAM_IGNORED; } - UTIL_PlayerKnockback(this, pAttacker, 200.0); + UTIL_PlayerKnockback(this, pAttacker, 150.0); return HAM_HANDLED; } From a7b2163fd40dc34d1d22eef20872aa9331224c65 Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Tue, 23 Feb 2021 04:46:30 +0200 Subject: [PATCH 28/37] updated version and changelog --- README.md | 2 +- package.json | 2 +- src/include/zombiepanic.inc | 19 +++++++++++++++++++ src/include/zombiepanic_const.inc | 2 +- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3bcbdf2..c93b29a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ ### Zombie Panic Mod for Counter-Strike 1.6 -__Version:__ 1.1.0 +__Version:__ 1.2.0 ### Download latest: - [Releases](../../releases) diff --git a/package.json b/package.json index 65bb04e..c9ddc15 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zombiepanic", - "version": "1.1.0", + "version": "1.2.0", "description": "Zombie Panic Mod", "scripts": { "gulp": "gulp", diff --git a/src/include/zombiepanic.inc b/src/include/zombiepanic.inc index 1fb5d37..9873ec7 100644 --- a/src/include/zombiepanic.inc +++ b/src/include/zombiepanic.inc @@ -1,4 +1,23 @@ /* + 1.2.0 + Additions and improvements: + Reduced crowbar damage to 25 + Added crowbar knockback + Zombie lives are now related to the number of survivors + Zombies number are now related to the number of survivors + Zombies no longer respawn after round ends + Added blink effect at the end of the transformation + Magnum no longer eject brass when shooting + + Cvars: + Added zp_zombie_lives_per_player cvar + + Fixes: + Fixed client crashes related to weapon icon names + Fixed crosshair flickering + Fixed zombie vision external fade handling + Fixed zombie vision fade effect when respawning + 1.1.0 Additions and improvements: Added infection (10% chance by default) diff --git a/src/include/zombiepanic_const.inc b/src/include/zombiepanic_const.inc index 4675557..5634d1a 100644 --- a/src/include/zombiepanic_const.inc +++ b/src/include/zombiepanic_const.inc @@ -1,5 +1,5 @@ #define ZP_TITLE "Zombie Panic" -#define ZP_VERSION "1.1.0" +#define ZP_VERSION "1.2.0" #define ZP_HUMAN_TEAM 2 #define ZP_ZOMBIE_TEAM 1 From c8d1bb01f191b4dbd6e3f38d343204015b357a72 Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Tue, 23 Feb 2021 14:03:56 +0200 Subject: [PATCH 29/37] added chooseteam command for spectators --- src/include/zombiepanic.inc | 1 + src/scripts/core/zp_gamerules.sma | 37 +++++++++++++++++++++++-------- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/include/zombiepanic.inc b/src/include/zombiepanic.inc index 9873ec7..50f2d8b 100644 --- a/src/include/zombiepanic.inc +++ b/src/include/zombiepanic.inc @@ -8,6 +8,7 @@ Zombies no longer respawn after round ends Added blink effect at the end of the transformation Magnum no longer eject brass when shooting + Added chooseteam command for spectators Cvars: Added zp_zombie_lives_per_player cvar diff --git a/src/scripts/core/zp_gamerules.sma b/src/scripts/core/zp_gamerules.sma index ef1f192..7b76259 100644 --- a/src/scripts/core/zp_gamerules.sma +++ b/src/scripts/core/zp_gamerules.sma @@ -91,15 +91,7 @@ public client_disconnected(pPlayer) { } public Round_Fw_NewRound() { - for (new pPlayer = 1; pPlayer <= MaxClients; ++pPlayer) { - if (!is_user_connected(pPlayer) || is_user_hltv(pPlayer)) { - continue; - } - - g_iPlayerTeamPreference[pPlayer] = get_member(pPlayer, m_iTeam) == 3 ? TeamPreference_Spectator : TeamPreference_Human; - OpenTeamMenu(pPlayer); - } - + ResetPlayerTeamPreferences(); ShuffleTeams(); return PLUGIN_CONTINUE; @@ -169,6 +161,10 @@ public OnMessage_VGUIMenu(iMsgId, iDest, pPlayer) { public OnPlayerChangeTeam(pPlayer, iKey) { + if (get_member(pPlayer, m_iTeam) == 3) { + OpenTeamMenu(pPlayer); + } + return PLUGIN_HANDLED; } @@ -189,9 +185,14 @@ public OnPlayerSpawn(pPlayer) { } public OnPlayerSpawn_Post(pPlayer) { + if (!is_user_alive(pPlayer)) { + return HAM_IGNORED; + } + if (!Round_IsRoundStarted()) { set_member(pPlayer, m_iTeam, ZP_HUMAN_TEAM); set_pev(pPlayer, pev_takedamage, DAMAGE_NO); + OpenTeamMenu(pPlayer); ZP_ShowMapInfo(pPlayer); // ZP_Player_UpdateSpeed(pPlayer); } else { @@ -399,6 +400,16 @@ ShuffleTeams() { ArrayDestroy(irgPlayers); } +ResetPlayerTeamPreferences() { + for (new pPlayer = 1; pPlayer <= MaxClients; ++pPlayer) { + if (!is_user_connected(pPlayer) || is_user_hltv(pPlayer)) { + continue; + } + + g_iPlayerTeamPreference[pPlayer] = get_member(pPlayer, m_iTeam) == 3 ? TeamPreference_Spectator : TeamPreference_Human; + } +} + RespawnPlayers() { for (new pPlayer = 1; pPlayer <= MaxClients; ++pPlayer) { if (!is_user_connected(pPlayer)) { @@ -454,9 +465,17 @@ public TeamMenuHandler(pPlayer, iMenu, iItem) { switch (iItem) { case 0: { g_iPlayerTeamPreference[pPlayer] = TeamPreference_Human; + + if (get_member(pPlayer, m_iTeam) == 3) { + set_member(pPlayer, m_iTeam, ZP_HUMAN_TEAM); + } } case 1: { g_iPlayerTeamPreference[pPlayer] = TeamPreference_Zombie; + + if (get_member(pPlayer, m_iTeam) == 3) { + set_member(pPlayer, m_iTeam, ZP_HUMAN_TEAM); + } } case 5: { g_iPlayerTeamPreference[pPlayer] = TeamPreference_Spectator; From 4a354815616da66600209ba8f8a00c8083003311 Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Tue, 23 Feb 2021 16:57:41 +0200 Subject: [PATCH 30/37] added unselectable characters support --- src/include/zombiepanic.inc | 2 ++ src/scripts/core/zp_characters.sma | 48 ++++++++++++++++++++++++++++-- 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/src/include/zombiepanic.inc b/src/include/zombiepanic.inc index 50f2d8b..0a12138 100644 --- a/src/include/zombiepanic.inc +++ b/src/include/zombiepanic.inc @@ -9,6 +9,7 @@ Added blink effect at the end of the transformation Magnum no longer eject brass when shooting Added chooseteam command for spectators + Added unselectable characters support Cvars: Added zp_zombie_lives_per_player cvar @@ -55,6 +56,7 @@ native bool:ZP_Player_ToggleZombieVision(pPlayer); native bool:ZP_Player_IsInfected(pPlayer); native bool:ZP_Player_IsTransforming(pPlayer); native ZP_Player_SetInfected(pPlayer, bool:bValue); +native bool:ZP_Player_SetCharacter(pPlayer, const szCharacter[]); forward ZP_Fw_PlayerJoined(pPlayer); forward ZP_Fw_PlayerPanic(pPlayer); diff --git a/src/scripts/core/zp_characters.sma b/src/scripts/core/zp_characters.sma index 087271e..8b36e0c 100644 --- a/src/scripts/core/zp_characters.sma +++ b/src/scripts/core/zp_characters.sma @@ -27,7 +27,8 @@ enum CharacterData { Character_HumanDeathSounds, Character_PanicSounds, Character_ZombieAmbientSounds, - Character_ZombieDeathSounds + Character_ZombieDeathSounds, + Character_IsSelectable } new gmsgClCorpse; @@ -36,6 +37,7 @@ new g_szCharacterDir[MAX_RESOURCE_PATH_LENGTH]; new Array:g_rgCharactersData[CharacterData]; new Trie:g_iCharactersMap; +new Array:g_iSelectableCharacters; new g_iCharacterCount = 0; new g_iPlayerCharacter[MAX_PLAYERS + 1] = { -1, ... }; @@ -68,10 +70,25 @@ public plugin_init() { g_iCwSwipeHandler = CW_GetHandler(ZP_WEAPON_SWIPE); } +public plugin_natives() { + register_native("ZP_Player_SetCharacter", "Native_SetCharacter"); +} + public plugin_end() { DestroyCharactersStore(); } +/*--------------------------------[ Natives ]--------------------------------*/ + +public bool:Native_SetCharacter(iPluginId, iArgc) { + new pPlayer = get_param(1); + + new szCharacter[32]; + get_string(2, szCharacter, charsmax(szCharacter)); + + return SetCharacter(pPlayer, szCharacter); +} + /*--------------------------------[ Forwards ]--------------------------------*/ public client_connect(pPlayer) { @@ -148,6 +165,17 @@ public Task_Ambient(iTaskId) { /*--------------------------------[ Methods ]--------------------------------*/ +bool:SetCharacter(pPlayer, const szCharacter[]) { + new iCharacter; + if (!TrieGetCell(g_iCharactersMap, szCharacter, iCharacter)) { + return false; + } + + g_iPlayerCharacter[pPlayer] = iCharacter; + + return true; +} + UpdatePlayerModel(pPlayer) { new iCharacter = g_iPlayerCharacter[pPlayer]; @@ -174,12 +202,13 @@ UpdatePlayerCharacter(pPlayer, bool:bOverride = false) { get_user_info(pPlayer, CHARACTER_KEY, szCharacter, charsmax(szCharacter)); new iCharacter; - if (!TrieGetCell(g_iCharactersMap, szCharacter, iCharacter)) { + if (!TrieGetCell(g_iCharactersMap, szCharacter, iCharacter) + || !ArrayGetCell(Array:g_rgCharactersData[Character_IsSelectable], iCharacter)) { if (!bOverride) { return; } - iCharacter = random(g_iCharacterCount); + iCharacter = ArrayGetCell(g_iSelectableCharacters, random(ArraySize(g_iSelectableCharacters))); } g_iPlayerCharacter[pPlayer] = iCharacter; @@ -219,6 +248,8 @@ CreateCharacter() { CrateCharacterSoundsData(iCharacter, Character_ZombieAmbientSounds); CrateCharacterSoundsData(iCharacter, Character_ZombieDeathSounds); + ArraySetCell(Array:g_rgCharactersData[Character_IsSelectable], iCharacter, true); + g_iCharacterCount++; return iCharacter; @@ -289,6 +320,14 @@ LoadCharacter(const szName[]) { LoadCharacterSoundsData(iCharacter, iSoundsDoc, "zombie.ambient", Character_ZombieAmbientSounds); LoadCharacterSoundsData(iCharacter, iSoundsDoc, "zombie.death", Character_ZombieDeathSounds); + if (json_object_has_value(iDoc, "selectable")) { + ArraySetCell(Array:g_rgCharactersData[Character_IsSelectable], iCharacter, json_object_get_bool(iDoc, "selectable")); + } + + if (ArrayGetCell(Array:g_rgCharactersData[Character_IsSelectable], iCharacter)) { + ArrayPushCell(g_iSelectableCharacters, iCharacter); + } + return iCharacter; } @@ -315,6 +354,7 @@ LoadCharacterSoundsData(iCharacter, JSON:iSoundDoc, const szKey[], CharacterData InitializeCharactersStore() { g_iCharactersMap = TrieCreate(); + g_iSelectableCharacters = ArrayCreate(_, RESERVED_CHARACTER_COUNT); g_rgCharactersData[Character_HumanModel] = ArrayCreate(MAX_RESOURCE_PATH_LENGTH, RESERVED_CHARACTER_COUNT); g_rgCharactersData[Character_ZombieModel] = ArrayCreate(MAX_RESOURCE_PATH_LENGTH, RESERVED_CHARACTER_COUNT); @@ -323,6 +363,7 @@ InitializeCharactersStore() { g_rgCharactersData[Character_PanicSounds] = ArrayCreate(_, RESERVED_CHARACTER_COUNT); g_rgCharactersData[Character_ZombieAmbientSounds] = ArrayCreate(_, RESERVED_CHARACTER_COUNT); g_rgCharactersData[Character_ZombieDeathSounds] = ArrayCreate(_, RESERVED_CHARACTER_COUNT); + g_rgCharactersData[Character_IsSelectable] = ArrayCreate(_, RESERVED_CHARACTER_COUNT); } DestroyCharactersStore() { @@ -331,6 +372,7 @@ DestroyCharactersStore() { } TrieDestroy(g_iCharactersMap); + ArrayDestroy(g_iSelectableCharacters); ArrayDestroy(Array:g_rgCharactersData[Character_HumanModel]); ArrayDestroy(Array:g_rgCharactersData[Character_ZombieModel]); From 7737632adebcd39c805e0d1875a297dbe82400dd Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Tue, 23 Feb 2021 17:00:21 +0200 Subject: [PATCH 31/37] added ZP_Fw_PlayerEquiped forward --- src/include/zombiepanic.inc | 1 + src/scripts/core/zp_player_equipment.sma | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/include/zombiepanic.inc b/src/include/zombiepanic.inc index 0a12138..f433f02 100644 --- a/src/include/zombiepanic.inc +++ b/src/include/zombiepanic.inc @@ -65,6 +65,7 @@ forward ZP_Fw_Player_AimItem(pPlayer, pItem); forward ZP_Fw_PlayerInfected(pPlayer, pInfector); forward ZP_Fw_PlayerTransformationDeath(pPlayer); forward ZP_Fw_PlayerTransformed(pPlayer); +forward ZP_Fw_PlayerEquiped(pPlayer); // Player inventory diff --git a/src/scripts/core/zp_player_equipment.sma b/src/scripts/core/zp_player_equipment.sma index f9f7bac..7e8cae4 100644 --- a/src/scripts/core/zp_player_equipment.sma +++ b/src/scripts/core/zp_player_equipment.sma @@ -14,10 +14,15 @@ #define PLAYER_IDLE_ANIMEXT "c4" +new g_pFwPlayerEquiped; +new g_iFwResult; + public plugin_init() { register_plugin(PLUGIN, ZP_VERSION, AUTHOR); RegisterHookChain(RG_CBasePlayer_OnSpawnEquip, "OnPlayerSpawnEquip"); + + g_pFwPlayerEquiped = CreateMultiForward("ZP_Fw_PlayerEquiped", ET_IGNORE, FP_CELL); } public OnPlayerSpawnEquip(pPlayer) { @@ -42,5 +47,7 @@ public OnPlayerSpawnEquip(pPlayer) { } } + ExecuteForward(g_pFwPlayerEquiped, g_iFwResult, pPlayer); + return HC_SUPERCEDE; } From 21091af67401c8162a61d9648cb57aceca12912d Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Tue, 23 Feb 2021 21:56:40 +0200 Subject: [PATCH 32/37] added pInfector argument to the ZP_Player_SetInfected native --- src/include/zombiepanic.inc | 2 +- src/scripts/core/zp_infection.sma | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/include/zombiepanic.inc b/src/include/zombiepanic.inc index f433f02..579085e 100644 --- a/src/include/zombiepanic.inc +++ b/src/include/zombiepanic.inc @@ -55,7 +55,7 @@ native bool:ZP_Player_ToggleFlashlight(pPlayer); native bool:ZP_Player_ToggleZombieVision(pPlayer); native bool:ZP_Player_IsInfected(pPlayer); native bool:ZP_Player_IsTransforming(pPlayer); -native ZP_Player_SetInfected(pPlayer, bool:bValue); +native ZP_Player_SetInfected(pPlayer, bool:bValue, pInfector = 0); native bool:ZP_Player_SetCharacter(pPlayer, const szCharacter[]); forward ZP_Fw_PlayerJoined(pPlayer); diff --git a/src/scripts/core/zp_infection.sma b/src/scripts/core/zp_infection.sma index ed7d98d..346d5e9 100644 --- a/src/scripts/core/zp_infection.sma +++ b/src/scripts/core/zp_infection.sma @@ -80,8 +80,9 @@ public plugin_natives() { public Native_SetInfected(iPluginId, iArgc) { new pPlayer = get_param(1); new bool:bValue = bool:get_param(2); + new pInfector = get_param(3); - SetInfected(pPlayer, bValue); + SetInfected(pPlayer, bValue, pInfector); } public Native_IsPlayerInfected(iPluginId, iArgc) { From 537581204e492112ab685096074ee1d6a0edeac0 Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Tue, 23 Feb 2021 22:05:58 +0200 Subject: [PATCH 33/37] added ZP_Player_IsPartialZombie native --- src/include/zombiepanic.inc | 1 + src/scripts/core/zp_infection.sma | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/include/zombiepanic.inc b/src/include/zombiepanic.inc index 579085e..4660e23 100644 --- a/src/include/zombiepanic.inc +++ b/src/include/zombiepanic.inc @@ -55,6 +55,7 @@ native bool:ZP_Player_ToggleFlashlight(pPlayer); native bool:ZP_Player_ToggleZombieVision(pPlayer); native bool:ZP_Player_IsInfected(pPlayer); native bool:ZP_Player_IsTransforming(pPlayer); +native bool:ZP_Player_IsPartialZombie(pPlayer); native ZP_Player_SetInfected(pPlayer, bool:bValue, pInfector = 0); native bool:ZP_Player_SetCharacter(pPlayer, const szCharacter[]); diff --git a/src/scripts/core/zp_infection.sma b/src/scripts/core/zp_infection.sma index 346d5e9..2188034 100644 --- a/src/scripts/core/zp_infection.sma +++ b/src/scripts/core/zp_infection.sma @@ -74,6 +74,7 @@ public plugin_init() { public plugin_natives() { register_native("ZP_Player_SetInfected", "Native_SetInfected"); register_native("ZP_Player_IsInfected", "Native_IsPlayerInfected"); + register_native("ZP_Player_IsPartialZombie", "Native_IsPlayerPartialZombie"); register_native("ZP_Player_IsTransforming", "Native_IsPlayerTransforming"); } @@ -91,7 +92,13 @@ public Native_IsPlayerInfected(iPluginId, iArgc) { return IsPlayerInfected(pPlayer); } -public Native_IsPlayerTransforming(iPluginId, iArgc) { +public bool:Native_IsPlayerPartialZombie(iPluginId, iArgc) { + new pPlayer = get_param(1); + + return IsPlayerInfected(pPlayer) && g_iPlayerInfectionState[pPlayer] >= InfectionState_PartialZombie; +} + +public bool:Native_IsPlayerTransforming(iPluginId, iArgc) { new pPlayer = get_param(1); return IsPlayerInfected(pPlayer) && g_iPlayerInfectionState[pPlayer] >= InfectionState_Transformation; From 377619c65b0598575bdd3cc785a621dd9fd542fa Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Tue, 23 Feb 2021 22:16:23 +0200 Subject: [PATCH 34/37] updated changelog --- src/include/zombiepanic.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/include/zombiepanic.inc b/src/include/zombiepanic.inc index 4660e23..ef6389d 100644 --- a/src/include/zombiepanic.inc +++ b/src/include/zombiepanic.inc @@ -5,10 +5,10 @@ Added crowbar knockback Zombie lives are now related to the number of survivors Zombies number are now related to the number of survivors + Added chooseteam command for spectators Zombies no longer respawn after round ends - Added blink effect at the end of the transformation Magnum no longer eject brass when shooting - Added chooseteam command for spectators + Added blink effect at the end of the transformation Added unselectable characters support Cvars: From d5dd5fe7a1e85e735253624b326c9b0f51059ae1 Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Tue, 23 Feb 2021 22:18:14 +0200 Subject: [PATCH 35/37] fixed null characted check --- src/scripts/extra/zp_hud_hints.sma | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/extra/zp_hud_hints.sma b/src/scripts/extra/zp_hud_hints.sma index fdd3c5f..956d64f 100644 --- a/src/scripts/extra/zp_hud_hints.sma +++ b/src/scripts/extra/zp_hud_hints.sma @@ -364,7 +364,7 @@ stock UTIL_CalculateHUDLines(const szText[]) { new iLineLength = 0; for (new i = 0; i < 256; ++i) { - if (szText[i] == 0) { + if (szText[i] == '^0') { break; } From 8e4d81eecb65384ecdef9f4a8b5ae669221f4801 Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Tue, 23 Feb 2021 22:20:00 +0200 Subject: [PATCH 36/37] fixed not enough zombies message --- src/scripts/core/zp_gamerules.sma | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/core/zp_gamerules.sma b/src/scripts/core/zp_gamerules.sma index 7b76259..018b556 100644 --- a/src/scripts/core/zp_gamerules.sma +++ b/src/scripts/core/zp_gamerules.sma @@ -239,7 +239,7 @@ DistributeTeams() { new iRequiredZombieCount = floatround(float(pPlayerCount) / PLAYERS_PER_ZOMBIE, floatround_ceil); if (iZombieCount < iRequiredZombieCount) { if (pPlayerCount > 1) { - log_amx("No one has chosen play zombie, a random player will be moved to the zombie team..."); + log_amx("Not enough zombies, a random players will be moved to the zombie team..."); new iCount = iRequiredZombieCount - iZombieCount; for (new i = 0; i < iCount; ++i) { From b8483321cceb303637ccecad2d94339640b7f91b Mon Sep 17 00:00:00 2001 From: Hedgehog Fog Date: Tue, 23 Feb 2021 22:21:37 +0200 Subject: [PATCH 37/37] codestyle fixes --- src/scripts/core/zombiepanic.sma | 4 ++-- src/scripts/core/zp_gamerules.sma | 4 ++-- src/scripts/core/zp_panic.sma | 4 ++-- src/scripts/core/zp_use_pickup.sma | 4 ++-- src/scripts/core/zp_zombie_vision.sma | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/scripts/core/zombiepanic.sma b/src/scripts/core/zombiepanic.sma index e866279..1386140 100644 --- a/src/scripts/core/zombiepanic.sma +++ b/src/scripts/core/zombiepanic.sma @@ -10,7 +10,7 @@ #define AUTHOR "Hedgehog Fog" new g_pFwConfigLoaded; -new g_pFwResult; +new g_iFwResult; new g_pCvarVersion; @@ -50,7 +50,7 @@ public plugin_cfg() { server_cmd("exec %s/zombiepanic.cfg", szConfigDir); server_exec(); - ExecuteForward(g_pFwConfigLoaded, g_pFwResult); + ExecuteForward(g_pFwConfigLoaded, g_iFwResult); } public OnVersionCvarChange() { diff --git a/src/scripts/core/zp_gamerules.sma b/src/scripts/core/zp_gamerules.sma index 018b556..cae8519 100644 --- a/src/scripts/core/zp_gamerules.sma +++ b/src/scripts/core/zp_gamerules.sma @@ -29,7 +29,7 @@ new g_pCvarLives; new g_pCvarLivesPerPlayer; new g_pFwPlayerJoined; -new g_pFwResult; +new g_iFwResult; new g_iTeamMenu; new bool:g_bObjectiveMode = false; @@ -439,7 +439,7 @@ public Task_Join(pPlayer) { set_member(pPlayer, m_iTeam, 2); set_member(pPlayer, m_iJoiningState, 5); - ExecuteForward(g_pFwPlayerJoined, g_pFwResult, pPlayer); + ExecuteForward(g_pFwPlayerJoined, g_iFwResult, pPlayer); } /*--------------------------------[ Team Menu ]--------------------------------*/ diff --git a/src/scripts/core/zp_panic.sma b/src/scripts/core/zp_panic.sma index 9a7bf87..a4b171a 100644 --- a/src/scripts/core/zp_panic.sma +++ b/src/scripts/core/zp_panic.sma @@ -19,7 +19,7 @@ new bool:g_bPlayerPanic[MAX_PLAYERS + 1]; new Float:g_flPlayerLastPanic[MAX_PLAYERS + 1]; new g_pFwPanic; -new g_pFwResult; +new g_iFwResult; public plugin_init() { register_plugin(PLUGIN, ZP_VERSION, AUTHOR); @@ -91,7 +91,7 @@ bool:Panic(pPlayer) { set_task(PANIC_DURATION, "Task_EndPanic", pPlayer); - ExecuteForward(g_pFwPanic, g_pFwResult, pPlayer); + ExecuteForward(g_pFwPanic, g_iFwResult, pPlayer); return true; } diff --git a/src/scripts/core/zp_use_pickup.sma b/src/scripts/core/zp_use_pickup.sma index 6c78928..f4e9680 100644 --- a/src/scripts/core/zp_use_pickup.sma +++ b/src/scripts/core/zp_use_pickup.sma @@ -20,7 +20,7 @@ new g_pPlayerAimItem[MAX_PLAYERS + 1] = { -1, ... }; new g_bPlayerPickup[MAX_PLAYERS + 1] = { false, ... }; new g_pFwAimItem; -new g_pFwResult; +new g_iFwResult; new g_pCvarUsePickup; new g_pCvarUsePickupHighlight; @@ -133,7 +133,7 @@ public OnPlayerPreThink_Post(pPlayer) { g_pPlayerAimItem[pPlayer] = pEntity; if (pEntity != pPrevAimItem) { - ExecuteForward(g_pFwAimItem, g_pFwResult, pPlayer, pEntity); + ExecuteForward(g_pFwAimItem, g_iFwResult, pPlayer, pEntity); } break; diff --git a/src/scripts/core/zp_zombie_vision.sma b/src/scripts/core/zp_zombie_vision.sma index 8e5a916..f89a0cb 100644 --- a/src/scripts/core/zp_zombie_vision.sma +++ b/src/scripts/core/zp_zombie_vision.sma @@ -24,7 +24,7 @@ new bool:g_bPlayerExternalFade[MAX_PLAYERS + 1]; new bool:g_bIgnoreFadeMessage; new g_pFwZombieVision; -new g_pFwResult; +new g_iFwResult; new g_pCvarAuto; @@ -197,7 +197,7 @@ SetZombieVision(pPlayer, bool:bValue) { VisionFadeEffect(pPlayer, bValue); g_bPlayerVision[pPlayer] = bValue; - ExecuteForward(g_pFwZombieVision, g_pFwResult, pPlayer, bValue); + ExecuteForward(g_pFwZombieVision, g_iFwResult, pPlayer, bValue); } VisionFadeEffect(pPlayer, bool:bValue) {