Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.3.0 #70

Merged
merged 34 commits into from
Feb 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
5ad63f7
updated zombiepanic_version cvar flags
Hedgefog Feb 26, 2021
fdbeef0
CheckWinConditions now ignores spectators
Hedgefog Feb 26, 2021
9c1318a
fixed infected player death sound
Hedgefog Feb 26, 2021
7707801
infected players no longer bleed
Hedgefog Feb 26, 2021
92fed25
removed default pain sound
Hedgefog Feb 26, 2021
27c022c
increased win message fade out time
Hedgefog Feb 26, 2021
f668f8f
updated version
Hedgefog Feb 26, 2021
8a3b99a
fixed melee secondary attack
Hedgefog Feb 26, 2021
1c442e7
fixed pickup for dead user
Hedgefog Feb 26, 2021
9ff4845
added semicolon pragma
Hedgefog Feb 26, 2021
09f1fbd
added semicolon pragma
Hedgefog Feb 26, 2021
8cd8b53
increased objective mark max velocity
Hedgefog Feb 26, 2021
61a0838
weapons and items are now respawnable
Hedgefog Feb 27, 2021
dd86361
reduced pickups respawn time
Hedgefog Feb 27, 2021
5ec1a79
updated changelog
Hedgefog Feb 27, 2021
dd0c918
codestyle fixes
Hedgefog Feb 27, 2021
2d61337
Pickups will no longer respawn when survivors are nearby
Hedgefog Feb 27, 2021
c332370
fixed items round respawn
Hedgefog Feb 27, 2021
3e2ab82
drop items to floor on spawn
Hedgefog Feb 27, 2021
e1c4843
zombies can now block items respawn
Hedgefog Feb 27, 2021
9c0e7a3
reduced items respawn time
Hedgefog Feb 27, 2021
83d3027
item respawn check moved to the gamerules as native
Hedgefog Feb 27, 2021
573b7e1
added competitive mode
Hedgefog Feb 27, 2021
08d5c36
updated version
Hedgefog Feb 27, 2021
0d1e617
updated config
Hedgefog Feb 27, 2021
cfb34a3
fixed first shot spread calculation
Hedgefog Feb 27, 2021
6b57fd6
reduced 556ar spread
Hedgefog Feb 27, 2021
06a8bb0
updated changelog version
Hedgefog Feb 27, 2021
28aee94
fixed version cvar flags
Hedgefog Feb 27, 2021
54ed532
version cvar moved to the init
Hedgefog Feb 27, 2021
930a8b7
increased 556ar spread
Hedgefog Feb 27, 2021
1d4e539
removed death sound on transformation
Hedgefog Feb 28, 2021
64a066d
fixed DeathMsg hook
Hedgefog Feb 28, 2021
72b5541
updated changelog
Hedgefog Feb 28, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### Zombie Panic Mod for Counter-Strike 1.6
__Version:__ 1.2.0
__Version:__ 1.3.0

### Download latest:
- [Releases](../../releases)
Expand Down
1 change: 1 addition & 0 deletions assets/addons/amxmodx/configs/zombiepanic.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ zp_flashlight_consumption_rate 0.5
zp_flashlight_recovery_rate 0.5

// [Zombie Panic] Gamerules
zp_competitive 0
zp_zombie_lives 0
zp_zombie_lives_per_player 2

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zombiepanic",
"version": "1.2.0",
"version": "1.3.0",
"description": "Zombie Panic Mod",
"scripts": {
"gulp": "gulp",
Expand Down
26 changes: 26 additions & 0 deletions src/include/zombiepanic.inc
Original file line number Diff line number Diff line change
@@ -1,4 +1,28 @@
/*
1.3.0
Additions and improvements:
Removed default pain sound
Infected players no longer bleed
Increased fade in time for win message
Increased objective mark max velocity
Weapons and items are now respawnable
Reduced pickups respawn time
Pickups will no longer respawn when players are nearby
Added competitive mode
Reduced 556ar spread

Cvars:
zombiepanic_version cvar is now visible for monitoring
Added zp_competitive cvar

Fixes:
Fixed win conditions for spectators
Fixed death sound for infected players
Fixed melee secondary attack for bots
Fixed first shot spread calculation
Fixed death sound on transformation
Fixed death message icons

1.2.0
Additions and improvements:
Reduced crowbar damage to 25
Expand Down Expand Up @@ -104,6 +128,8 @@ native ZP_GameRules_GetZombieLives();
native ZP_GameRules_SetZombieLives(iLives);
native ZP_GameRules_RespawnAsZombie(pPlayer);
native ZP_GameRules_DispatchWin(iTeam);
native ZP_GameRules_CanItemRespawn(pItem);
native ZP_GameRules_IsCompetitive();

// Map Info

Expand Down
6 changes: 4 additions & 2 deletions src/include/zombiepanic_const.inc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define ZP_TITLE "Zombie Panic"
#define ZP_VERSION "1.2.0"
#define ZP_VERSION "1.3.0"

#define ZP_HUMAN_TEAM 2
#define ZP_ZOMBIE_TEAM 1
Expand All @@ -11,7 +11,9 @@
#define ZP_HUMAN_HEALTH 100.0
#define ZP_ZOMBIE_HEALTH 200.0
#define ZP_NEW_ROUND_DELAY 5.0
#define ZP_AMMO_RESPAWN_TIME 150.0
#define ZP_AMMO_RESPAWN_TIME 40.0
#define ZP_WEAPONS_RESPAWN_TIME 60.0
#define ZP_ITEMS_RESPAWN_TIME 60.0
#define ZP_BUTTON_FLAG_HUMAN_ONLY BIT(9)

#define ZP_MODE 1 // 1 - classic, 2 - zps
Expand Down
86 changes: 64 additions & 22 deletions src/include/zombiepanic_utils.inc
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,22 @@ stock UTIL_CreateAmmoBox(iAmmoId, iAmount) {
return pWeaponBox;
}

stock UTIL_CreateZpAmmoBox(iAmmoHandler, iAmount = 0) {
static szModel[64];
ZP_Ammo_GetPackModel(iAmmoHandler, szModel, charsmax(szModel));

if (!iAmount) {
iAmount = ZP_Ammo_GetPackSize(iAmmoHandler);
}

new iAmmoId = ZP_Ammo_GetId(iAmmoHandler);

new pWeaponBox = UTIL_CreateAmmoBox(iAmmoId, iAmount);
engfunc(EngFunc_SetModel, pWeaponBox, szModel);

return pWeaponBox;
}

stock UTIL_BeamPoints(const Float:vecStart[3], const Float:vecEnd[3], const color[3], iLifetime = 30) {
message_begin(MSG_BROADCAST ,SVC_TEMPENTITY);
write_byte(TE_BEAMPOINTS);
Expand Down Expand Up @@ -113,35 +129,39 @@ stock bool:UTIL_IsMasterTriggered(const szMaster[], pActivator) {
return true;
}

stock UTIL_CalculateWeaponSpread(pWeapon, const Float:vecSpread[3], Float:flMovementFactor, Float:flFirstShotModifier, Float:flDuckFactor, Float:flAirFactor, Float:vecOut[3]) {
new pPlayer = get_member(pWeapon, m_pPlayer);
new iShotsFired = get_member(pWeapon, m_Weapon_iShotsFired);
new iPlayerFlags = pev(pPlayer, pev_flags);

xs_vec_copy(vecSpread, vecOut);

static Float:vecVelocity[3];
pev(pPlayer, pev_velocity, vecVelocity);
if (xs_vec_len(vecVelocity) > 0) {
if (iShotsFired == 0) {
flMovementFactor *= flFirstShotModifier;
stock Float:UTIL_CalculateWeaponSpread(pWeapon, const Float:vecSpread[3], Float:flMovementFactor, Float:flFirstShotModifier, Float:flDuckFactor, Float:flAirFactor, Float:vecOut[3]) {
new pPlayer = get_member(pWeapon, m_pPlayer);
new iShotsFired = get_member(pWeapon, m_Weapon_iShotsFired);
new iPlayerFlags = pev(pPlayer, pev_flags);

new Float:flSpreadRatio = 1.0;

static Float:vecVelocity[3];
pev(pPlayer, pev_velocity, vecVelocity);
if (xs_vec_len(vecVelocity) > 0) {
flSpreadRatio *= flMovementFactor;
}

if (iPlayerFlags & FL_DUCKING) {
flSpreadRatio *= flDuckFactor;
}

xs_vec_mul_scalar(vecOut, flMovementFactor, vecOut);
}
if (~iPlayerFlags & FL_ONGROUND) {
flSpreadRatio *= flAirFactor;
}

if (!iShotsFired) {
flSpreadRatio *= flFirstShotModifier;
}

if (iPlayerFlags & FL_DUCKING) {
xs_vec_mul_scalar(vecOut, flDuckFactor, vecOut);
}
xs_vec_mul_scalar(vecSpread, flSpreadRatio, vecOut);

if (~iPlayerFlags & FL_ONGROUND) {
xs_vec_mul_scalar(vecOut, flAirFactor, vecOut);
}
return flSpreadRatio;
}

stock bool:UTIL_IsPlayerSpectator(pPlayer) {
new iTeam = get_member(pPlayer, m_iTeam);
return iTeam < 1 || iTeam > 2;
new iTeam = get_member(pPlayer, m_iTeam);
return iTeam < 1 || iTeam > 2;
}

stock UTIL_PlayerKnockback(pVictim, pAttacker, Float:flForce) {
Expand All @@ -164,3 +184,25 @@ stock UTIL_PlayerKnockback(pVictim, pAttacker, Float:flForce) {

set_pev(pVictim, pev_velocity, vecVelocity);
}

stock UTIL_InitWithSpawner(pEntity, pSpawner) {
new Float:vecOrigin[3];
pev(pSpawner, pev_origin, vecOrigin);
engfunc(EngFunc_SetOrigin, pEntity, vecOrigin);

new Float:vecAngles[3];
pev(pSpawner, pev_angles, vecAngles);
set_pev(pEntity, pev_angles, vecAngles);

set_pev(pEntity, pev_owner, pSpawner);

engfunc(EngFunc_DropToFloor, pEntity);
}

stock UTIL_SetupSpawnerRespawn(pEntity) {
new pOwner = pev(pEntity, pev_owner);
if (pev_valid(pOwner) && CE_GetHandlerByEntity(pOwner) != -1) {
CE_Kill(pOwner);
}
}

8 changes: 5 additions & 3 deletions src/scripts/api/api_custom_weapons.sma
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ new const g_rgszWeaponNames[CSW_LAST_WEAPON + 1][] = {
"weapon_p90"
};

new gmsgWeaponList;
new gmsgDeathMsg;

new g_iszWeaponNames[CSW_LAST_WEAPON + 1];
new bool:g_bWeaponHooks[CSW_LAST_WEAPON + 1];
new g_weaponListDefaults[CSW_LAST_WEAPON + 1][WeaponListMessage];
Expand All @@ -100,7 +103,6 @@ new g_iszWeaponBox;
new g_pNewWeaponboxEnt = -1;
new g_pKillerItem = -1;

new gmsgWeaponList;
new bool:g_bPrecache;

new Array:g_irgDecals;
Expand All @@ -121,8 +123,6 @@ public plugin_precache() {
RegisterHam(Ham_TakeDamage, "player", "OnPlayerTakeDamage", .Post = 0);
RegisterHam(Ham_TakeDamage, "player", "OnPlayerTakeDamage_Post", .Post = 1);

register_message(get_user_msgid("DeathMsg"), "OnMessage_DeathMsg");

precache_model(WALL_PUFF_SPRITE);
}

Expand All @@ -132,8 +132,10 @@ public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR);

gmsgWeaponList = get_user_msgid("WeaponList");
gmsgDeathMsg = get_user_msgid("DeathMsg");

register_message(gmsgWeaponList, "OnMessage_WeaponList");
register_message(gmsgDeathMsg, "OnMessage_DeathMsg");

InitWeaponHooks();
}
Expand Down
6 changes: 3 additions & 3 deletions src/scripts/core/zombiepanic.sma
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ new g_iFwResult;
new g_pCvarVersion;

public plugin_precache() {
g_pCvarVersion = register_cvar("zombiepanic_version", ZP_VERSION);
hook_cvar_change(g_pCvarVersion, "OnVersionCvarChange");

for (new i = 0; i < sizeof(ZP_HUD_SPRITES); ++i) {
precache_generic(ZP_HUD_SPRITES[i]);
}
Expand All @@ -26,6 +23,9 @@ public plugin_precache() {
public plugin_init() {
register_plugin(PLUGIN, ZP_VERSION, AUTHOR);

g_pCvarVersion = register_cvar("zombiepanic_version", ZP_VERSION, FCVAR_SERVER);
hook_cvar_change(g_pCvarVersion, "OnVersionCvarChange");

register_forward(FM_GetGameDescription, "OnGetGameDescription");

register_cvar("mp_flashlight", "1");
Expand Down
7 changes: 6 additions & 1 deletion src/scripts/core/zp_characters.sma
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public plugin_init() {

RegisterHam(Ham_Spawn, "player", "OnPlayerSpawn_Post", .Post = 1);
RegisterHam(Ham_Killed, "player", "OnPlayerKilled_Post", .Post = 1);
RegisterHam(Ham_PainSound, "player", "OnPlayerPainSound_Post", .Post = 1);
RegisterHam(Ham_Item_Deploy, "weapon_knife", "OnKnifeDeploy_Post", .Post = 1);

register_forward(FM_SetClientKeyValue, "OnSetClientKeyValue");
Expand Down Expand Up @@ -116,10 +117,14 @@ public OnPlayerSpawn_Post(pPlayer) {
}

public OnPlayerKilled_Post(pPlayer) {
PlayVoiceFromCharacterData(pPlayer, ZP_Player_IsZombie(pPlayer) ? Character_ZombieDeathSounds : Character_HumanDeathSounds);
PlayVoiceFromCharacterData(pPlayer, ZP_Player_IsZombie(pPlayer) && !ZP_Player_IsInfected(pPlayer) ? Character_ZombieDeathSounds : Character_HumanDeathSounds);
return HAM_HANDLED;
}

public OnPlayerPainSound_Post(pPlayer) {
emit_sound(pPlayer, CHAN_VOICE, "common/null.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
}

public OnKnifeDeploy_Post(pKnife) {
if (CW_GetHandlerByEntity(pKnife) == g_iCwSwipeHandler) {
new pPlayer = CW_GetPlayer(pKnife);
Expand Down
49 changes: 48 additions & 1 deletion src/scripts/core/zp_gamerules.sma
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <hamsandwich>
#include <fun>
#include <reapi>
#include <xs>

#include <api_rounds>

Expand All @@ -27,6 +28,7 @@ enum TeamPreference {

new g_pCvarLives;
new g_pCvarLivesPerPlayer;
new g_pCvarCompetitive;

new g_pFwPlayerJoined;
new g_iFwResult;
Expand Down Expand Up @@ -57,6 +59,7 @@ public plugin_init() {

g_pCvarLives = register_cvar("zp_zombie_lives", "0");
g_pCvarLivesPerPlayer = register_cvar("zp_zombie_lives_per_player", "2");
g_pCvarCompetitive = register_cvar("zp_competitive", "0");

g_pFwPlayerJoined = CreateMultiForward("ZP_Fw_PlayerJoined", ET_IGNORE, FP_CELL);

Expand All @@ -67,6 +70,8 @@ public plugin_natives() {
register_native("ZP_GameRules_DispatchWin", "Native_DispatchWin");
register_native("ZP_GameRules_GetObjectiveMode", "Native_GetObjectiveMode");
register_native("ZP_GameRules_SetObjectiveMode", "Native_SetObjectiveMode");
register_native("ZP_GameRules_CanItemRespawn", "Native_CanItemRespawn");
register_native("ZP_GameRules_IsCompetitive", "Native_IsCompetitive");
}

/*--------------------------------[ Natives ]--------------------------------*/
Expand All @@ -84,6 +89,42 @@ public bool:Native_GetObjectiveMode(iPluginId, iArgc) {
return g_bObjectiveMode;
}

public bool:Native_IsCompetitive(iPluginId, iArgc) {
return !!get_pcvar_num(g_pCvarCompetitive);
}

public bool:Native_CanItemRespawn(iPluginId, iArgc) {
new pItem = get_param(1);

if (get_gametime() - Float:get_member_game(m_fRoundStartTime) <= 1.0) {
return true;
}

new Float:vecOrigin[3];
pev(pItem, pev_origin, vecOrigin);

for (new pPlayer = 1; pPlayer <= MaxClients; ++pPlayer) {
if (!is_user_connected(pPlayer)) {
continue;
}

if (!is_user_alive(pPlayer)) {
continue;
}

new Float:flMinRange = ZP_Player_IsZombie(pPlayer) ? 256.0 : 512.0;

static Float:vecPlayerOrigin[3];
pev(pPlayer, pev_origin, vecPlayerOrigin);

if (xs_vec_distance(vecOrigin, vecPlayerOrigin) <= flMinRange) {
return false;
}
}

return true;
}

/*--------------------------------[ Forwards ]--------------------------------*/

public client_disconnected(pPlayer) {
Expand Down Expand Up @@ -236,7 +277,8 @@ DistributeTeams() {
log_amx("Respawned %d zombies", iZombieCount);
}

new iRequiredZombieCount = floatround(float(pPlayerCount) / PLAYERS_PER_ZOMBIE, floatround_ceil);
new iPlayersPerZombie = get_pcvar_num(g_pCvarCompetitive) ? 2 : PLAYERS_PER_ZOMBIE;
new iRequiredZombieCount = floatround(float(pPlayerCount) / iPlayersPerZombie, floatround_ceil);
if (iZombieCount < iRequiredZombieCount) {
if (pPlayerCount > 1) {
log_amx("Not enough zombies, a random players will be moved to the zombie team...");
Expand Down Expand Up @@ -343,6 +385,11 @@ CheckWinConditions(pIgnorePlayer = 0) {
continue;
}

new iTeam = get_member(pPlayer, m_iTeam);
if (iTeam != ZP_HUMAN_TEAM && iTeam != ZP_ZOMBIE_TEAM) {
continue;
}

if (ZP_Player_IsZombie(pPlayer)) {
iZombieCount++;

Expand Down
Loading