mirror of
https://github.com/Jackzmc/sourcemod-plugins.git
synced 2025-05-06 14:33:21 +00:00
Update includes
This commit is contained in:
parent
f91a3e0502
commit
e6a638de7e
5 changed files with 1547 additions and 875 deletions
File diff suppressed because it is too large
Load diff
|
@ -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];
|
||||
|
|
|
@ -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
|
@ -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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -345,12 +345,12 @@ stock int L4D_SpawnCommonInfected(float vPos[3], float vAng[3] = { 0.0, 0.0, 0.0
|
|||
*/
|
||||
stock int L4D_GetVictimHunter(int client)
|
||||
{
|
||||
int attacker;
|
||||
int attacker;
|
||||
|
||||
if( (attacker = GetEntPropEnt(client, Prop_Send, "m_pounceVictim")) > 0 )
|
||||
return attacker;
|
||||
if( (attacker = GetEntPropEnt(client, Prop_Send, "m_pounceVictim")) > 0 )
|
||||
return attacker;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -362,12 +362,12 @@ stock int L4D_GetVictimHunter(int client)
|
|||
*/
|
||||
stock int L4D_GetVictimSmoker(int client)
|
||||
{
|
||||
int attacker;
|
||||
int attacker;
|
||||
|
||||
if( (attacker = GetEntPropEnt(client, Prop_Send, "m_tongueVictim")) > 0 )
|
||||
return attacker;
|
||||
if( (attacker = GetEntPropEnt(client, Prop_Send, "m_tongueVictim")) > 0 )
|
||||
return attacker;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -380,15 +380,15 @@ stock int L4D_GetVictimSmoker(int client)
|
|||
// L4D2 only.
|
||||
stock int L4D_GetVictimCharger(int client)
|
||||
{
|
||||
int attacker;
|
||||
int attacker;
|
||||
|
||||
if( L4D_IsEngineLeft4Dead2() )
|
||||
{
|
||||
if( L4D_IsEngineLeft4Dead2() )
|
||||
{
|
||||
if( (attacker = GetEntPropEnt(client, Prop_Send, "m_pummelVictim")) > 0 )
|
||||
return attacker;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -401,15 +401,15 @@ stock int L4D_GetVictimCharger(int client)
|
|||
// L4D2 only.
|
||||
stock int L4D_GetVictimCarry(int client)
|
||||
{
|
||||
int attacker;
|
||||
int attacker;
|
||||
|
||||
if( L4D_IsEngineLeft4Dead2() )
|
||||
{
|
||||
if( L4D_IsEngineLeft4Dead2() )
|
||||
{
|
||||
if( (attacker = GetEntPropEnt(client, Prop_Send, "m_carryVictim")) > 0 )
|
||||
return attacker;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -422,15 +422,15 @@ stock int L4D_GetVictimCarry(int client)
|
|||
// L4D2 only.
|
||||
stock int L4D_GetVictimJockey(int client)
|
||||
{
|
||||
int attacker;
|
||||
int attacker;
|
||||
|
||||
if( L4D_IsEngineLeft4Dead2() )
|
||||
{
|
||||
if( L4D_IsEngineLeft4Dead2() )
|
||||
{
|
||||
if( (attacker = GetEntPropEnt(client, Prop_Send, "m_jockeyVictim")) > 0 )
|
||||
return attacker;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -448,12 +448,12 @@ stock int L4D_GetVictimJockey(int client)
|
|||
*/
|
||||
stock int L4D_GetAttackerHunter(int client)
|
||||
{
|
||||
int attacker;
|
||||
int attacker;
|
||||
|
||||
if( (attacker = GetEntPropEnt(client, Prop_Send, "m_pounceAttacker")) > 0 )
|
||||
return attacker;
|
||||
if( (attacker = GetEntPropEnt(client, Prop_Send, "m_pounceAttacker")) > 0 )
|
||||
return attacker;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -465,12 +465,12 @@ stock int L4D_GetAttackerHunter(int client)
|
|||
*/
|
||||
stock int L4D_GetAttackerSmoker(int client)
|
||||
{
|
||||
int attacker;
|
||||
int attacker;
|
||||
|
||||
if( (attacker = GetEntPropEnt(client, Prop_Send, "m_tongueOwner")) > 0 )
|
||||
return attacker;
|
||||
if( (attacker = GetEntPropEnt(client, Prop_Send, "m_tongueOwner")) > 0 )
|
||||
return attacker;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -483,15 +483,15 @@ stock int L4D_GetAttackerSmoker(int client)
|
|||
// L4D2 only.
|
||||
stock int L4D_GetAttackerCharger(int client)
|
||||
{
|
||||
int attacker;
|
||||
int attacker;
|
||||
|
||||
if( L4D_IsEngineLeft4Dead2() )
|
||||
{
|
||||
if( (attacker = GetEntPropEnt(client, Prop_Send, "m_pummelAttacker")) > 0 )
|
||||
return attacker;
|
||||
}
|
||||
if( L4D_IsEngineLeft4Dead2() )
|
||||
{
|
||||
if( (attacker = GetEntPropEnt(client, Prop_Send, "m_pummelAttacker")) > 0 )
|
||||
return attacker;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -504,15 +504,15 @@ stock int L4D_GetAttackerCharger(int client)
|
|||
// L4D2 only.
|
||||
stock int L4D_GetAttackerCarry(int client)
|
||||
{
|
||||
int attacker;
|
||||
int attacker;
|
||||
|
||||
if( L4D_IsEngineLeft4Dead2() )
|
||||
{
|
||||
if( (attacker = GetEntPropEnt(client, Prop_Send, "m_carryAttacker")) > 0 )
|
||||
return attacker;
|
||||
}
|
||||
if( L4D_IsEngineLeft4Dead2() )
|
||||
{
|
||||
if( (attacker = GetEntPropEnt(client, Prop_Send, "m_carryAttacker")) > 0 )
|
||||
return attacker;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -525,15 +525,15 @@ stock int L4D_GetAttackerCarry(int client)
|
|||
// L4D2 only.
|
||||
stock int L4D_GetAttackerJockey(int client)
|
||||
{
|
||||
int attacker;
|
||||
int attacker;
|
||||
|
||||
if( L4D_IsEngineLeft4Dead2() )
|
||||
{
|
||||
if( (attacker = GetEntPropEnt(client, Prop_Send, "m_jockeyAttacker")) > 0 )
|
||||
return attacker;
|
||||
}
|
||||
if( L4D_IsEngineLeft4Dead2() )
|
||||
{
|
||||
if( (attacker = GetEntPropEnt(client, Prop_Send, "m_jockeyAttacker")) > 0 )
|
||||
return attacker;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -551,27 +551,101 @@ stock int L4D_GetAttackerJockey(int client)
|
|||
*/
|
||||
stock int L4D_GetPinnedInfected(int client)
|
||||
{
|
||||
int attacker;
|
||||
int attacker;
|
||||
|
||||
if( (attacker = GetEntPropEnt(client, Prop_Send, "m_pounceAttacker")) > 0 )
|
||||
return attacker;
|
||||
if( (attacker = GetEntPropEnt(client, Prop_Send, "m_pounceAttacker")) > 0 )
|
||||
return attacker;
|
||||
|
||||
if( (attacker = GetEntPropEnt(client, Prop_Send, "m_tongueOwner")) > 0 )
|
||||
return attacker;
|
||||
if( (attacker = GetEntPropEnt(client, Prop_Send, "m_tongueOwner")) > 0 )
|
||||
return attacker;
|
||||
|
||||
if( L4D_IsEngineLeft4Dead2() )
|
||||
{
|
||||
if( (attacker = GetEntPropEnt(client, Prop_Send, "m_jockeyAttacker")) > 0 )
|
||||
return attacker;
|
||||
if( L4D_IsEngineLeft4Dead2() )
|
||||
{
|
||||
if( (attacker = GetEntPropEnt(client, Prop_Send, "m_jockeyAttacker")) > 0 )
|
||||
return attacker;
|
||||
|
||||
if( (attacker = GetEntPropEnt(client, Prop_Send, "m_pummelAttacker")) > 0 )
|
||||
return attacker;
|
||||
if( (attacker = GetEntPropEnt(client, Prop_Send, "m_pummelAttacker")) > 0 )
|
||||
return attacker;
|
||||
|
||||
if( (attacker = GetEntPropEnt(client, Prop_Send, "m_carryAttacker")) > 0 )
|
||||
return attacker;
|
||||
}
|
||||
if( (attacker = GetEntPropEnt(client, Prop_Send, "m_carryAttacker")) > 0 )
|
||||
return attacker;
|
||||
}
|
||||
|
||||
return 0;
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -579,11 +653,11 @@ stock int L4D_GetPinnedInfected(int client)
|
|||
*
|
||||
* @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)
|
||||
{
|
||||
return L4D_GetPinnedInfected(client) != 0;
|
||||
return L4D_GetPinnedInfected(client) != 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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,17 +733,29 @@ 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)
|
||||
{
|
||||
static int m_iQueuedStaggerType = -1;
|
||||
if( m_iQueuedStaggerType == -1 )
|
||||
m_iQueuedStaggerType = FindSendPropInfo("CTerrorPlayer", "m_staggerDist") + 4;
|
||||
m_iQueuedStaggerType = FindSendPropInfo("CTerrorPlayer", "m_staggerDist") + 4;
|
||||
|
||||
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;
|
||||
|
@ -691,7 +777,7 @@ stock bool L4D_IsPlayerStaggering(int client)
|
|||
*/
|
||||
stock void L4D_SetPlayerIncapped(int client, bool incap)
|
||||
{
|
||||
SetEntProp(client, Prop_Send, "m_isIncapacitated", incap ? 1 : 0);
|
||||
SetEntProp(client, Prop_Send, "m_isIncapacitated", incap ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -848,12 +934,12 @@ 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)
|
||||
{
|
||||
return GetEntProp(client, Prop_Send, "m_isIncapacitated", 1) != 0;
|
||||
return GetEntProp(client, Prop_Send, "m_isIncapacitated", 1) != 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue