Update includes

This commit is contained in:
Jackzie 2022-06-05 15:50:46 -05:00
parent f91a3e0502
commit e6a638de7e
No known key found for this signature in database
GPG key ID: 1E834FE36520537A
5 changed files with 1547 additions and 875 deletions

File diff suppressed because it is too large Load diff

View file

@ -37,9 +37,7 @@ int lastButtonUser;
int lastCrescendoUser;
int g_iAttackerTarget[MAXPLAYERS+1];
int g_PendingBanTroll[MAXPLAYERS+1];
int g_iInSpit[MAXPLAYERS+1];
Timer g_inSpitTimer;
float iLastInSpit[MAXPLAYERS+1];
int gInstaSpecialMagnet[MAXPLAYERS+1];
char steamids[MAXPLAYERS+1][64];

View file

@ -28,8 +28,8 @@ stock void GetHorizontalPositionFromClient(int client, float units, float finalP
GetClientAbsOrigin(client, pos);
float theta = DegToRad(ang[1]);
pos[0] += -150 * Cosine(theta);
pos[1] += -150 * Sine(theta);
pos[0] += units * Cosine(theta);
pos[1] += units * Sine(theta);
finalPosition = pos;
}
// Gets velocity of an entity (ent) toward new origin with speed (fSpeed) - thanks Ryan

File diff suppressed because it is too large Load diff

View file

@ -118,7 +118,7 @@ static EngineVersion g_iEngine;
/**
* @brief Returns if the server is running on the Left 4 Dead series engine
*
* @return True if the server is running on the Left 4 Dead series
* @return Returns true if the server is running on the Left 4 Dead series
*/
stock bool L4D_IsEngineLeft4Dead()
{
@ -133,7 +133,7 @@ stock bool L4D_IsEngineLeft4Dead()
/**
* @brief Returns if the server is running on Left 4 Dead 1
*
* @return True if server is running on Left 4 Dead 1
* @return Returns true if server is running on Left 4 Dead 1
*/
stock bool L4D_IsEngineLeft4Dead1()
{
@ -148,7 +148,7 @@ stock bool L4D_IsEngineLeft4Dead1()
/**
* @brief Returns if the server is running on Left 4 Dead 2
*
* @return True if server is running on Left 4 Dead 2
* @return Returns true if server is running on Left 4 Dead 2
*/
stock bool L4D_IsEngineLeft4Dead2()
{
@ -261,7 +261,6 @@ stock int L4D_EntityParent(int entity)
stock void L4D_ForcePanicEvent()
{
static EngineVersion engine;
static int director = INVALID_ENT_REFERENCE;
if( engine == Engine_Unknown )
{
@ -270,6 +269,8 @@ stock void L4D_ForcePanicEvent()
if( engine == Engine_Left4Dead2 )
{
static int director = INVALID_ENT_REFERENCE;
if( director == INVALID_ENT_REFERENCE || EntRefToEntIndex(director) == INVALID_ENT_REFERENCE )
{
director = FindEntityByClassname(-1, "info_director");
@ -282,15 +283,14 @@ stock void L4D_ForcePanicEvent()
if( director != INVALID_ENT_REFERENCE )
{
AcceptEntityInput(director, "ForcePanicEvent");
return;
}
}
else
{
int flags = GetCommandFlags("director_force_panic_event");
SetCommandFlags("director_force_panic_event", flags & ~FCVAR_CHEAT);
ServerCommand("director_force_panic_event");
SetCommandFlags("director_force_panic_event", flags);
}
}
/**
@ -574,12 +574,86 @@ stock int L4D_GetPinnedInfected(int client)
return 0;
}
/**
* @brief Returns the victim when a Survivor is pinned by a Special Infected
*
* @param client Client ID of the player to check
*
* @return Attacker client index, or 0 if none
*/
stock int L4D_GetPinnedSurvivor(int client)
{
int class = GetEntProp(client, Prop_Send, "m_zombieClass");
int victim;
if( L4D_IsEngineLeft4Dead2() )
{
switch( class )
{
case 1: victim = GetEntPropEnt(client, Prop_Send, "m_tongueVictim");
case 3: victim = GetEntPropEnt(client, Prop_Send, "m_pounceVictim");
case 5: victim = GetEntPropEnt(client, Prop_Send, "m_jockeyVictim");
case 6:
{
victim = GetEntPropEnt(client, Prop_Send, "m_pummelVictim");
if( victim < 1 ) victim = GetEntPropEnt(client, Prop_Send, "m_carryVictim");
}
}
}
else
{
switch( class )
{
case 1: victim = GetEntPropEnt(client, Prop_Send, "m_tongueVictim");
case 3: victim = GetEntPropEnt(client, Prop_Send, "m_pounceVictim");
}
}
if( victim > 0 )
return victim;
return 0;
}
/**
* @brief Returns true when someone is being carried/pummelled by more than 1 Charger
*
* @param client Client ID of the player to check
*
* @return Returns true when someone is being carried/pummelled by more than 1 Charger
*/
// L4D2 only.
stock bool L4D2_IsMultiCharged(int victim)
{
if( !L4D_IsEngineLeft4Dead2() )
ThrowError("Stock only supports L4D2.");
int count;
for( int i = 1; i <= MaxClients; i++ )
{
if( !IsClientInGame(i) )
continue;
else if( GetClientTeam(i) != 3 )
continue;
else if( L4D2_GetPlayerZombieClass(i) != L4D2ZombieClass_Charger )
continue;
if( L4D_GetVictimCarry(i) == victim || L4D_GetVictimCharger(i) == victim )
count++;
}
return count >= 2;
}
/**
* @brief Returns if a Survivor is pinned by a Special Infected
*
* @param client Client ID of the player to check
*
* @return True if pinned, false otherwise
* @return Returns true if pinned, false otherwise
*/
stock bool L4D_IsPlayerPinned(int client)
{
@ -597,7 +671,7 @@ stock bool L4D_IsPlayerPinned(int client)
*
* @param client Client ID of the player to check
*
* @return True if hanging, false otherwise
* @return Returns true if hanging, false otherwise
*/
stock bool L4D_IsPlayerHangingFromLedge(int client)
{
@ -609,7 +683,7 @@ stock bool L4D_IsPlayerHangingFromLedge(int client)
*
* @param client Client ID of the player to check
*
* @return True if can hang, false otherwise
* @return Returns true if can hang, false otherwise
*/
stock bool L4D_CanPlayerLedgeHang(int client)
{
@ -659,7 +733,7 @@ stock void L4D_LedgeHangDisable(int client)
*
* @param client Client ID of the player to affect
*
* @noreturn
* @return Returns true if player is staggering, false otherwise
*/
stock bool L4D_IsPlayerStaggering(int client)
{
@ -669,7 +743,19 @@ stock bool L4D_IsPlayerStaggering(int client)
if( GetEntData(client, m_iQueuedStaggerType, 4) == -1 )
{
return GetEntPropFloat(client, Prop_Send, "m_staggerTimer", 1) >= GetGameTime();
if( GetGameTime() >= GetEntPropFloat(client, Prop_Send, "m_staggerTimer", 1) )
{
return false;
}
static float vStgDist[3], vOrigin[3];
GetEntPropVector(client, Prop_Send, "m_staggerStart", vStgDist);
GetEntPropVector(client, Prop_Send, "m_vecOrigin", vOrigin);
static float fStgDist2;
fStgDist2 = GetEntPropFloat(client, Prop_Send, "m_staggerDist");
return GetVectorDistance(vStgDist, vOrigin) <= fStgDist2;
}
return true;
@ -848,7 +934,7 @@ stock void L4D_StopReviveAction(int client)
*
* @param client Client ID of the player to check
*
* @return True if incapacitated, false otherwise
* @return Returns true if incapacitated, false otherwise
*/
#pragma deprecated Use L4D_IsPlayerIncapacitated instead
stock bool L4D_IsPlayerIncapped(int client)
@ -903,7 +989,7 @@ stock int GetAnyRandomClient()
*/
stock int GetRandomSurvivor(int alive = -1, int bots = -1)
{
return Local_GetRandomClient(2, alive, bots);
return GetRandomClient(2, alive, bots);
}
/**
@ -916,16 +1002,25 @@ stock int GetRandomSurvivor(int alive = -1, int bots = -1)
*/
stock int GetRandomInfected(int alive = -1, int bots = -1)
{
return Local_GetRandomClient(3, alive, bots);
return GetRandomClient(3, alive, bots);
}
stock int Local_GetRandomClient(int team, int alive = -1, int bots = -1)
/**
* @brief Returns a random client in game
*
* @param team -1 = Any. 1=Spectators, 2=Survivors, 3=Special Infected, 5=Survivors and Special Infected (team > 1)
* @param alive -1 = Any. 0 = Only dead players. 1 = Only alive players
* @param bots -1 = Any. 0 - Only real players. 1 = Only fake players
*
* @return Client index or 0 if none
*/
stock int GetRandomClient(int team = -1, int alive = -1, int bots = -1)
{
ArrayList aClients = new ArrayList();
for( int i = 1; i <= MaxClients; i++ )
{
if( IsClientInGame(i) && GetClientTeam(i) == team && (alive == -1 || IsPlayerAlive(i) == view_as<bool>(alive)) && (bots == -1 || IsFakeClient(i) == view_as<bool>(bots)) )
if( IsClientInGame(i) && (team == -1 || (team == 5 && GetClientTeam(i) > 1) || GetClientTeam(i) == team) && (alive == -1 || IsPlayerAlive(i) == view_as<bool>(alive)) && (bots == -1 || IsFakeClient(i) == view_as<bool>(bots)) )
{
aClients.Push(i);
}