Skip to content

Commit

Permalink
Merge pull request #7 from CrimsonTautology/feature/remove-unused-sml…
Browse files Browse the repository at this point in the history
…ib-files

remove unused smlib files
  • Loading branch information
CrimsonTautology authored Mar 14, 2021
2 parents 12eedd3 + 1aaa354 commit 9891705
Show file tree
Hide file tree
Showing 16 changed files with 26 additions and 2,725 deletions.
36 changes: 26 additions & 10 deletions addons/sourcemod/scripting/fistful_of_zombies.sp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <smlib>
#include <smlib/clients>
#include <smlib/teams>
#include <smlib/entities>
#include <smlib/weapons>
#undef REQUIRE_EXTENSIONS
#tryinclude <steamworks>

Expand Down Expand Up @@ -328,7 +331,7 @@ void PlayerSpawnDelay(int userid)
int client = GetClientOfUserId(userid);

if (!IsEnabled()) return;
if (!Client_IsIngame(client)) return;
if (!IsClientIngame(client)) return;
if (!IsPlayerAlive(client)) return;

g_GivenPrimary[client] = false;
Expand Down Expand Up @@ -363,7 +366,7 @@ void BecomeZombieDelay(int userid)
int client = GetClientOfUserId(userid);

if (!IsEnabled()) return;
if (!Client_IsIngame(client)) return;
if (!IsClientIngame(client)) return;

JoinZombieTeam(client);
}
Expand All @@ -373,7 +376,7 @@ Action Timer_GivePrimaryWeapon(Handle timer, int userid)
int client = GetClientOfUserId(userid);

if (!IsEnabled()) return Plugin_Handled;
if (!Client_IsIngame(client)) return Plugin_Handled;
if (!IsClientIngame(client)) return Plugin_Handled;
if (IsZombie(client)) return Plugin_Handled;
if (g_GivenPrimary[client]) return Plugin_Handled;
char weapon[MAX_KEY_LENGTH];
Expand All @@ -393,7 +396,7 @@ Action Timer_GiveSecondaryWeapon(Handle timer, int userid)
int client = GetClientOfUserId(userid);

if (!IsEnabled()) return Plugin_Handled;
if (!Client_IsIngame(client)) return Plugin_Handled;
if (!IsClientIngame(client)) return Plugin_Handled;
if (IsZombie(client)) return Plugin_Handled;
if (g_GivenSecondary[client]) return Plugin_Handled;

Expand Down Expand Up @@ -474,8 +477,8 @@ Action Hook_OnTakeDamage(int victim, int& attacker, int& inflictor,
float damagePosition[3])
{
if (!IsEnabled()) return Plugin_Continue;
if (!Client_IsIngame(attacker)) return Plugin_Continue;
if (!Client_IsIngame(victim)) return Plugin_Continue;
if (!IsClientIngame(attacker)) return Plugin_Continue;
if (!IsClientIngame(victim)) return Plugin_Continue;
if (attacker == victim) return Plugin_Continue;

if (weapon > 0 && IsHuman(victim) && IsZombie(attacker))
Expand Down Expand Up @@ -504,7 +507,7 @@ Action Hook_OnTakeDamage(int victim, int& attacker, int& inflictor,
Action Command_JoinTeam(int client, const char[] command, int argc)
{
if (!IsEnabled()) return Plugin_Continue;
if (!Client_IsIngame(client)) return Plugin_Continue;
if (!IsClientIngame(client)) return Plugin_Continue;

char arg[32];
GetCmdArg(1, arg, sizeof(arg));
Expand Down Expand Up @@ -1067,7 +1070,7 @@ bool InfectionStep(int& client, float& interval, int& currentCall)
// this steps through the process of an infected human to a zombie takes
// 300 steps or 30 seconds
if (!IsEnabled()) return false;
if (!Client_IsIngame(client)) return false;
if (!IsClientIngame(client)) return false;
if (!IsPlayerAlive(client)) return false;
if (!IsHuman(client)) return false;
if (GetRoundState() != RoundActive) return false;
Expand Down Expand Up @@ -1124,7 +1127,7 @@ void RewardSurvivingHumans()

for (int client = 1; client <= MaxClients; client++)
{
if (!Client_IsIngame(client)) continue;
if (!IsClientIngame(client)) continue;
if (!IsPlayerAlive(client)) continue;
if (!IsHuman(client)) continue;

Expand All @@ -1141,6 +1144,19 @@ bool SetGameDescription(const char[] description)
#endif
}

stock bool IsClientIngame(int client)
{
if (client > 4096) {
client = EntRefToEntIndex(client);
}

if (client < 1 || client > MaxClients) {
return false;
}

return IsClientInGame(client);
}

stock void WriteLog(const char[] format, any ...)
{
#if defined DEBUG
Expand Down
32 changes: 0 additions & 32 deletions addons/sourcemod/scripting/include/smlib.inc

This file was deleted.

45 changes: 0 additions & 45 deletions addons/sourcemod/scripting/include/smlib/concommands.inc

This file was deleted.

71 changes: 0 additions & 71 deletions addons/sourcemod/scripting/include/smlib/convars.inc

This file was deleted.

Loading

0 comments on commit 9891705

Please sign in to comment.