This commit is contained in:
Jackz 2023-01-04 22:02:27 -06:00
parent 207c1f6314
commit 078b7c4bf6
No known key found for this signature in database
GPG key ID: E0BBD94CF657F603
28 changed files with 1101 additions and 140 deletions

View file

@ -245,6 +245,41 @@ stock int L4D_EntityParent(int entity)
return GetEntPropEnt(entity, Prop_Data, "m_pParent");
}
/**
* @brief Checks if a player is using any mounted weapon (minigun or 50cal)
*
* @param client Client to check
*
* @return true if using a mounted weapon, false otherwise
*/
stock bool IsUsingMinigun(int client)
{
return ((GetEntProp(client, Prop_Send, "m_usingMountedWeapon") > 0) || (GetEntProp(client, Prop_Send, L4D_IsEngineLeft4Dead2() ? "m_usingMountedGun" : "m_usingMinigun") > 0));
}
/**
* @brief Stops a client using a mounted weapon
*
* @param client Entity index to check
*
* @return entity index or -1 if none
*/
stock void StopUsingMinigun(int client)
{
if( IsUsingMinigun(client) )
{
int entity = GetEntPropEnt(client, Prop_Send, "m_hUseEntity");
if( entity > 0 && entity < 2048 )
{
SetEntPropEnt(entity, Prop_Send, "m_owner", -1);
}
SetEntProp(client, Prop_Send, L4D_IsEngineLeft4Dead2() ? "m_usingMountedGun" : "m_usingMinigun", 0);
SetEntProp(client, Prop_Send, "m_usingMountedWeapon", 0);
SetEntPropEnt(client, Prop_Send, "m_hUseEntity", -1);
}
}
// ==================================================
@ -675,6 +710,75 @@ stock bool L4D_HasReachedSmoker(int client)
// ==================================================
// CHARGER STOCKS - Written by "Forgetest"
// ==================================================
/**
* @brief Internally used to get offset to the start of queued pummel field.
*
* @return Offset into CTerrorPlayer to the start of queued pummel props
*/
static int L4D2_OffsQueuedPummelInfo()
{
static int m_hQueuedPummelVictim = -1;
if ( m_hQueuedPummelVictim == -1 )
m_hQueuedPummelVictim = FindSendPropInfo("CTerrorPlayer", "m_pummelAttacker") + 4;
return m_hQueuedPummelVictim;
}
/**
* @brief Returns the timestamp when the queued pummel begins.
*
* @param client Client ID of the player to check
*
* @return timestamp or -1.0 if no queued pummel
*/
stock float L4D2_GetQueuedPummelStartTime(int client)
{
return GetEntDataFloat(client, L4D2_OffsQueuedPummelInfo() + 4);
}
/**
* @brief Returns if a Charger is in a queued pummel.
*
* @param client Client ID of the player to check
*
* @return true if in queued pummel, false otherwise
*/
stock bool L4D2_IsInQueuedPummel(int client)
{
float flTimestamp = L4D2_GetQueuedPummelStartTime(client);
return flTimestamp != -1.0 && flTimestamp > GetGameTime();
}
/**
* @brief Returns the victim when a Charger is in a queued pummel.
*
* @param client Client ID of the player to check
*
* @return client index or -1 if none
*/
stock int L4D2_GetQueuedPummelVictim(int client)
{
return GetEntDataEnt2(client, L4D2_OffsQueuedPummelInfo());
}
/**
* @brief Returns the attacker when a Survivor is in a queued pummel.
*
* @param client Client ID of the player to check
*
* @return client index or -1 if none
*/
stock int L4D2_GetQueuedPummelAttacker(int client)
{
return GetEntDataEnt2(client, L4D2_OffsQueuedPummelInfo() + 8);
}
// ==================================================
// LEDGE HANG STOCKS
// ==================================================
@ -885,7 +989,7 @@ stock void L4D_StopReviveAction(int client)
owner_save = owner;
}
if( target != -1 )
if( target > 0 && target <= MaxClients )
{
SetEntPropEnt(target, Prop_Send, "m_useActionOwner", -1);
SetEntPropEnt(target, Prop_Send, "m_useActionTarget", -1);