diff --git a/cstrike/cfg/sourcemod/zombiereloaded/zombiereloaded.cfg b/cstrike/cfg/sourcemod/zombiereloaded/zombiereloaded.cfg index 58774f4..6fec9c4 100644 --- a/cstrike/cfg/sourcemod/zombiereloaded/zombiereloaded.cfg +++ b/cstrike/cfg/sourcemod/zombiereloaded/zombiereloaded.cfg @@ -356,6 +356,10 @@ zr_account_cashfill "1" // Amount of cash to set player's account to. [Dependency: zr_account_cashfill] // Default: "12000" zr_account_cashfill_value "12000" + +// Attacker receives amount of cash equivalent to the damage that was inflicted. +// Default: "0" +zr_account_cashdmg "0" // ---------------------------------------------------------------------------- // Visual Effects (module) // ---------------------------------------------------------------------------- @@ -426,9 +430,9 @@ zr_veffects_fog_farz "2000" // Default: "1" zr_veffects_ragdoll_remove "1" -// The ragdoll removal effect. [-1: Effectless removal | 0: Energy dissolve | 1: Heavy electrical dissolve | 2: Light electrical dissolve | 3: Core dissolve | Dependency: zr_veffects_ragdoll_remove] -// Default: "1" -zr_veffects_ragdoll_dissolve "1" +// The ragdoll removal effect. ['-2' = Effectless removal | '-1' = Random effect | '0' = Energy dissolve | '1' = Heavy electrical dissolve | '2' = Light electrical dissolve | '3' = Core dissolve | Dependency: zr_veffects_ragdoll_remove] +// Default: "-1" +zr_veffects_ragdoll_dissolve "-1" // Time to wait before removing the ragdoll. [Dependency: zr_veffects_ragdoll_remove] // Default: "0.5" diff --git a/src/zr/account.inc b/src/zr/account.inc index 4c1ae65..3d6e507 100644 --- a/src/zr/account.inc +++ b/src/zr/account.inc @@ -69,6 +69,31 @@ AccountOnClientSpawn(client) AccountSetClientCash(client, cash); } +/** Client has been hurt. + * + * @param attacker The attacker index. + * @param dmg The amount of damage inflicted. + */ +AccountOnClientHurt(attacker, dmg_health) +{ + // If attacker isn't valid, then stop. + if (!ZRIsClientValid(attacker)) + { + return; + } + + // If cashdmg cvar is disabled, then stop. + new bool:accountcashdmg = GetConVarBool(g_hCvarsList[CVAR_ACCOUNT_CASHDMG]); + if (!accountcashdmg) + { + return; + } + + // Get current cash, add the damage done to it, then set new value. + new cash = AccountGetClientCash(attacker); + AccountSetClientCash(attacker, cash + dmg_health); +} + /** * Get's a client's account value (cash) * diff --git a/src/zr/antistick.inc b/src/zr/antistick.inc index a21c379..45931d5 100644 --- a/src/zr/antistick.inc +++ b/src/zr/antistick.inc @@ -37,7 +37,7 @@ /** * @section Offsets relating to player hull dimensions. */ -#define ANTISTICK_PLAYER_HULL_XY_OFFSET 32 +#define ANTISTICK_PLAYER_HULL_XY_OFFSET 33 #define ANTISTICK_PLAYER_HULL_Z_OFFSET 12 #define ANTISTICK_PLAYER_HULL_STACK_OFFSET 14 /** @@ -168,13 +168,13 @@ public Action:AntiStickTimer(Handle:timer) continue; } - if (AntiStickClientCollisionGroup(x, false)) + if (AntiStickClientCollisionGroup(x, false) == ANTISTICK_COLLISIONS_ON) { AntiStickClientCollisionGroup(x, true, ANTISTICK_COLLISIONS_OFF); CreateTimer(0.5, AntiStickSolidify, x, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); } - if (AntiStickClientCollisionGroup(stuckindex, false)) + if (AntiStickClientCollisionGroup(stuckindex, false) == ANTISTICK_COLLISIONS_ON) { AntiStickClientCollisionGroup(stuckindex, true, ANTISTICK_COLLISIONS_OFF); CreateTimer(0.5, AntiStickSolidify, stuckindex, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); diff --git a/src/zr/cvars.inc b/src/zr/cvars.inc index 2fe20aa..f121913 100644 --- a/src/zr/cvars.inc +++ b/src/zr/cvars.inc @@ -98,6 +98,7 @@ enum CvarsList Handle:CVAR_INFECT_SHAKE_DURATION, Handle:CVAR_ACCOUNT_CASHFILL, Handle:CVAR_ACCOUNT_CASHFILL_VALUE, + Handle:CVAR_ACCOUNT_CASHDMG, Handle:CVAR_VEFFECTS_LIGHTSTYLE, Handle:CVAR_VEFFECTS_LIGHTSTYLE_VALUE, Handle:CVAR_VEFFECTS_SKY, @@ -333,6 +334,7 @@ CvarsCreate() // =========================== g_hCvarsList[CVAR_ACCOUNT_CASHFILL] = CreateConVar("zr_account_cashfill", "1", "Reset player's cash each spawn."); g_hCvarsList[CVAR_ACCOUNT_CASHFILL_VALUE] = CreateConVar("zr_account_cashfill_value", "12000", "Amount of cash to set player's account to. [Dependency: zr_account_cashfill]"); + g_hCvarsList[CVAR_ACCOUNT_CASHDMG] = CreateConVar("zr_account_cashdmg", "0", "Attacker receives amount of cash equivalent to the damage that was inflicted."); // =========================== @@ -363,7 +365,7 @@ CvarsCreate() // Ragdoll g_hCvarsList[CVAR_VEFFECTS_RAGDOLL_REMOVE] = CreateConVar("zr_veffects_ragdoll_remove", "1", "Remove players' ragdolls from the game after a delay."); - g_hCvarsList[CVAR_VEFFECTS_RAGDOLL_DISSOLVE] = CreateConVar("zr_veffects_ragdoll_dissolve", "1", "The ragdoll removal effect. [-1: Effectless removal | 0: Energy dissolve | 1: Heavy electrical dissolve | 2: Light electrical dissolve | 3: Core dissolve | Dependency: zr_veffects_ragdoll_remove]"); + g_hCvarsList[CVAR_VEFFECTS_RAGDOLL_DISSOLVE] = CreateConVar("zr_veffects_ragdoll_dissolve", "-1", "The ragdoll removal effect. ['-2' = Effectless removal | '-1' = Random effect | '0' = Energy dissolve | '1' = Heavy electrical dissolve | '2' = Light electrical dissolve | '3' = Core dissolve | Dependency: zr_veffects_ragdoll_remove]"); g_hCvarsList[CVAR_VEFFECTS_RAGDOLL_DELAY] = CreateConVar("zr_veffects_ragdoll_delay", "0.5", "Time to wait before removing the ragdoll. [Dependency: zr_veffects_ragdoll_remove]"); // =========================== diff --git a/src/zr/event.inc b/src/zr/event.inc index 55a629c..bfa94de 100644 --- a/src/zr/event.inc +++ b/src/zr/event.inc @@ -86,7 +86,6 @@ public Action:EventRoundStart(Handle:event, const String:name[], bool:dontBroadc // Forward event to sub-modules. OverlaysOnRoundStart(); - WeaponsOnRoundStart(); RoundStartOnRoundStart(); RoundEndOnRoundStart(); InfectOnRoundStart(); @@ -94,6 +93,23 @@ public Action:EventRoundStart(Handle:event, const String:name[], bool:dontBroadc AntiStickOnRoundStart(); ZSpawnOnRoundStart(); VolOnRoundStart(); + + // Fire post round_start event. + CreateTimer(0.0, EventRoundStartPost); +} + +/** + * Event callback (round_start) + * The round is starting. *Post + * + * @param event The event handle. + * @param name Name of the event. + * @dontBroadcast If true, event is broadcasted to all clients, false if not. + */ +public Action:EventRoundStartPost(Handle:timer, any:index) +{ + // Forward event to modules. + WeaponsOnRoundStartPost(); } /** @@ -228,6 +244,7 @@ public Action:EventPlayerHurt(Handle:event, const String:name[], bool:dontBroadc // Forward event to modules. ClassAlphaUpdate(index); InfectOnClientHurt(index, attacker, weapon); + AccountOnClientHurt(attacker, dmg_health); SEffectsOnClientHurt(index); KnockbackOnClientHurt(index, attacker, weapon, hitgroup, dmg_health); NapalmOnClientHurt(index, attacker, weapon); diff --git a/src/zr/visualeffects/ragdoll.inc b/src/zr/visualeffects/ragdoll.inc index 7a15d11..69c4a90 100644 --- a/src/zr/visualeffects/ragdoll.inc +++ b/src/zr/visualeffects/ragdoll.inc @@ -28,7 +28,8 @@ /** * @section Different dissolve types. */ -#define VEFFECTS_RAGDOLL_DISSOLVE_EFFECTLESS -1 +#define VEFFECTS_RAGDOLL_DISSOLVE_EFFECTLESS -2 +#define VEFFECTS_RAGDOLL_DISSOLVE_RANDOM -1 #define VEFFECTS_RAGDOLL_DISSOLVE_ENERGY 0 #define VEFFECTS_RAGDOLL_DISSOLVE_ELECTRICALH 1 #define VEFFECTS_RAGDOLL_DISSOLVE_ELECTRICALL 2 @@ -101,6 +102,12 @@ RagdollRemove(ragdoll) return; } + // If random, set value to any between "energy" effect and "core" effect. + if (dissolve == VEFFECTS_RAGDOLL_DISSOLVE_RANDOM) + { + dissolve = GetRandomInt(VEFFECTS_RAGDOLL_DISSOLVE_ENERGY, VEFFECTS_RAGDOLL_DISSOLVE_CORE); + } + // Prep the ragdoll for dissolving. decl String:targetname[64]; Format(targetname, sizeof(targetname), "zr_dissolve_%d", ragdoll); diff --git a/src/zr/weapons/weaponalpha.inc b/src/zr/weapons/weaponalpha.inc index a314ca5..3f33240 100644 --- a/src/zr/weapons/weaponalpha.inc +++ b/src/zr/weapons/weaponalpha.inc @@ -69,7 +69,7 @@ WeaponAlphaOnClientDisconnect(client) /** * The round is starting. */ -WeaponAlphaOnRoundStart() +WeaponAlphaOnRoundStartPost() { // Allow weapon render mode to be modified. g_bWeaponAlpha = true; diff --git a/src/zr/weapons/weapons.inc b/src/zr/weapons/weapons.inc index 0009dd6..fa1e17c 100644 --- a/src/zr/weapons/weapons.inc +++ b/src/zr/weapons/weapons.inc @@ -308,10 +308,10 @@ WeaponsOnClientSpawn(client) /** * The round is starting. */ -WeaponsOnRoundStart() +WeaponsOnRoundStartPost() { // Forward event to sub-modules - WeaponAlphaOnRoundStart(); + WeaponAlphaOnRoundStartPost(); } /**