Merge
This commit is contained in:
commit
4bb9fa90a0
4
env/include/sdkhooks.inc
vendored
4
env/include/sdkhooks.inc
vendored
@ -54,6 +54,7 @@ enum SDKHookType
|
|||||||
SDKHook_Touch,
|
SDKHook_Touch,
|
||||||
SDKHook_TraceAttack,
|
SDKHook_TraceAttack,
|
||||||
SDKHook_TraceAttackPost,
|
SDKHook_TraceAttackPost,
|
||||||
|
SDKHook_WeaponCanSwitchTo,
|
||||||
SDKHook_WeaponCanUse,
|
SDKHook_WeaponCanUse,
|
||||||
SDKHook_WeaponDrop,
|
SDKHook_WeaponDrop,
|
||||||
SDKHook_WeaponEquip,
|
SDKHook_WeaponEquip,
|
||||||
@ -74,6 +75,7 @@ funcenum SDKHookCB
|
|||||||
public(entity, other),
|
public(entity, other),
|
||||||
// SetTransmit
|
// SetTransmit
|
||||||
Action:public(entity, client),
|
Action:public(entity, client),
|
||||||
|
// WeaponCanSwitchTo
|
||||||
// WeaponCanUse
|
// WeaponCanUse
|
||||||
// WeaponDrop
|
// WeaponDrop
|
||||||
// WeaponEquip
|
// WeaponEquip
|
||||||
@ -84,7 +86,7 @@ funcenum SDKHookCB
|
|||||||
// OnTakeDamagePost
|
// OnTakeDamagePost
|
||||||
public(victim, attacker, inflictor, Float:damage, damagetype),
|
public(victim, attacker, inflictor, Float:damage, damagetype),
|
||||||
// FireBullets
|
// FireBullets
|
||||||
public(client, shots, String:weaponname[]),
|
public(client, shots, const String:weaponname[]),
|
||||||
// TraceAttack
|
// TraceAttack
|
||||||
Action:public(victim, &attacker, &inflictor, &Float:damage, &damagetype, &ammotype, hitbox, hitgroup),
|
Action:public(victim, &attacker, &inflictor, &Float:damage, &damagetype, &ammotype, hitbox, hitgroup),
|
||||||
// TraceAttackPost
|
// TraceAttackPost
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Comment to use ZR Tools Extension, otherwise SDK Hooks Extension will be used.
|
// Comment to use ZR Tools Extension, otherwise SDK Hooks Extension will be used.
|
||||||
//#define USE_SDKHOOKS
|
#define USE_SDKHOOKS
|
||||||
|
|
||||||
#pragma semicolon 1
|
#pragma semicolon 1
|
||||||
#include <sourcemod>
|
#include <sourcemod>
|
||||||
|
@ -74,7 +74,7 @@ AccountOnClientSpawn(client)
|
|||||||
* @param attacker The attacker index.
|
* @param attacker The attacker index.
|
||||||
* @param dmg The amount of damage inflicted.
|
* @param dmg The amount of damage inflicted.
|
||||||
*/
|
*/
|
||||||
AccountOnClientHurt(attacker, dmg_health)
|
AccountOnClientHurt(client, attacker, dmg_health)
|
||||||
{
|
{
|
||||||
// If attacker isn't valid, then stop.
|
// If attacker isn't valid, then stop.
|
||||||
if (!ZRIsClientValid(attacker))
|
if (!ZRIsClientValid(attacker))
|
||||||
@ -89,6 +89,18 @@ AccountOnClientHurt(attacker, dmg_health)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If attacker is hurting themself, then stop.
|
||||||
|
if (client == attacker)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If attacker isn't a human, then stop.
|
||||||
|
if (!InfectIsClientHuman(attacker))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Get current cash, add the damage done to it, then set new value.
|
// Get current cash, add the damage done to it, then set new value.
|
||||||
new cash = AccountGetClientCash(attacker);
|
new cash = AccountGetClientCash(attacker);
|
||||||
AccountSetClientCash(attacker, cash + dmg_health);
|
AccountSetClientCash(attacker, cash + dmg_health);
|
||||||
|
@ -364,7 +364,7 @@ public ZRTools_Action:DamageOnTakeDamage(client, inflictor, attacker, Float:dama
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Command callback (kill, jointeam, spectate)
|
* Command callback (kill, spectate, jointeam, joinclass)
|
||||||
* Block command if plugin thinks they are trying to commit suicide.
|
* Block command if plugin thinks they are trying to commit suicide.
|
||||||
*
|
*
|
||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
@ -398,31 +398,37 @@ public Action:DamageSuicideIntercept(client, argc)
|
|||||||
// Check if client is a zombie.
|
// Check if client is a zombie.
|
||||||
if (InfectIsClientInfected(client))
|
if (InfectIsClientInfected(client))
|
||||||
{
|
{
|
||||||
// If client is a normal zombie, and suicide intercept is disabled for zombies, then let command go.
|
// If client is a mother zombie, and suicide intercept is enabled for mother zombies zombies, then block command.
|
||||||
if (!g_bDamageMotherZombie[client] && !suicidezombie)
|
if (g_bDamageMotherZombie[client] && suicidezombiemother)
|
||||||
{
|
{
|
||||||
return Plugin_Continue;
|
// Tell client their command has been intercepted, and log.
|
||||||
}
|
|
||||||
|
|
||||||
// If client is a mother zombie, and suicide intercept is disabled for mother zombies, then let command go.
|
|
||||||
if (g_bDamageMotherZombie[client] && !suicidezombiemother)
|
|
||||||
{
|
|
||||||
return Plugin_Continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If client is a human, and suicide intercept is disabled for humans, then let command go.
|
|
||||||
if (InfectIsClientHuman(client) && !suicidehuman)
|
|
||||||
{
|
|
||||||
return Plugin_Continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tell client their command has been intercepted.
|
|
||||||
TranslationPrintToChat(client, "Damage suicide intercept");
|
TranslationPrintToChat(client, "Damage suicide intercept");
|
||||||
|
|
||||||
// Log suicide interception
|
|
||||||
LogEvent(false, LogType_Normal, LOG_GAME_EVENTS, LogModule_Damage, "Suicide Intercept", "Player \"%L\" attempted suicide.", client);
|
LogEvent(false, LogType_Normal, LOG_GAME_EVENTS, LogModule_Damage, "Suicide Intercept", "Player \"%L\" attempted suicide.", client);
|
||||||
|
|
||||||
// Block command.
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If client is a zombie, and suicide intercept is enabled for zombies, then block command.
|
||||||
|
if (!g_bDamageMotherZombie[client] && suicidezombie)
|
||||||
|
{
|
||||||
|
// Tell client their command has been intercepted, and log.
|
||||||
|
TranslationPrintToChat(client, "Damage suicide intercept");
|
||||||
|
LogEvent(false, LogType_Normal, LOG_GAME_EVENTS, LogModule_Damage, "Suicide Intercept", "Player \"%L\" attempted suicide.", client);
|
||||||
|
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If client is a human, and suicide intercept is enabled for humans, then block command.
|
||||||
|
if (InfectIsClientHuman(client) && suicidehuman)
|
||||||
|
{
|
||||||
|
// Tell client their command has been intercepted, and log.
|
||||||
|
TranslationPrintToChat(client, "Damage suicide intercept");
|
||||||
|
LogEvent(false, LogType_Normal, LOG_GAME_EVENTS, LogModule_Damage, "Suicide Intercept", "Player \"%L\" attempted suicide.", client);
|
||||||
|
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allow command.
|
||||||
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
@ -239,7 +239,7 @@ public Action:EventPlayerHurt(Handle:event, const String:name[], bool:dontBroadc
|
|||||||
// Forward event to modules.
|
// Forward event to modules.
|
||||||
ClassAlphaUpdate(index);
|
ClassAlphaUpdate(index);
|
||||||
InfectOnClientHurt(index, attacker, weapon);
|
InfectOnClientHurt(index, attacker, weapon);
|
||||||
AccountOnClientHurt(attacker, dmg_health);
|
AccountOnClientHurt(index, attacker, dmg_health);
|
||||||
SEffectsOnClientHurt(index);
|
SEffectsOnClientHurt(index);
|
||||||
KnockbackOnClientHurt(index, attacker, weapon, hitgroup, dmg_health);
|
KnockbackOnClientHurt(index, attacker, weapon, hitgroup, dmg_health);
|
||||||
NapalmOnClientHurt(index, attacker, weapon);
|
NapalmOnClientHurt(index, attacker, weapon);
|
||||||
|
@ -139,10 +139,7 @@ RestrictClientInit(client)
|
|||||||
{
|
{
|
||||||
// Hook "Weapon_CanUse" on client.
|
// Hook "Weapon_CanUse" on client.
|
||||||
#if defined USE_SDKHOOKS
|
#if defined USE_SDKHOOKS
|
||||||
SDKHook(client, SDKHook_WeaponEquip, RestrictCanUse);
|
SDKHook(client, SDKHook_WeaponCanUse, RestrictCanUse);
|
||||||
|
|
||||||
// Note: Do we need to use WeaponSwitch too? On infection all weapons
|
|
||||||
// are removed anyways.
|
|
||||||
|
|
||||||
// Set dummy value so it think it's hooked.
|
// Set dummy value so it think it's hooked.
|
||||||
g_iCanUseHookID[client] = 1;
|
g_iCanUseHookID[client] = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user