Merge pull request #2 from olegtsvetkov/remove-legacy
Remove some legacy things
This commit is contained in:
commit
e17107ea68
@ -25,9 +25,6 @@
|
|||||||
* ============================================================================
|
* ============================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Comment to use ZR Tools Extension, otherwise SDK Hooks Extension will be used.
|
|
||||||
#define USE_SDKHOOKS
|
|
||||||
|
|
||||||
#pragma semicolon 1
|
#pragma semicolon 1
|
||||||
#include <sourcemod>
|
#include <sourcemod>
|
||||||
#include <sdktools>
|
#include <sdktools>
|
||||||
@ -37,19 +34,7 @@
|
|||||||
#include <zombiereloaded>
|
#include <zombiereloaded>
|
||||||
#undef INCLUDED_BY_ZOMBIERELOADED
|
#undef INCLUDED_BY_ZOMBIERELOADED
|
||||||
|
|
||||||
#if defined USE_SDKHOOKS
|
#include <sdkhooks>
|
||||||
#include <sdkhooks>
|
|
||||||
|
|
||||||
#define ACTION_CONTINUE Plugin_Continue
|
|
||||||
#define ACTION_CHANGED Plugin_Changed
|
|
||||||
#define ACTION_HANDLED Plugin_Handled
|
|
||||||
#else
|
|
||||||
#include <zrtools>
|
|
||||||
|
|
||||||
#define ACTION_CONTINUE ZRTools_Continue
|
|
||||||
#define ACTION_CHANGED ZRTools_Changed
|
|
||||||
#define ACTION_HANDLED ZRTools_Handled
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define VERSION "3.1"
|
#define VERSION "3.1"
|
||||||
|
|
||||||
|
@ -59,11 +59,6 @@
|
|||||||
*/
|
*/
|
||||||
#define ANTISTICK_DEFAULT_HULL_WIDTH 32.0
|
#define ANTISTICK_DEFAULT_HULL_WIDTH 32.0
|
||||||
|
|
||||||
/**
|
|
||||||
* Stores "StartTouch" HookID's for each client.
|
|
||||||
*/
|
|
||||||
new g_iStartTouchHookID[MAXPLAYERS + 1] = {-1, ...};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of components that make up the model's rectangular boundaries.
|
* List of components that make up the model's rectangular boundaries.
|
||||||
*
|
*
|
||||||
@ -100,15 +95,7 @@ AntiStickOnCommandsCreate()
|
|||||||
*/
|
*/
|
||||||
AntiStickClientInit(client)
|
AntiStickClientInit(client)
|
||||||
{
|
{
|
||||||
// Hook "StartTouch" and "EndTouch" on client.
|
|
||||||
#if defined USE_SDKHOOKS
|
|
||||||
SDKHook(client, SDKHook_StartTouch, AntiStickStartTouch);
|
SDKHook(client, SDKHook_StartTouch, AntiStickStartTouch);
|
||||||
|
|
||||||
// Set dummy value so it think it's hooked.
|
|
||||||
g_iStartTouchHookID[client] = 1;
|
|
||||||
#else
|
|
||||||
g_iStartTouchHookID[client] = ZRTools_HookStartTouch(client, AntiStickStartTouch);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -118,17 +105,7 @@ AntiStickClientInit(client)
|
|||||||
*/
|
*/
|
||||||
AntiStickOnClientDisconnect(client)
|
AntiStickOnClientDisconnect(client)
|
||||||
{
|
{
|
||||||
// Unhook "StartTouch" callback, and reset variable.
|
|
||||||
if (g_iStartTouchHookID[client] != -1)
|
|
||||||
{
|
|
||||||
#if defined USE_SDKHOOKS
|
|
||||||
SDKUnhook(client, SDKHook_StartTouch, AntiStickStartTouch);
|
SDKUnhook(client, SDKHook_StartTouch, AntiStickStartTouch);
|
||||||
#else
|
|
||||||
ZRTools_UnhookStartTouch(g_iStartTouchHookID[client]);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
g_iStartTouchHookID[client] = -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -137,11 +114,7 @@ AntiStickOnClientDisconnect(client)
|
|||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
* @param entity The entity index of the entity being touched.
|
* @param entity The entity index of the entity being touched.
|
||||||
*/
|
*/
|
||||||
#if defined USE_SDKHOOKS
|
|
||||||
public AntiStickStartTouch(client, entity)
|
public AntiStickStartTouch(client, entity)
|
||||||
#else
|
|
||||||
public ZRTools_Action:AntiStickStartTouch(client, entity)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
// If antistick is disabled, then stop.
|
// If antistick is disabled, then stop.
|
||||||
new bool:antistick = GetConVarBool(g_hCvarsList[CVAR_ANTISTICK]);
|
new bool:antistick = GetConVarBool(g_hCvarsList[CVAR_ANTISTICK]);
|
||||||
|
@ -25,20 +25,6 @@
|
|||||||
* ============================================================================
|
* ============================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined USE_SDKHOOKS
|
|
||||||
/**
|
|
||||||
* @section Counter Strike: Source specific damage flags.
|
|
||||||
*/
|
|
||||||
#define DMG_CSS_FALL (DMG_FALL) // Client was damaged by falling.
|
|
||||||
#define DMG_CSS_BLAST (DMG_BLAST) // Client was damaged by explosion.
|
|
||||||
#define DMG_CSS_BURN (DMG_DIRECT) // Client was damaged by fire.
|
|
||||||
#define DMG_CSS_BULLET (DMG_NEVERGIB) // Client was shot or knifed.
|
|
||||||
#define DMG_CSS_HEADSHOT (1 << 30) // Client was shot in the head.
|
|
||||||
/**
|
|
||||||
* @endsection
|
|
||||||
*/
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @section Suicide intercept defines.
|
* @section Suicide intercept defines.
|
||||||
*/
|
*/
|
||||||
@ -48,16 +34,6 @@
|
|||||||
* @endsection
|
* @endsection
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* Array to store TraceAttack HookIDs.
|
|
||||||
*/
|
|
||||||
new g_iDamageTraceAttackHookID[MAXPLAYERS + 1] = {-1, ...};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Array to store OnTakeDamage HookIDs.
|
|
||||||
*/
|
|
||||||
new g_iDamageOnTakeDamageHookID[MAXPLAYERS + 1] = {-1, ...};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array to keep track of normal/mother zombies.
|
* Array to keep track of normal/mother zombies.
|
||||||
*/
|
*/
|
||||||
@ -108,17 +84,8 @@ DamageLoad()
|
|||||||
DamageClientInit(client)
|
DamageClientInit(client)
|
||||||
{
|
{
|
||||||
// Hook damage callbacks.
|
// Hook damage callbacks.
|
||||||
#if defined USE_SDKHOOKS
|
|
||||||
SDKHook(client, SDKHook_TraceAttack, DamageTraceAttack);
|
SDKHook(client, SDKHook_TraceAttack, DamageTraceAttack);
|
||||||
SDKHook(client, SDKHook_OnTakeDamage, DamageOnTakeDamage);
|
SDKHook(client, SDKHook_OnTakeDamage, DamageOnTakeDamage);
|
||||||
|
|
||||||
// Set dummy values so it think it's hooked.
|
|
||||||
g_iDamageTraceAttackHookID[client] = 1;
|
|
||||||
g_iDamageOnTakeDamageHookID[client] = 1;
|
|
||||||
#else
|
|
||||||
g_iDamageTraceAttackHookID[client] = ZRTools_HookTraceAttack(client, DamageTraceAttack);
|
|
||||||
g_iDamageOnTakeDamageHookID[client] = ZRTools_HookOnTakeDamage(client, DamageOnTakeDamage);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -128,29 +95,8 @@ DamageClientInit(client)
|
|||||||
*/
|
*/
|
||||||
DamageOnClientDisconnect(client)
|
DamageOnClientDisconnect(client)
|
||||||
{
|
{
|
||||||
// Unhook damage callbacks, and reset variables.
|
|
||||||
|
|
||||||
if (g_iDamageTraceAttackHookID[client] != -1)
|
|
||||||
{
|
|
||||||
#if defined USE_SDKHOOKS
|
|
||||||
SDKUnhook(client, SDKHook_TraceAttack, DamageTraceAttack);
|
SDKUnhook(client, SDKHook_TraceAttack, DamageTraceAttack);
|
||||||
#else
|
|
||||||
ZRTools_UnhookTraceAttack(g_iDamageTraceAttackHookID[client]);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
g_iDamageTraceAttackHookID[client] = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_iDamageOnTakeDamageHookID[client] != -1)
|
|
||||||
{
|
|
||||||
#if defined USE_SDKHOOKS
|
|
||||||
SDKUnhook(client, SDKHook_OnTakeDamage, DamageOnTakeDamage);
|
SDKUnhook(client, SDKHook_OnTakeDamage, DamageOnTakeDamage);
|
||||||
#else
|
|
||||||
ZRTools_UnhookOnTakeDamage(g_iDamageOnTakeDamageHookID[client]);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
g_iDamageOnTakeDamageHookID[client] = -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -175,25 +121,21 @@ DamageOnClientInfected(client, bool:motherinfect)
|
|||||||
* @param damage The amount of damage inflicted.
|
* @param damage The amount of damage inflicted.
|
||||||
* @param hitbox The hitbox index.
|
* @param hitbox The hitbox index.
|
||||||
* @param hitgroup The hitgroup index.
|
* @param hitgroup The hitgroup index.
|
||||||
* @return Return ZRTools_Handled to stop bullet from hitting client.
|
* @return Return Plugin_Handled to stop bullet from hitting client.
|
||||||
* ZRTools_Continue to allow bullet to hit client.
|
* Plugin_Continue to allow bullet to hit client.
|
||||||
*/
|
*/
|
||||||
#if defined USE_SDKHOOKS
|
|
||||||
public Action:DamageTraceAttack(client, &attacker, &inflictor, &Float:damage, &damagetype, &ammotype, hitbox, hitgroup)
|
public Action:DamageTraceAttack(client, &attacker, &inflictor, &Float:damage, &damagetype, &ammotype, hitbox, hitgroup)
|
||||||
#else
|
|
||||||
public ZRTools_Action:DamageTraceAttack(client, inflictor, attacker, Float:damage, hitbox, hitgroup)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
// If attacker isn't valid, then stop.
|
// If attacker isn't valid, then stop.
|
||||||
if (!ZRIsClientValid(attacker))
|
if (!ZRIsClientValid(attacker))
|
||||||
{
|
{
|
||||||
return ACTION_CONTINUE;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If client is attacking himself, then stop.
|
// If client is attacking himself, then stop.
|
||||||
if(attacker == client)
|
if(attacker == client)
|
||||||
{
|
{
|
||||||
return ACTION_CONTINUE;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get zombie flag for each client.
|
// Get zombie flag for each client.
|
||||||
@ -207,11 +149,11 @@ public ZRTools_Action:DamageTraceAttack(client, inflictor, attacker, Float:damag
|
|||||||
new bool:damageblockff = GetConVarBool(g_hCvarsList[CVAR_DAMAGE_BLOCK_FF]);
|
new bool:damageblockff = GetConVarBool(g_hCvarsList[CVAR_DAMAGE_BLOCK_FF]);
|
||||||
if (!damageblockff)
|
if (!damageblockff)
|
||||||
{
|
{
|
||||||
return ACTION_CONTINUE;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop bullet from hurting client.
|
// Stop bullet from hurting client.
|
||||||
return ACTION_HANDLED;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Here we know that attacker and client are different teams.
|
// Here we know that attacker and client are different teams.
|
||||||
@ -220,14 +162,14 @@ public ZRTools_Action:DamageTraceAttack(client, inflictor, attacker, Float:damag
|
|||||||
if (ImmunityOnClientTraceAttack(client, attacker, damage, hitgroup, damagetype))
|
if (ImmunityOnClientTraceAttack(client, attacker, damage, hitgroup, damagetype))
|
||||||
{
|
{
|
||||||
// Block damage.
|
// Block damage.
|
||||||
return ACTION_HANDLED;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If client is a human, then allow damage.
|
// If client is a human, then allow damage.
|
||||||
if (InfectIsClientHuman(client))
|
if (InfectIsClientHuman(client))
|
||||||
{
|
{
|
||||||
// Allow damage.
|
// Allow damage.
|
||||||
return ACTION_CONTINUE;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If damage hitgroups cvar is disabled, then allow damage.
|
// If damage hitgroups cvar is disabled, then allow damage.
|
||||||
@ -237,7 +179,7 @@ public ZRTools_Action:DamageTraceAttack(client, inflictor, attacker, Float:damag
|
|||||||
if (!damagehitgroups)
|
if (!damagehitgroups)
|
||||||
{
|
{
|
||||||
// Allow damage.
|
// Allow damage.
|
||||||
return ACTION_CONTINUE;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If damage is disabled for this hitgroup, then stop.
|
// If damage is disabled for this hitgroup, then stop.
|
||||||
@ -247,18 +189,18 @@ public ZRTools_Action:DamageTraceAttack(client, inflictor, attacker, Float:damag
|
|||||||
if (index == -1)
|
if (index == -1)
|
||||||
{
|
{
|
||||||
// Allow damage.
|
// Allow damage.
|
||||||
return ACTION_CONTINUE;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
new bool:candamage = HitgroupsCanDamage(index);
|
new bool:candamage = HitgroupsCanDamage(index);
|
||||||
if (!candamage)
|
if (!candamage)
|
||||||
{
|
{
|
||||||
// Stop bullet from hurting client.
|
// Stop bullet from hurting client.
|
||||||
return ACTION_HANDLED;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow damage.
|
// Allow damage.
|
||||||
return ACTION_CONTINUE;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -271,14 +213,10 @@ public ZRTools_Action:DamageTraceAttack(client, inflictor, attacker, Float:damag
|
|||||||
* @param damage The amount of damage inflicted.
|
* @param damage The amount of damage inflicted.
|
||||||
* @param damagetype The type of damage inflicted.
|
* @param damagetype The type of damage inflicted.
|
||||||
* @param ammotype The ammo type of the attacker's weapon.
|
* @param ammotype The ammo type of the attacker's weapon.
|
||||||
* @return Return ZRTools_Handled to stop the damage to client.
|
* @return Return Plugin_Handled to stop the damage to client.
|
||||||
* ZRTools_Continue to allow damage to client.
|
* Plugin_Continue to allow damage to client.
|
||||||
*/
|
*/
|
||||||
#if defined USE_SDKHOOKS
|
|
||||||
public Action:DamageOnTakeDamage(client, &attacker, &inflictor, &Float:damage, &damagetype)
|
public Action:DamageOnTakeDamage(client, &attacker, &inflictor, &Float:damage, &damagetype)
|
||||||
#else
|
|
||||||
public ZRTools_Action:DamageOnTakeDamage(client, inflictor, attacker, Float:damage, damagetype, ammotype)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
// Get classname of the inflictor.
|
// Get classname of the inflictor.
|
||||||
decl String:classname[64];
|
decl String:classname[64];
|
||||||
@ -287,31 +225,27 @@ public ZRTools_Action:DamageOnTakeDamage(client, inflictor, attacker, Float:dama
|
|||||||
// If entity is a trigger, then allow damage. (Map is damaging client)
|
// If entity is a trigger, then allow damage. (Map is damaging client)
|
||||||
if (StrContains(classname, "trigger") > -1)
|
if (StrContains(classname, "trigger") > -1)
|
||||||
{
|
{
|
||||||
return ACTION_CONTINUE;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
new action;
|
new Action:action;
|
||||||
|
|
||||||
// Forward this hook to another module an return (or not) what it wants.
|
// Forward this hook to another module an return (or not) what it wants.
|
||||||
action = NapalmOnTakeDamage(client, damagetype);
|
action = Action:NapalmOnTakeDamage(client, damagetype);
|
||||||
|
|
||||||
// If the napalm module wants to return here, then return the int casted into the action type.
|
// If the napalm module wants to return here, then return the int casted into the action type.
|
||||||
if (action > -1)
|
if (action > Action:-1)
|
||||||
{
|
{
|
||||||
#if defined USE_SDKHOOKS
|
return action;
|
||||||
return Action:action;
|
|
||||||
#else
|
|
||||||
return ZRTools_Action:action;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Client was shot or knifed.
|
// Client was shot or knifed.
|
||||||
if (damagetype & DMG_CSS_BULLET)
|
if (damagetype & DMG_BULLET || damagetype & DMG_NEVERGIB)
|
||||||
{
|
{
|
||||||
// If attacker isn't valid, then allow damage.
|
// If attacker isn't valid, then allow damage.
|
||||||
if (!ZRIsClientValid(attacker))
|
if (!ZRIsClientValid(attacker))
|
||||||
{
|
{
|
||||||
return ACTION_CONTINUE;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get zombie flag for each client.
|
// Get zombie flag for each client.
|
||||||
@ -321,7 +255,7 @@ public ZRTools_Action:DamageOnTakeDamage(client, inflictor, attacker, Float:dama
|
|||||||
// If client and attacker are on the same team, then let CS:S handle the rest.
|
// If client and attacker are on the same team, then let CS:S handle the rest.
|
||||||
if (clientzombie == attackerzombie)
|
if (clientzombie == attackerzombie)
|
||||||
{
|
{
|
||||||
return ACTION_CONTINUE;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We know that clientzombie is the opposite of attacker zombie.
|
// We know that clientzombie is the opposite of attacker zombie.
|
||||||
@ -329,7 +263,7 @@ public ZRTools_Action:DamageOnTakeDamage(client, inflictor, attacker, Float:dama
|
|||||||
// If the client is a zombie, then allow damage.
|
// If the client is a zombie, then allow damage.
|
||||||
if (clientzombie)
|
if (clientzombie)
|
||||||
{
|
{
|
||||||
return ACTION_CONTINUE;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if immunity module blocked or modified the damage.
|
// Check if immunity module blocked or modified the damage.
|
||||||
@ -367,50 +301,50 @@ public ZRTools_Action:DamageOnTakeDamage(client, inflictor, attacker, Float:dama
|
|||||||
SetEntityHealth(client, health + RoundToNearest(damage));
|
SetEntityHealth(client, health + RoundToNearest(damage));
|
||||||
|
|
||||||
// Allow damage.
|
// Allow damage.
|
||||||
return ACTION_CONTINUE;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Client was damaged by explosion.
|
// Client was damaged by explosion.
|
||||||
else if (damagetype & DMG_CSS_BLAST)
|
else if (damagetype & DMG_BLAST)
|
||||||
{
|
{
|
||||||
// If blast damage is blocked, then stop.
|
// If blast damage is blocked, then stop.
|
||||||
new bool:damageblockblast = GetConVarBool(g_hCvarsList[CVAR_DAMAGE_BLOCK_BLAST]);
|
new bool:damageblockblast = GetConVarBool(g_hCvarsList[CVAR_DAMAGE_BLOCK_BLAST]);
|
||||||
if (!damageblockblast)
|
if (!damageblockblast)
|
||||||
{
|
{
|
||||||
return ACTION_CONTINUE;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If attacker isn't valid, then allow damage.
|
// If attacker isn't valid, then allow damage.
|
||||||
if (!ZRIsClientValid(attacker))
|
if (!ZRIsClientValid(attacker))
|
||||||
{
|
{
|
||||||
return ACTION_CONTINUE;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If client is a zombie, then allow damage.
|
// If client is a zombie, then allow damage.
|
||||||
if (InfectIsClientInfected(client))
|
if (InfectIsClientInfected(client))
|
||||||
{
|
{
|
||||||
return ACTION_CONTINUE;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop damage.
|
// Stop damage.
|
||||||
return ACTION_HANDLED;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
// Client was damaged by falling.
|
// Client was damaged by falling.
|
||||||
else if (damagetype & DMG_CSS_FALL)
|
else if (damagetype & DMG_FALL)
|
||||||
{
|
{
|
||||||
// If class has "nofalldamage" disabled, then allow damage.
|
// If class has "nofalldamage" disabled, then allow damage.
|
||||||
new bool:blockfalldamage = ClassGetNoFallDamage(client);
|
new bool:blockfalldamage = ClassGetNoFallDamage(client);
|
||||||
if (!blockfalldamage)
|
if (!blockfalldamage)
|
||||||
{
|
{
|
||||||
return ACTION_CONTINUE;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop damage.
|
// Stop damage.
|
||||||
return ACTION_HANDLED;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow damage.
|
// Allow damage.
|
||||||
return ACTION_CONTINUE;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -65,14 +65,15 @@ NapalmOnOffsetsFound()
|
|||||||
*
|
*
|
||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
* @param damagetype The type of damage inflicted.
|
* @param damagetype The type of damage inflicted.
|
||||||
* @return Return ZRTools_Handled to stop the damage to client.
|
* @return Return Plugin_Handled to stop the damage to client.
|
||||||
* ZRTools_Continue to allow damage to client.
|
* Plugin_Continue to allow damage to client.
|
||||||
* Return -1 to not return anything and let the damage module continue as usual.
|
* Return -1 to not return anything and let the damage module continue as usual.
|
||||||
*/
|
*/
|
||||||
NapalmOnTakeDamage(client, damagetype)
|
NapalmOnTakeDamage(client, damagetype)
|
||||||
{
|
{
|
||||||
// Client was damaged by fire.
|
// Client was damaged by fire.
|
||||||
if (damagetype & DMG_CSS_BURN)
|
// TODO: Is damage type different in CS:S and CS:GO (it was checking only DMG_DIRECT for some reason). Checking both.
|
||||||
|
if (damagetype & DMG_BURN || damagetype & DMG_DIRECT)
|
||||||
{
|
{
|
||||||
// Only take action if it isn't disabled, or the option is valid.
|
// Only take action if it isn't disabled, or the option is valid.
|
||||||
new douse = GetConVarInt(g_hCvarsList[CVAR_NAPALM_DOUSE]);
|
new douse = GetConVarInt(g_hCvarsList[CVAR_NAPALM_DOUSE]);
|
||||||
@ -104,7 +105,7 @@ NapalmOnTakeDamage(client, damagetype)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return _:ACTION_CONTINUE;
|
return _:Plugin_Continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,11 +38,6 @@ enum RestrictData
|
|||||||
RESTRICT_DATA_NAME = 0,
|
RESTRICT_DATA_NAME = 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Array that stores the "HookID" to be later unhooked on player disconnect.
|
|
||||||
*/
|
|
||||||
new g_iCanUseHookID[MAXPLAYERS + 1] = {-1, ...};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array to block any client from picking up weapons.
|
* Array to block any client from picking up weapons.
|
||||||
*/
|
*/
|
||||||
@ -137,17 +132,7 @@ RestrictOnCommandsCreate()
|
|||||||
*/
|
*/
|
||||||
RestrictClientInit(client)
|
RestrictClientInit(client)
|
||||||
{
|
{
|
||||||
// Hook "Weapon_CanUse" on client.
|
|
||||||
#if defined USE_SDKHOOKS
|
|
||||||
SDKHook(client, SDKHook_WeaponCanUse, RestrictCanUse);
|
SDKHook(client, SDKHook_WeaponCanUse, RestrictCanUse);
|
||||||
|
|
||||||
// Set dummy value so it think it's hooked.
|
|
||||||
g_iCanUseHookID[client] = 1;
|
|
||||||
#else
|
|
||||||
g_iCanUseHookID[client] = ZRTools_HookWeapon_CanUse(client, RestrictCanUse);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Reset block weapons flag.
|
|
||||||
g_bRestrictBlockWeapon[client] = false;
|
g_bRestrictBlockWeapon[client] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,17 +143,7 @@ RestrictClientInit(client)
|
|||||||
*/
|
*/
|
||||||
RestrictOnClientDisconnect(client)
|
RestrictOnClientDisconnect(client)
|
||||||
{
|
{
|
||||||
// Unhook "Weapon_CanUse" callback, and reset variable.
|
|
||||||
if (g_iCanUseHookID[client] != -1)
|
|
||||||
{
|
|
||||||
#if defined USE_SDKHOOKS
|
|
||||||
SDKUnhook(client, SDKHook_WeaponCanUse, RestrictCanUse);
|
SDKUnhook(client, SDKHook_WeaponCanUse, RestrictCanUse);
|
||||||
#else
|
|
||||||
ZRTools_UnhookWeapon_CanUse(g_iCanUseHookID[client]);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
g_iCanUseHookID[client] = -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -179,17 +154,15 @@ RestrictOnClientDisconnect(client)
|
|||||||
RestrictOnClientSpawn(client)
|
RestrictOnClientSpawn(client)
|
||||||
{
|
{
|
||||||
// Re-hook "canuse" on client.
|
// Re-hook "canuse" on client.
|
||||||
#if defined USE_SDKHOOKS
|
SDKUnhook(client, SDKHook_WeaponCanUse, RestrictCanUse);
|
||||||
SDKUnhook(client, SDKHook_WeaponCanUse, RestrictCanUse); // <--- What happens if it's not already hooked???
|
|
||||||
SDKHook(client, SDKHook_WeaponCanUse, RestrictCanUse);
|
SDKHook(client, SDKHook_WeaponCanUse, RestrictCanUse);
|
||||||
g_iCanUseHookID[client] = 1;
|
|
||||||
#else
|
|
||||||
ZRTools_UnhookWeapon_CanUse(g_iCanUseHookID[client]);
|
|
||||||
g_iCanUseHookID[client] = ZRTools_HookWeapon_CanUse(client, RestrictCanUse);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// H4x. Unfortunately I can't disable this flag early enough for CS:S to give start USP/Glock.
|
// H4x. Unfortunately I can't disable this flag early enough for CS:S to give start USP/Glock.
|
||||||
// So I have to give BOOTLEG weapons. (Sorry Valve)
|
// So I have to give BOOTLEG weapons. (Sorry Valve)
|
||||||
|
|
||||||
|
// CS:GO TODO: Move this into separate functions for CS:S and CS:GO. And
|
||||||
|
// call the correct function.
|
||||||
|
|
||||||
if (g_bRestrictBlockWeapon[client])
|
if (g_bRestrictBlockWeapon[client])
|
||||||
{
|
{
|
||||||
// Reset block weapons flag.
|
// Reset block weapons flag.
|
||||||
@ -610,48 +583,47 @@ stock bool:RestrictIsTypeUniform(bool:restricted, index)
|
|||||||
* Hook callback, called when a player is trying to pick up a weapon.
|
* Hook callback, called when a player is trying to pick up a weapon.
|
||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
* @param weapon The weapon index.
|
* @param weapon The weapon index.
|
||||||
* @return Return ZRTools_Handled to stop weapon pickup.
|
* @return Return Plugin_Handled to stop weapon pickup.
|
||||||
* ZRTools_Continue to allow weapon pickup.
|
* Plugin_Continue to allow weapon pickup.
|
||||||
*/
|
*/
|
||||||
#if defined USE_SDKHOOKS
|
|
||||||
public Action:RestrictCanUse(client, weapon)
|
public Action:RestrictCanUse(client, weapon)
|
||||||
#else
|
|
||||||
public ZRTools_Action:RestrictCanUse(client, weapon)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
|
// WARNING: This function is called _frequently_. Every game tick per
|
||||||
|
// player, I think. Make sure any code here is optimized.
|
||||||
|
|
||||||
new String:weaponentity[WEAPONS_MAX_LENGTH];
|
new String:weaponentity[WEAPONS_MAX_LENGTH];
|
||||||
GetEdictClassname(weapon, weaponentity, sizeof(weaponentity));
|
GetEdictClassname(weapon, weaponentity, sizeof(weaponentity));
|
||||||
|
|
||||||
// If weapon is a knife, then allow pickup.
|
// If weapon is a knife, then allow pickup.
|
||||||
if (StrEqual(weaponentity, "weapon_knife"))
|
if (StrEqual(weaponentity, "weapon_knife"))
|
||||||
{
|
{
|
||||||
return ACTION_CONTINUE;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the player is a zombie, then prevent pickup.
|
// If the player is a zombie, then prevent pickup.
|
||||||
if (InfectIsClientInfected(client))
|
if (InfectIsClientInfected(client))
|
||||||
{
|
{
|
||||||
return ACTION_HANDLED;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If client is flagged for not picking up weapons, then stop.
|
// If client is flagged for not picking up weapons, then stop.
|
||||||
if (g_bRestrictBlockWeapon[client])
|
if (g_bRestrictBlockWeapon[client])
|
||||||
{
|
{
|
||||||
return ACTION_HANDLED;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If weapons module is disabled, then stop.
|
// If weapons module is disabled, then stop.
|
||||||
new bool:weapons = GetConVarBool(g_hCvarsList[CVAR_WEAPONS]);
|
new bool:weapons = GetConVarBool(g_hCvarsList[CVAR_WEAPONS]);
|
||||||
if (!weapons)
|
if (!weapons)
|
||||||
{
|
{
|
||||||
return ACTION_CONTINUE;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If restrict module is disabled, then stop.
|
// If restrict module is disabled, then stop.
|
||||||
new bool:restrict = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_RESTRICT]);
|
new bool:restrict = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_RESTRICT]);
|
||||||
if (!restrict)
|
if (!restrict)
|
||||||
{
|
{
|
||||||
return ACTION_CONTINUE;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the weapon is restricted, then prevent pickup.
|
// If the weapon is restricted, then prevent pickup.
|
||||||
@ -662,20 +634,20 @@ public ZRTools_Action:RestrictCanUse(client, weapon)
|
|||||||
if (weaponindex == -1)
|
if (weaponindex == -1)
|
||||||
{
|
{
|
||||||
// Allow pickup.
|
// Allow pickup.
|
||||||
return ACTION_CONTINUE;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If weapon is restricted, then stop.
|
// If weapon is restricted, then stop.
|
||||||
if (RestrictIsWeaponRestricted(weaponindex))
|
if (RestrictIsWeaponRestricted(weaponindex))
|
||||||
{
|
{
|
||||||
return ACTION_HANDLED;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Forward event to weapons module.
|
// Forward event to weapons module.
|
||||||
WeaponsOnItemPickup(client, weapon);
|
WeaponsOnItemPickup(client, weapon);
|
||||||
|
|
||||||
// Allow pickup.
|
// Allow pickup.
|
||||||
return ACTION_CONTINUE;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,11 +30,6 @@
|
|||||||
*/
|
*/
|
||||||
#define WEAPONALPHA_DEFAULT_VALUE 255
|
#define WEAPONALPHA_DEFAULT_VALUE 255
|
||||||
|
|
||||||
/**
|
|
||||||
* Array that stores the "HookID" to be later unhooked on player disconnect.
|
|
||||||
*/
|
|
||||||
new g_iWeaponDropHookID[MAXPLAYERS + 1] = {-1, ...};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Client is joining the server.
|
* Client is joining the server.
|
||||||
*
|
*
|
||||||
@ -43,15 +38,7 @@ new g_iWeaponDropHookID[MAXPLAYERS + 1] = {-1, ...};
|
|||||||
WeaponAlphaClientInit(client)
|
WeaponAlphaClientInit(client)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
// Hook "Weapon_Drop" on client.
|
|
||||||
#if defined USE_SDKHOOKS
|
|
||||||
SDKHook(client, SDKHook_WeaponDrop, WeaponAlphaDrop);
|
SDKHook(client, SDKHook_WeaponDrop, WeaponAlphaDrop);
|
||||||
|
|
||||||
// Set dummy value so it think it's hooked.
|
|
||||||
g_iWeaponDropHookID[client] = 1;
|
|
||||||
#else
|
|
||||||
g_iWeaponDropHookID[client] = ZRTools_HookWeapon_Drop(client, WeaponAlphaDrop);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -62,17 +49,7 @@ WeaponAlphaClientInit(client)
|
|||||||
WeaponAlphaOnClientDisconnect(client)
|
WeaponAlphaOnClientDisconnect(client)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
// Unhook "Weapon_Drop" callback, and reset variable.
|
|
||||||
if (g_iWeaponDropHookID[client] != -1)
|
|
||||||
{
|
|
||||||
#if defined USE_SDKHOOKS
|
|
||||||
SDKUnhook(client, SDKHook_WeaponDrop, WeaponAlphaDrop);
|
SDKUnhook(client, SDKHook_WeaponDrop, WeaponAlphaDrop);
|
||||||
#else
|
|
||||||
ZRTools_UnhookWeapon_Drop(g_iWeaponDropHookID[client]);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
g_iWeaponDropHookID[client] = -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -108,11 +85,7 @@ WeaponAlphaOnItemPickupPost(client, weapon)
|
|||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
* @param weapon The weapon index.
|
* @param weapon The weapon index.
|
||||||
*/
|
*/
|
||||||
#if defined USE_SDKHOOKS
|
|
||||||
public Action:WeaponAlphaDrop(client, weapon)
|
public Action:WeaponAlphaDrop(client, weapon)
|
||||||
#else
|
|
||||||
public ZRTools_Action:WeaponAlphaDrop(client, weapon)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
// If weapon isn't a valid entity, then stop.
|
// If weapon isn't a valid entity, then stop.
|
||||||
|
Loading…
Reference in New Issue
Block a user