FakePopulation: Update

This commit is contained in:
Dogan 2019-08-25 02:40:15 +02:00
parent ed681ea810
commit 7ee6d2871f

View File

@ -1,10 +1,10 @@
#include <sourcemod> #include <sourcemod>
#include <A2SFixes>
#pragma semicolon 1 #pragma semicolon 1
#pragma newdecls required #pragma newdecls required
int g_iFakePlayers = 0; #define NUMBEROFNAMES 48
char g_cName[NUMBEROFNAMES][] = {"Dwelitram", "Gwyri", "Caredus", "Arerawia", "Vilali", "Astiwiel", "Vardonydd", "Ybaossa", "Umyk", "Nico50Pax", "Onand", "Thelian", "Nydaleth", "Chomarin", "Traedien", "Miev", "Kaaede", "Koamond", "TheRottenBenson", "BigLegend2017", "TRIGGEREDHarambexXx", "InPepe2016", "xXxMaster2012", "InBoixXx", "TheKopsing", "Cornelius", "Gustavo", "Bryant", "Winfred", "Nicolas", "Mitchel", "Dana", "Carrol", "Darell", "Ruben", "Jeromy", "Wade", "Scotty", "Salvatore", "Kory", "Don", "Morgan", "Kurtis", "Federico", "Darin", "css-ru", "aimbot", "lastkraftwagenfahrzeug"};
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
// Purpose: // Purpose:
@ -12,9 +12,9 @@ int g_iFakePlayers = 0;
public Plugin myinfo = public Plugin myinfo =
{ {
name = "ImprovedHitboxes", //camouflage name = "ImprovedHitboxes", //camouflage
author = "Neon", author = "Neon + Dogan",
description = "", description = "Handle Hitboxes via Plugin",
version = "1.0", version = "2.0",
url = "https://steamcommunity.com/id/n3ontm" url = "https://steamcommunity.com/id/n3ontm"
}; };
@ -24,6 +24,7 @@ public Plugin myinfo =
public void OnPluginStart() public void OnPluginStart()
{ {
RegAdminCmd("sm_debugfakes", Command_DebugFakes, ADMFLAG_RCON, ""); RegAdminCmd("sm_debugfakes", Command_DebugFakes, ADMFLAG_RCON, "");
OnClientConnected(0);
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
@ -31,7 +32,11 @@ public void OnPluginStart()
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
public void OnPluginEnd() public void OnPluginEnd()
{ {
FakePlayers(0); for(int i = 1; i <= MaxClients; i++)
{
if(IsClientConnected(i) && IsFakeClient(i))
KickClient(i);
}
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
@ -39,7 +44,13 @@ public void OnPluginEnd()
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
public Action Command_DebugFakes(int client, int argc) public Action Command_DebugFakes(int client, int argc)
{ {
ReplyToCommand(client, "[SM] There are currently %d Fake Players.", g_iFakePlayers); int iFakes = 0;
for(int i = 1; i <= MaxClients; i++)
{
if(IsClientConnected(i) && IsFakeClient(i))
iFakes++;
}
ReplyToCommand(client, "[SM] There are currently %d Fake Players.", iFakes);
return Plugin_Handled; return Plugin_Handled;
} }
@ -65,28 +76,58 @@ public void OnClientDisconnect(int client)
public void CheckPopulation() public void CheckPopulation()
{ {
int iPlayers = 0; int iPlayers = 0;
int iFakesNeeded = 0;
int iFakes = 0;
for(int i = 1; i <= MaxClients; i++) for(int i = 1; i <= MaxClients; i++)
{ {
if(IsClientConnected(i) && !IsFakeClient(i)) if(IsClientConnected(i) && !IsFakeClient(i))
iPlayers++; iPlayers++;
} }
if (iPlayers > 61) for(int i = 1; i <= MaxClients; i++)
g_iFakePlayers = 0; {
else if(iPlayers > 60) if(IsClientConnected(i) && IsFakeClient(i))
g_iFakePlayers = 1; iFakes++;
else if(iPlayers > 55) }
g_iFakePlayers = 3;
else if (iPlayers > 40) if (iPlayers >= 61)
g_iFakePlayers = 4; iFakesNeeded = 0;
else if (iPlayers > 20) else if(iPlayers >= 60)
g_iFakePlayers = 3; iFakesNeeded = 1;
else if (iPlayers > 10) else if(iPlayers >= 55)
g_iFakePlayers = 2; iFakesNeeded = 3;
else if (iPlayers > 5) else if (iPlayers >= 40)
g_iFakePlayers = 1; iFakesNeeded = 4;
else else if (iPlayers >= 20)
g_iFakePlayers = 0; iFakesNeeded = 3;
else if (iPlayers >= 10)
FakePlayers(g_iFakePlayers); iFakesNeeded = 2;
else if (iPlayers >= 5)
iFakesNeeded = 1;
else
iFakesNeeded = 0;
if(iFakesNeeded == iFakes)
return;
while (iFakes < iFakesNeeded)
{
int RandomName = GetRandomInt(0, NUMBEROFNAMES - 1);
CreateFakeClient(g_cName[RandomName]);
iFakes++;
}
while (iFakes > iFakesNeeded)
{
for(int i = 1; i <= MaxClients; i++)
{
if(IsClientConnected(i) && IsFakeClient(i))
{
KickClient(i);
iFakes--;
break;
}
}
}
} }