Added option for random dissolve effect.
Added an option to the account module to give money for damaging a client. Expanded player hull xy offset by 1 unit. Fixed anti-stuck not solidifying clients. Fixed weapon rendering glitches (again)
This commit is contained in:
		| @@ -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" | ||||
|   | ||||
| @@ -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) | ||||
|  *  | ||||
|   | ||||
| @@ -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); | ||||
|   | ||||
| @@ -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]"); | ||||
|      | ||||
|     // =========================== | ||||
|   | ||||
| @@ -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); | ||||
|   | ||||
| @@ -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); | ||||
|   | ||||
| @@ -69,7 +69,7 @@ WeaponAlphaOnClientDisconnect(client) | ||||
| /** | ||||
|  * The round is starting. | ||||
|  */ | ||||
| WeaponAlphaOnRoundStart() | ||||
| WeaponAlphaOnRoundStartPost() | ||||
| { | ||||
|     // Allow weapon render mode to be modified. | ||||
|     g_bWeaponAlpha = true; | ||||
|   | ||||
| @@ -308,10 +308,10 @@ WeaponsOnClientSpawn(client) | ||||
| /** | ||||
|  * The round is starting. | ||||
|  */ | ||||
| WeaponsOnRoundStart() | ||||
| WeaponsOnRoundStartPost() | ||||
| { | ||||
|     // Forward event to sub-modules | ||||
|     WeaponAlphaOnRoundStart(); | ||||
|     WeaponAlphaOnRoundStartPost(); | ||||
| } | ||||
|  | ||||
| /** | ||||
|   | ||||
		Reference in New Issue
	
	Block a user