Cleanup duplicated code, and a big wtf?
offsActiveWeapon was never declared, guess we never found out because the functions where unused. WeaponsGetActiveWeaponSlot is still unused, leaving in might be usefull somewhen in the future.
This commit is contained in:
parent
78993cbc70
commit
bb37965670
@ -160,12 +160,11 @@ public void KnockbackOnTakeDamageAlivePost(int victim, int attacker, int inflict
|
||||
GetClientAbsOrigin(victim, clientloc);
|
||||
|
||||
char weaponname[64];
|
||||
int active_weapon = -42;
|
||||
if (inflictor == attacker)
|
||||
{
|
||||
active_weapon = ToolsGetClientActiveWeapon(attacker);
|
||||
if (active_weapon > 0)
|
||||
GetEdictClassname(active_weapon, weaponname, sizeof(weaponname));
|
||||
int activeweapon = WeaponsGetActiveWeaponIndex(attacker);
|
||||
if (activeweapon > 0)
|
||||
GetEdictClassname(activeweapon, weaponname, sizeof(weaponname));
|
||||
}
|
||||
else
|
||||
GetEdictClassname(inflictor, weaponname, sizeof(weaponname));
|
||||
|
@ -33,7 +33,6 @@ new g_iToolsLMV;
|
||||
new g_iToolsHasNightVision;
|
||||
new g_iToolsNightVisionOn;
|
||||
new g_iToolsFOV;
|
||||
new g_iActiveWeapon;
|
||||
new g_iToolsLastHitGroup;
|
||||
|
||||
/**
|
||||
@ -92,13 +91,6 @@ ToolsFindOffsets()
|
||||
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Tools, "Offsets", "Offset \"CBasePlayer::m_iFOV\" was not found.");
|
||||
}
|
||||
|
||||
// If offset "m_hActiveWeapon" can't be found, then stop the plugin.
|
||||
g_iActiveWeapon = FindSendPropInfo("CBaseCombatCharacter", "m_hActiveWeapon");
|
||||
if (g_iActiveWeapon == -1)
|
||||
{
|
||||
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Tools, "Offsets", "Offset \"CBaseCombatCharacter::m_hActiveWeapon\" was not found.");
|
||||
}
|
||||
|
||||
Handle hGameConf = LoadGameConfigFile("zombiereloaded");
|
||||
if (hGameConf != INVALID_HANDLE)
|
||||
{
|
||||
|
@ -251,16 +251,6 @@ stock ToolsGetEntityColor(entity, color[4])
|
||||
color[i] = GetEntData(entity, offset + i, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get client's m_hActiveWeapon.
|
||||
*
|
||||
* @param client The client index.
|
||||
*/
|
||||
stock int ToolsGetClientActiveWeapon(int client)
|
||||
{
|
||||
return GetEntDataEnt2(client, g_iActiveWeapon);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get client's m_LastHitGroup.
|
||||
*
|
||||
|
@ -76,6 +76,11 @@ enum WeaponsData
|
||||
*/
|
||||
new g_iToolsActiveWeapon;
|
||||
|
||||
/**
|
||||
* Variable to store buyzone offset value.
|
||||
*/
|
||||
new g_iToolsInBuyZone;
|
||||
|
||||
/**
|
||||
* Weapon slots.
|
||||
*/
|
||||
@ -749,35 +754,35 @@ stock WeaponsGetClientWeapons(client, weapons[WeaponsSlot])
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns weapon index of the client's deployed weapon.
|
||||
* Returns weapon index of the client's active weapon.
|
||||
*
|
||||
* @param client The client index.
|
||||
* @return The weapon index of the deployed weapon.
|
||||
* -1 if no weapon is deployed.
|
||||
* @return The weapon index of the active weapon.
|
||||
* -1 if no weapon is active.
|
||||
*/
|
||||
stock WeaponsGetDeployedWeaponIndex(client)
|
||||
stock WeaponsGetActiveWeaponIndex(client)
|
||||
{
|
||||
// Return the client's active weapon.
|
||||
return GetEntDataEnt2(client, offsActiveWeapon);
|
||||
return GetEntDataEnt2(client, g_iToolsActiveWeapon);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns slot of client's deployed weapon.
|
||||
* Returns slot of client's active weapon.
|
||||
*
|
||||
* @param client The client index.
|
||||
* @return The slot number of deployed weapon.
|
||||
* @return The slot number of active weapon.
|
||||
*/
|
||||
stock WeaponsSlot:WeaponsGetDeployedWeaponSlot(client)
|
||||
stock WeaponsSlot:WeaponsGetActiveWeaponSlot(client)
|
||||
{
|
||||
// Get all client's weapon indexes.
|
||||
new weapons[WeaponsSlot];
|
||||
WeaponsGetClientWeapons(client, weapons);
|
||||
|
||||
// Get client's deployed weapon.
|
||||
new deployedweapon = WeaponsGetDeployedWeaponIndex(client);
|
||||
// Get client's active weapon.
|
||||
new activeweapon = WeaponsGetActiveWeaponIndex(client);
|
||||
|
||||
// If client has no deployed weapon, then stop.
|
||||
if (deployedweapon == -1)
|
||||
// If client has no active weapon, then stop.
|
||||
if (activeweapon == -1)
|
||||
{
|
||||
return Type_Invalid;
|
||||
}
|
||||
@ -785,7 +790,7 @@ stock WeaponsSlot:WeaponsGetDeployedWeaponSlot(client)
|
||||
// x = weapon slot.
|
||||
for (new x = 0; x < WEAPONS_SLOTS_MAX; x++)
|
||||
{
|
||||
if (weapons[x] == deployedweapon)
|
||||
if (weapons[x] == activeweapon)
|
||||
{
|
||||
return WeaponsSlot:x;
|
||||
}
|
||||
|
@ -39,11 +39,6 @@
|
||||
*/
|
||||
#define ZMARKET_REBUY_WEAPONS_SLOTS_MAX 1
|
||||
|
||||
/**
|
||||
* Variable to store buyzone offset value.
|
||||
*/
|
||||
new g_iToolsInBuyZone;
|
||||
|
||||
/**
|
||||
* Array to store the client's current weapon type within menu.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user