sm-plugins/_FakePopulation/scripting/FakePopulation.sp

92 lines
2.8 KiB
SourcePawn
Raw Normal View History

#include <sourcemod>
#include <A2SFixes>
#pragma semicolon 1
#pragma newdecls required
int g_iFakePlayers = 0;
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Plugin myinfo =
{
name = "ImprovedHitboxes", //camouflage
author = "Neon",
description = "",
version = "1.0",
url = "https://steamcommunity.com/id/n3ontm"
};
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnPluginStart()
{
RegAdminCmd("sm_debugfakes", Command_DebugFakes, ADMFLAG_RCON, "");
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnPluginEnd()
{
FakePlayers(0);
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action Command_DebugFakes(int client, int argc)
{
ReplyToCommand(client, "[SM] There are currently %d Fake Players.", g_iFakePlayers);
return Plugin_Handled;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnClientConnected(int client)
{
CheckPopulation();
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnClientDisconnect(int client)
{
CheckPopulation();
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void CheckPopulation()
{
int iPlayers = 0;
for(int i = 1; i <= MaxClients; i++)
{
if(IsClientConnected(i) && !IsFakeClient(i))
iPlayers++;
}
if (iPlayers > 61)
g_iFakePlayers = 0;
else if(iPlayers > 60)
g_iFakePlayers = 1;
else if(iPlayers > 55)
g_iFakePlayers = 3;
else if (iPlayers > 40)
g_iFakePlayers = 4;
else if (iPlayers > 20)
g_iFakePlayers = 3;
else if (iPlayers > 10)
g_iFakePlayers = 2;
else if (iPlayers > 5)
g_iFakePlayers = 1;
else
g_iFakePlayers = 0;
FakePlayers(g_iFakePlayers);
}