Renamed zr_consecutive_infect (fixed value mixup in the code), and fixed damage flags.
This commit is contained in:
parent
7111a8c594
commit
1ec47ef154
@ -62,7 +62,7 @@ enum CvarsList
|
||||
Handle:CVAR_SUICIDE_WORLD_DAMAGE,
|
||||
Handle:CVAR_SPAWN_MIN,
|
||||
Handle:CVAR_SPAWN_MAX,
|
||||
Handle:CVAR_CONSECUTIVE_INFECT,
|
||||
Handle:CVAR_INFECT_CONSECUTIVE_BLOCK,
|
||||
Handle:CVAR_ZMARKET_BUYZONE,
|
||||
Handle:CVAR_ZSPAWN,
|
||||
Handle:CVAR_ZTELE,
|
||||
@ -302,7 +302,7 @@ CvarsInit()
|
||||
// Old Desc: Minimum time a player is picked to be zombie after the round starts, in seconds
|
||||
g_hCvarsList[CVAR_SPAWN_MAX] = CreateConVar("zr_spawn_max", "50", "");
|
||||
// Old Desc: Maximum time a player is picked to be zombie after the round starts, in seconds
|
||||
g_hCvarsList[CVAR_CONSECUTIVE_INFECT] = CreateConVar("zr_consecutive_infect", "0", "");
|
||||
g_hCvarsList[CVAR_INFECT_CONSECUTIVE_BLOCK] = CreateConVar("zr_infect_consecutive_block", "1", "");
|
||||
// Old Desc: Allow player to be randomly chosen twice in a row to be a mother zombie (0: Disable)
|
||||
g_hCvarsList[CVAR_ZMARKET_BUYZONE] = CreateConVar("zr_zmarket_buyzone", "1", "");
|
||||
// Old Desc: Must be in buyzone to access !zmarket, if Market is installed (0: Can be used anywhere)
|
||||
|
@ -12,13 +12,11 @@
|
||||
/**
|
||||
* @section Damage type flags.
|
||||
*/
|
||||
#define DMG_GENERIC 0 // generic damage was done
|
||||
#define DMG_BULLET (1 << 1) // shot
|
||||
#define DMG_SLASH (1 << 2) // cut, clawed, stabbed
|
||||
#define DMG_BURN (1 << 3) // heat burned
|
||||
#define DMG_FALL (1 << 5) // fell too far
|
||||
#define DMG_BLAST (1 << 6) // explosive blast damage
|
||||
#define DMG_DROWN (1 << 14) // Drowning
|
||||
#define DMG_FALL (1 << 5) /** Client was damaged by falling. */
|
||||
#define DMG_BLAST (1 << 6) /** Client was damaged by explosion. */
|
||||
#define DMG_BULLET (1 << 12) /** Client was shot or knifed. */
|
||||
#define DMG_HEADSHOT (1 << 30) /** Client was shot in the head. */
|
||||
|
||||
/**
|
||||
* @endsection
|
||||
*/
|
||||
@ -37,8 +35,8 @@
|
||||
*/
|
||||
enum DamageHooks
|
||||
{
|
||||
Hook_TraceAttack,
|
||||
Hook_OnTakeDamage,
|
||||
Hook_TraceAttack, /** TraceAttack HookID */
|
||||
Hook_OnTakeDamage, /** OnTakeDamage HookID */
|
||||
}
|
||||
|
||||
new g_iDamageHooks[MAXPLAYERS + 1][DamageHooks];
|
||||
@ -74,8 +72,9 @@ DamageInit()
|
||||
*/
|
||||
DamageClientInit(client)
|
||||
{
|
||||
g_iDamageHooks[client][Hook_TraceAttack] = Hacks_Hook(client, HACKS_HTYPE_TRACEATTACK, DamageTraceAttack, false);
|
||||
g_iDamageHooks[client][Hook_OnTakeDamage] = Hacks_Hook(client, HACKS_HTYPE_ONTAKEDAMAGE, DamageOnTakeDamage, false);
|
||||
// Hook damage callbacks.
|
||||
g_iDamageHooks[client][Hook_TraceAttack] = Hacks_Hook(client, HACKS_HTYPE_TRACEATTACK, DamageTraceAttack);
|
||||
g_iDamageHooks[client][Hook_OnTakeDamage] = Hacks_Hook(client, HACKS_HTYPE_ONTAKEDAMAGE, DamageOnTakeDamage);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -85,6 +84,7 @@ DamageClientInit(client)
|
||||
*/
|
||||
DamageOnClientDisconnect(client)
|
||||
{
|
||||
// Unhook damage callbacks.
|
||||
Hacks_Unhook(g_iDamageHooks[client][Hook_TraceAttack]);
|
||||
Hacks_Unhook(g_iDamageHooks[client][Hook_OnTakeDamage]);
|
||||
}
|
||||
@ -160,10 +160,8 @@ public DamageOnTakeDamage(client, inflictor, attacker, damage, damagetype, ammot
|
||||
return Hacks_Continue;
|
||||
}
|
||||
|
||||
switch(damagetype)
|
||||
{
|
||||
// Client fell too far.
|
||||
case DMG_FALL:
|
||||
// Client was damaged by falling.
|
||||
if (damagetype & DMG_FALL)
|
||||
{
|
||||
// If client isn't a zombie, then allow damage.
|
||||
if (!IsPlayerZombie(client))
|
||||
@ -181,8 +179,8 @@ public DamageOnTakeDamage(client, inflictor, attacker, damage, damagetype, ammot
|
||||
// Stop damage.
|
||||
return 0;
|
||||
}
|
||||
// Client is being damaged by a blast.
|
||||
case DMG_BLAST:
|
||||
// Client was damaged by explosion.
|
||||
else if (damagetype & DMG_BLAST)
|
||||
{
|
||||
// If attacker isn't valid, then allow damage.
|
||||
if (!ZRIsValidClient(attacker))
|
||||
@ -199,8 +197,8 @@ public DamageOnTakeDamage(client, inflictor, attacker, damage, damagetype, ammot
|
||||
// Stop damage.
|
||||
return 0;
|
||||
}
|
||||
// Client is being shot.
|
||||
case DMG_BULLET:
|
||||
// Client was shot or knifed.
|
||||
else if (damagetype & DMG_BULLET)
|
||||
{
|
||||
// If attacker isn't valid, then allow damage.
|
||||
if (!ZRIsValidClient(attacker))
|
||||
@ -233,7 +231,6 @@ public DamageOnTakeDamage(client, inflictor, attacker, damage, damagetype, ammot
|
||||
// Allow damage.
|
||||
return Hacks_Continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Allow damage.
|
||||
return Hacks_Continue;
|
||||
|
@ -288,10 +288,10 @@ InfectPlayer(client, attacker = -1, bool:motherinfect = false)
|
||||
|
||||
|
||||
// Check if consecutive infection protection is enabled.
|
||||
new bool:consecutive_infect = GetConVarBool(g_hCvarsList[CVAR_CONSECUTIVE_INFECT]);
|
||||
new bool:infectconsecutiveblock = GetConVarBool(g_hCvarsList[CVAR_INFECT_CONSECUTIVE_BLOCK]);
|
||||
|
||||
// Flag player to be immune from being mother zombie twice, if consecutive infect protection is enabled.
|
||||
bMotherInfectImmune[client] = consecutive_infect ? motherinfect : false;
|
||||
bMotherInfectImmune[client] = infectconsecutiveblock ? motherinfect : false;
|
||||
|
||||
// Forward event to modules.
|
||||
ClassOnClientInfected(client, motherinfect);
|
||||
|
Loading…
Reference in New Issue
Block a user