FakeClients: improve Names

This commit is contained in:
neon
2019-12-12 11:54:40 +01:00
parent c1a6a1c9c6
commit 4da7fddcb2
2 changed files with 168 additions and 7 deletions
+54 -7
View File
@@ -5,8 +5,8 @@
#pragma semicolon 1
#pragma newdecls required
#define NUMBEROFNAMES 116
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", "edger", "clownface", "слово", "счастливый", "kara", "puta", "meow", "uncle sam", "FunBun", "Counter-Strike.Com.Ua", "For-css.Ru", "BOBO", "", ".", "Z3r0", "ZeTo", "Sakharov", "Sache11", "Mr. Dogenberg", "Maus", "Magikarpet", "Miles", "magick", "James Lebron", "jiZZ", "Dobel", "THE POPE OF DOPE", "The Joker", "that guy over there", "Be happy :)", "KingKong", "Figger Nucker", "noname", "alexdu63", "I put babies in the microwave", "Tango!!", "faggot killer", "admin pidaras", "MESSI>RONALDO", "Gabe Newell", "acetylsalicylic acid", "Country-Steak: Sauce", "chlamydia harvester", "kyle_69", "Shaggy's dog", "rEVERSE", "Piment d'espelette", "FireHawk", "Sgt. Pepper", "krix.", "imPulse_^_", "Lardon", "CAPS LOCK", "$pussymoneyweed$", "Low5", "Bonerfart", "Shiny Thanos", "MARK NUTT", "Legless Runner", "Banana is a berry", "Gabriel", "El Moustachio", "James Bong", "Disco Fever", "Acacia", "Sugared", "ronald goddamn macdonald", "pizza is life"};
#define MAXNAMES 500
ArrayList g_hNames;
bool g_bFakePopulation[MAXPLAYERS + 1];
bool g_bMapEnded;
@@ -29,7 +29,7 @@ public Plugin myinfo =
name = "ImprovedHitboxes", //camouflage
author = "Neon + Dogan + Botox",
description = "Handle Hitboxes via Plugin",
version = "5.1.0",
version = "5.2.0",
url = "https://steamcommunity.com/id/n3ontm"
};
@@ -42,6 +42,9 @@ public void OnPluginStart()
RegAdminCmd("sm_fakes", Command_Fakes, ADMFLAG_GENERIC, "Shows the fake-clients on server");
RegAdminCmd("sm_setfakes", Command_SetFakes, ADMFLAG_RCON, "Manually sets the amount of fake-clients");
int arraySize = ByteCountToCells(MAX_NAME_LENGTH);
g_hNames = CreateArray(arraySize);
g_iAdminFakes = -1;
g_bMapEnded = false;
g_bBlockInstantFakeConnects = false;
@@ -76,6 +79,29 @@ public void OnPluginEnd()
//----------------------------------------------------------------------------------------------------
public void OnMapStart()
{
char sFile[PLATFORM_MAX_PATH];
char sLine[MAX_NAME_LENGTH];
BuildPath(Path_SM, sFile, sizeof(sFile), "configs/fakeclients_names.txt");
Handle hFile = OpenFile(sFile, "r");
if(hFile != INVALID_HANDLE)
{
int iLine = 0;
while (!IsEndOfFile(hFile))
{
if (!ReadFileLine(hFile, sLine, sizeof(sLine)) || iLine >= MAXNAMES)
break;
TrimString(sLine);
g_hNames.PushString(sLine);
iLine++;
}
delete hFile;
}
else
SetFailState("Could not open file: configs/fakeclients_names.txt");
g_bMapEnded = false;
g_bBlockInstantFakeConnects = false;
@@ -124,14 +150,19 @@ public Action RandomizePing(Handle timer)
//----------------------------------------------------------------------------------------------------
public Action RandomizeNames(Handle timer)
{
ArrayList hNames = g_hNames.Clone();
for(int i = 1; i <= MaxClients; i++)
{
if(g_bFakePopulation[i])
{
int RandomName = GetRandomInt(0, NUMBEROFNAMES - 1);
SetClientName(i, g_cName[RandomName]);
int iRand = GetRandomInt(0, hNames.Length - 1);
char sName[MAX_NAME_LENGTH];
g_hNames.GetString(iRand, sName, sizeof(sName));
g_hNames.Erase(iRand);
SetClientName(i, sName);
}
}
delete hNames;
}
//----------------------------------------------------------------------------------------------------
@@ -366,8 +397,24 @@ public void CheckPopulation()
{
while (iFakes < iFakesNeeded && !g_bBlockInstantFakeConnects)
{
int RandomName = GetRandomInt(0, NUMBEROFNAMES - 1);
int iIndex = CreateFakeClient(g_cName[RandomName]);
ArrayList hNames = g_hNames.Clone();
char sName[MAX_NAME_LENGTH];
for(int i = 1; i <= MaxClients; i++)
{
if(g_bFakePopulation[i])
{
GetClientName(i, sName, sizeof(sName));
int iPos = hNames.FindString(sName);
if (iPos > -1)
hNames.Erase(iPos);
}
}
int iRand = GetRandomInt(0, hNames.Length - 1);
g_hNames.GetString(iRand, sName, sizeof(sName));
delete hNames;
int iIndex = CreateFakeClient(sName);
if(iIndex < 1 || iIndex > MaxClients)
return;