Remove unused legacy ZRTools code.
This commit is contained in:
committed by
Oleg Tsvetkov
parent
71d5c297d3
commit
6550dd9e02
@ -38,11 +38,6 @@ enum RestrictData
|
||||
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.
|
||||
*/
|
||||
@ -137,17 +132,7 @@ RestrictOnCommandsCreate()
|
||||
*/
|
||||
RestrictClientInit(client)
|
||||
{
|
||||
// Hook "Weapon_CanUse" on client.
|
||||
#if defined USE_SDKHOOKS
|
||||
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.
|
||||
SDKHook(client, SDKHook_WeaponCanUse, RestrictCanUse);
|
||||
g_bRestrictBlockWeapon[client] = false;
|
||||
}
|
||||
|
||||
@ -158,17 +143,7 @@ RestrictClientInit(client)
|
||||
*/
|
||||
RestrictOnClientDisconnect(client)
|
||||
{
|
||||
// Unhook "Weapon_CanUse" callback, and reset variable.
|
||||
if (g_iCanUseHookID[client] != -1)
|
||||
{
|
||||
#if defined USE_SDKHOOKS
|
||||
SDKUnhook(client, SDKHook_WeaponCanUse, RestrictCanUse);
|
||||
#else
|
||||
ZRTools_UnhookWeapon_CanUse(g_iCanUseHookID[client]);
|
||||
#endif
|
||||
|
||||
g_iCanUseHookID[client] = -1;
|
||||
}
|
||||
SDKUnhook(client, SDKHook_WeaponCanUse, RestrictCanUse);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -179,17 +154,15 @@ RestrictOnClientDisconnect(client)
|
||||
RestrictOnClientSpawn(client)
|
||||
{
|
||||
// Re-hook "canuse" on client.
|
||||
#if defined USE_SDKHOOKS
|
||||
SDKUnhook(client, SDKHook_WeaponCanUse, RestrictCanUse); // <--- What happens if it's not already hooked???
|
||||
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
|
||||
SDKUnhook(client, SDKHook_WeaponCanUse, RestrictCanUse);
|
||||
SDKHook(client, SDKHook_WeaponCanUse, RestrictCanUse);
|
||||
|
||||
// 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)
|
||||
|
||||
// CS:GO TODO: Move this into separate functions for CS:S and CS:GO. And
|
||||
// call the correct function.
|
||||
|
||||
if (g_bRestrictBlockWeapon[client])
|
||||
{
|
||||
// Reset block weapons flag.
|
||||
@ -613,45 +586,44 @@ stock bool:RestrictIsTypeUniform(bool:restricted, index)
|
||||
* @return Return ZRTools_Handled to stop weapon pickup.
|
||||
* ZRTools_Continue to allow weapon pickup.
|
||||
*/
|
||||
#if defined USE_SDKHOOKS
|
||||
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];
|
||||
GetEdictClassname(weapon, weaponentity, sizeof(weaponentity));
|
||||
|
||||
// If weapon is a knife, then allow pickup.
|
||||
if (StrEqual(weaponentity, "weapon_knife"))
|
||||
{
|
||||
return ACTION_CONTINUE;
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
// If the player is a zombie, then prevent pickup.
|
||||
if (InfectIsClientInfected(client))
|
||||
{
|
||||
return ACTION_HANDLED;
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
// If client is flagged for not picking up weapons, then stop.
|
||||
if (g_bRestrictBlockWeapon[client])
|
||||
{
|
||||
return ACTION_HANDLED;
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
// If weapons module is disabled, then stop.
|
||||
new bool:weapons = GetConVarBool(g_hCvarsList[CVAR_WEAPONS]);
|
||||
if (!weapons)
|
||||
{
|
||||
return ACTION_CONTINUE;
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
// If restrict module is disabled, then stop.
|
||||
new bool:restrict = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_RESTRICT]);
|
||||
if (!restrict)
|
||||
{
|
||||
return ACTION_CONTINUE;
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
// If the weapon is restricted, then prevent pickup.
|
||||
@ -662,20 +634,20 @@ public ZRTools_Action:RestrictCanUse(client, weapon)
|
||||
if (weaponindex == -1)
|
||||
{
|
||||
// Allow pickup.
|
||||
return ACTION_CONTINUE;
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
// If weapon is restricted, then stop.
|
||||
if (RestrictIsWeaponRestricted(weaponindex))
|
||||
{
|
||||
return ACTION_HANDLED;
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
// Forward event to weapons module.
|
||||
WeaponsOnItemPickup(client, weapon);
|
||||
|
||||
// Allow pickup.
|
||||
return ACTION_CONTINUE;
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -30,11 +30,6 @@
|
||||
*/
|
||||
#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.
|
||||
*
|
||||
@ -43,15 +38,7 @@ new g_iWeaponDropHookID[MAXPLAYERS + 1] = {-1, ...};
|
||||
WeaponAlphaClientInit(client)
|
||||
{
|
||||
return;
|
||||
// Hook "Weapon_Drop" on client.
|
||||
#if defined USE_SDKHOOKS
|
||||
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
|
||||
SDKHook(client, SDKHook_WeaponDrop, WeaponAlphaDrop);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -62,17 +49,7 @@ WeaponAlphaClientInit(client)
|
||||
WeaponAlphaOnClientDisconnect(client)
|
||||
{
|
||||
return;
|
||||
// Unhook "Weapon_Drop" callback, and reset variable.
|
||||
if (g_iWeaponDropHookID[client] != -1)
|
||||
{
|
||||
#if defined USE_SDKHOOKS
|
||||
SDKUnhook(client, SDKHook_WeaponDrop, WeaponAlphaDrop);
|
||||
#else
|
||||
ZRTools_UnhookWeapon_Drop(g_iWeaponDropHookID[client]);
|
||||
#endif
|
||||
|
||||
g_iWeaponDropHookID[client] = -1;
|
||||
}
|
||||
SDKUnhook(client, SDKHook_WeaponDrop, WeaponAlphaDrop);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -108,11 +85,7 @@ WeaponAlphaOnItemPickupPost(client, weapon)
|
||||
* @param client The client index.
|
||||
* @param weapon The weapon index.
|
||||
*/
|
||||
#if defined USE_SDKHOOKS
|
||||
public Action:WeaponAlphaDrop(client, weapon)
|
||||
#else
|
||||
public ZRTools_Action:WeaponAlphaDrop(client, weapon)
|
||||
#endif
|
||||
{
|
||||
return;
|
||||
// If weapon isn't a valid entity, then stop.
|
||||
|
Reference in New Issue
Block a user