This commit is contained in:
Jackzie 2022-03-15 10:57:34 -05:00
parent 074cf2fd3c
commit aedbf9d77b
No known key found for this signature in database
GPG key ID: 1E834FE36520537A
5 changed files with 177 additions and 32 deletions

View file

@ -171,7 +171,7 @@ public void DB_OnConnectCheck(Database db, DBResultSet results, const char[] err
} else {
results.FetchString(0, reason, sizeof(reason), reasonResult);
if(!expired) {
LogMessage("%N is banned: %s", client, reason);
LogAction(-1, client, "%N is banned from server: \"%s\"", client, reason);
if(hKickType.IntValue > 0) {
if(reasonResult == DBVal_Data)
KickClient(client, "You have been banned:\n%s", reason);
@ -187,7 +187,7 @@ public void DB_OnConnectCheck(Database db, DBResultSet results, const char[] err
g_db.Format(query, sizeof(query), "UPDATE bans SET times_tried=times_tried+1 WHERE steamid = '%s'", steamid);
g_db.Query(DB_OnBanQuery, query);
} else {
LogMessage("%N was previously banned: %s", client, reason);
LogAction(-1, client, "%N was previously banned from server: \"%s\"", client, reason);
// User was previously banned
PrintChatToAdmins("%N has a previously expired ban of reason \"%s\"", client, reason);
}

View file

@ -74,27 +74,26 @@ stock int GetSurvivorId(const char[] str, bool isL4D1 = false) {
return possibleNumber;
}
}else if(possibleNumber == 0) {
/*
L4D2:
0 - Nick, 4 - Bill, 5 - Zoey, 6 - Francis, 7 - Louis
L4D1:
0 - Bill, 1 - Zoey, 2 - Louis, 3 - Francis
*/
if(StrEqual(str, "nick", false)) return 0;
else if(StrEqual(str, "rochelle", false)) return 1;
else if(StrEqual(str, "coach", false)) return 2;
else if(StrEqual(str, "ellis", false)) return 3;
if(isL4D1) {
if(StrEqual(str, "bill", false)) return 0;
else if(StrEqual(str, "zoey", false)) return 1;
else if(StrEqual(str, "francis", false)) return 3;
else if(StrEqual(str, "louis", false)) return 2;
}else{
if(StrEqual(str, "bill", false)) return 4;
else if(StrEqual(str, "zoey", false)) return 5;
else if(StrEqual(str, "francis", false)) return 6;
else if(StrEqual(str, "louis", false)) return 7;
int survivorId;
char s = CharToLower(s);
if(s == 'b') {
survivorId = isL4D1 ? 0 : 4;
} else if(s == 'z') {
survivorId = isL4D1 ? 1 : 5;
} else if(s == 'l') {
survivorId = isL4D1 ? 2 : 7;
} else if(s == 'f') {
survivorId = isL4D1 ? 3 : 6;
} else if(s == 'n') {
survivorId = 0;
} else if(s == 'r') {
survivorId = 1;
} else if(s == 'e') {
survivorId = 3;
} else if(s == 'c') {
survivorId = 2;
}
return survivorId;
}
return -1;
}

View file

@ -59,17 +59,17 @@
// Natives:
// L4D1 = 25 [left4downtown] + 47 [l4d_direct] + 15 [l4d2addresses] + 46 [silvers - mine!] + 4 [anim] = 128
// L4D2 = 54 [left4downtown] + 61 [l4d_direct] + 26 [l4d2addresses] + 81 [silvers - mine!] + 4 [anim] = 215
// L4D1 = 25 [left4downtown] + 47 [l4d_direct] + 15 [l4d2addresses] + 50 [silvers - mine!] + 4 [anim] = 139
// L4D2 = 54 [left4downtown] + 61 [l4d_direct] + 26 [l4d2addresses] + 87 [silvers - mine!] + 4 [anim] = 229
// Forwards:
// L4D1 = 61;
// L4D2 = 78;
// L4D1 = 62;
// L4D2 = 82;
// Stocks: (L4D1 = 106. L4D2 = 149)
// left4dhooks_silver 37 stocks (L4D2 = 4, L4D1 = 0)
// left4dhooks_stocks 82 stocks (L4D2 = 39, L4D1 = 4)
// left4dhooks_lux_library 34 stocks (L4D2 = 4, L4D1 = 0)
// Stocks: (L4D1 = 107. L4D2 = 152)
// left4dhooks_silver 39 stocks (Only: L4D2 = 6, L4D1 = 0)
// left4dhooks_stocks 83 stocks (Only: L4D2 = 39, L4D1 = 4)
// left4dhooks_lux_library 34 stocks (Only: L4D2 = 4, L4D1 = 0)
@ -141,6 +141,9 @@ public void __pl_l4dh_SetNTVOptional()
MarkNativeAsOptional("L4D2_AreWanderersAllowed");
MarkNativeAsOptional("L4D2_GetCurrentFinaleStage");
MarkNativeAsOptional("L4D2_ForceNextStage");
MarkNativeAsOptional("L4D_ForceVersusStart");
MarkNativeAsOptional("L4D_ForceSurvivalStart");
MarkNativeAsOptional("L4D2_ForceScavengeStart");
MarkNativeAsOptional("L4D2_IsTankInPlay");
MarkNativeAsOptional("L4D2_GetScriptValueInt");
MarkNativeAsOptional("L4D2_NavAreaTravelDistance");
@ -1260,6 +1263,19 @@ forward void L4D_CBreakableProp_Break(int prop, int entity);
// L4D2 only.
forward void L4D2_CGasCan_EventKilled(int gascan, int inflictor, int attacker);
/**
* @brief Called whenever CGasCan::ShouldStartAction() is invoked
* @remarks Called when someone is about to pour a gascan into a nozzle
*
* @param client the client pouring
* @param gascan the gascan entity index that is being consumed
* @param nozzle the nozzle being poured into
*
* @return Plugin_Handled to block adding to Scavenge score (see "Scavenge Score Fix" plugin for more details), Plugin_Continue otherwise
*/
// L4D2 only.
forward Action L4D2_CGasCan_ShouldStartAction(int client, int gascan);
/**
* @brief Called whenever CGasCan::OnActionComplete() is invoked
* @remarks Called when someone completes pouring a gascan into a nozzle
@ -1407,7 +1423,9 @@ forward void L4D2_OnWaterMove(int client);
* @remarks You can use the "GAMEMODE_*" enums provided above to match the mode.
* @remarks Only triggers when the server starts and after when the game mode changes.
*
* @return Current game mode.
* @param gamemode Current game mode.
*
* @noreturn
*/
forward void L4D_OnGameModeChange(int gamemode);
@ -1424,6 +1442,20 @@ forward void L4D_OnGameModeChange(int gamemode);
// L4D2 only.
forward Action L4D2_OnPlayerFling(int client, int attacker, float vecDir[3]);
/**
* @brief Called when CTerrorPlayer::Fling(Vector const&, PlayerAnimEvent_t, CBaseCombatCharacter*, float) is invoked.
* @remarks Called when a player is flung to the ground.
* @remarks This will not trigger if the fling is being blocked by other plugins
*
* @param client Client index of the player.
* @param attacker Client index of the attacker.
* @param vecDir Vector direction of the fling.
*
* @noreturn
**/
// L4D2 only.
forward void L4D2_OnPlayerFling_Post(int client, int attacker, float vecDir[3]);
/**
* @brief Called when CDeathFallCamera::Enable(CBasePlayer*) is invoked.
* @remarks Called when a player is falling in a fatal zone.
@ -1927,6 +1959,28 @@ native int L4D2_GetCurrentFinaleStage();
// L4D2 only.
native void L4D2_ForceNextStage();
/**
* @brief Forces the game to start in Versus.
*
* @noreturn
*/
native void L4D_ForceVersusStart();
/**
* @brief Forces the game to start in Survival.
*
* @noreturn
*/
native void L4D_ForceSurvivalStart();
/**
* @brief Forces the game to start in Scavenge.
*
* @noreturn
*/
// L4D2 only.
native void L4D2_ForceScavengeStart();
/**
* @brief Returns true when any tanks are on the map
*

View file

@ -109,6 +109,8 @@ enum // m_spawnflags
// ====================================================================================================
// STOCKS
// ====================================================================================================
// ==================================================
// ENGINE STOCKS
// ==================================================
static EngineVersion g_iEngine;
@ -258,7 +260,37 @@ stock int L4D_EntityParent(int entity)
*/
stock void L4D_ForcePanicEvent()
{
static EngineVersion engine;
static int director = INVALID_ENT_REFERENCE;
if( engine == Engine_Unknown )
{
engine = GetEngineVersion();
}
if( engine == Engine_Left4Dead2 )
{
if( director == INVALID_ENT_REFERENCE || EntRefToEntIndex(director) == INVALID_ENT_REFERENCE )
{
director = FindEntityByClassname(-1, "info_director");
if( director != INVALID_ENT_REFERENCE )
{
director = EntIndexToEntRef(director);
}
}
if( director != INVALID_ENT_REFERENCE )
{
AcceptEntityInput(director, "ForcePanicEvent");
}
}
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);
}
}
/**
@ -534,6 +566,9 @@ stock int L4D_GetPinnedInfected(int client)
if( (attacker = GetEntPropEnt(client, Prop_Send, "m_pummelAttacker")) > 0 )
return attacker;
if( (attacker = GetEntPropEnt(client, Prop_Send, "m_carryAttacker")) > 0 )
return attacker;
}
return 0;
@ -619,6 +654,27 @@ stock void L4D_LedgeHangDisable(int client)
AcceptEntityInput(client, "DisableLedgeHang");
}
/**
* @brief Checks if a Survivor is currently staggering
*
* @param client Client ID of the player to affect
*
* @noreturn
*/
stock bool L4D_IsPlayerStaggering(int client)
{
static int m_iQueuedStaggerType = -1;
if( m_iQueuedStaggerType == -1 )
m_iQueuedStaggerType = FindSendPropInfo("CTerrorPlayer", "m_staggerDist") + 4;
if( GetEntData(client, m_iQueuedStaggerType, 4) == -1 )
{
return GetEntPropFloat(client, Prop_Send, "m_staggerTimer", 1) >= GetGameTime();
}
return true;
}
// ==================================================

View file

@ -155,6 +155,29 @@ enum L4DResourceType
L4DResource_TankTickets2
}
stock const char L4D1ZombieClassname[6][] =
{
"smoker",
"boomer",
"hunter",
"witch",
"tank",
"error_bad_L4D1ZombieClassType"
};
stock const char L4D2ZombieClassname[9][] =
{
"smoker",
"boomer",
"hunter",
"spitter",
"jockey",
"charger",
"witch",
"tank",
"error_bad_L4D2ZombieClassType"
};
static const char L4DResourceName[L4DResourceType][] =
{
"m_iPing",
@ -166,6 +189,19 @@ static const char L4DResourceName[L4DResourceType][] =
"m_tankTickets"
};
/**
* Returns the clients team using L4DTeam.
*
* @param client Player's index.
* @return Current L4DTeam of player.
* @error Invalid client index.
*/
stock L4DTeam L4D_GetClientTeam(int client)
{
int team = GetClientTeam(client);
return view_as<L4DTeam>(team);
}
/**
* Returns zombie player L4D1 zombie class.
*