FakePopulation: big update

+ edit ZombieManager to avoid fakes being motherzombie
This commit is contained in:
Dogan 2019-09-29 19:46:32 +02:00
parent 7c18d0ce43
commit 8bf4b9363b
2 changed files with 129 additions and 33 deletions

View File

@ -1,4 +1,6 @@
#include <sourcemod> #include <sourcemod>
#include <sdktools>
#include <cstrike>
#pragma semicolon 1 #pragma semicolon 1
#pragma newdecls required #pragma newdecls required
@ -6,7 +8,8 @@
#define NUMBEROFNAMES 62 #define NUMBEROFNAMES 62
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", "", "."}; 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", "", "."};
bool g_bFakePopulation[MAXPLAYERS+1]; bool g_bFakePopulation[MAXPLAYERS + 1];
int g_iLatency[MAXPLAYERS + 1];
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
// Purpose: // Purpose:
@ -16,7 +19,7 @@ public Plugin myinfo =
name = "ImprovedHitboxes", //camouflage name = "ImprovedHitboxes", //camouflage
author = "Neon + Dogan", author = "Neon + Dogan",
description = "Handle Hitboxes via Plugin", description = "Handle Hitboxes via Plugin",
version = "2.0", version = "3.0",
url = "https://steamcommunity.com/id/n3ontm" url = "https://steamcommunity.com/id/n3ontm"
}; };
@ -39,6 +42,7 @@ public void OnPluginEnd()
if(g_bFakePopulation[i]) if(g_bFakePopulation[i])
{ {
g_bFakePopulation[i] = false; g_bFakePopulation[i] = false;
g_iLatency[i] = 0;
KickClientEx(i); KickClientEx(i);
} }
} }
@ -50,12 +54,19 @@ public void OnPluginEnd()
public Action Command_DebugFakes(int client, int argc) public Action Command_DebugFakes(int client, int argc)
{ {
int iFakes = 0; int iFakes = 0;
int iFakesInTeam = 0;
for(int i = 1; i <= MaxClients; i++) for(int i = 1; i <= MaxClients; i++)
{ {
if (g_bFakePopulation[i]) if (g_bFakePopulation[i])
iFakes++; iFakes++;
if (g_bFakePopulation[i] && GetClientTeam(i) > 0)
iFakesInTeam++;
} }
ReplyToCommand(client, "[SM] There are currently %d Fake Players.", iFakes);
ReplyToCommand(client, "[SM] There are currently %d Fake Players, from which %d are in Spectate.", iFakes, iFakes - iFakesInTeam);
return Plugin_Handled; return Plugin_Handled;
} }
@ -76,7 +87,10 @@ public void OnClientDisconnect(int client)
if (client > 0) if (client > 0)
{ {
if(g_bFakePopulation[client]) if(g_bFakePopulation[client])
{
g_bFakePopulation[client] = false; g_bFakePopulation[client] = false;
g_iLatency[client] = 0;
}
if (!IsFakeClient(client)) if (!IsFakeClient(client))
CheckPopulation(); CheckPopulation();
@ -96,50 +110,132 @@ public void CheckPopulation()
} }
int iFakes = 0; int iFakes = 0;
int iFakesInTeam = 0;
for(int i = 1; i <= MaxClients; i++) for(int i = 1; i <= MaxClients; i++)
{ {
if (g_bFakePopulation[i]) if (g_bFakePopulation[i])
iFakes++; iFakes++;
if (g_bFakePopulation[i] && GetClientTeam(i) > 0)
iFakesInTeam++;
} }
int iFakesNeeded = 0; int iFakesNeeded = 0;
int iFakesInTeamNeeded = 0;
if (iPlayers > 61) if (iPlayers > 61)
iFakesNeeded = 0;
else if(iPlayers > 60)
iFakesNeeded = 1;
else if(iPlayers > 55)
iFakesNeeded = 3;
else if (iPlayers > 20)
iFakesNeeded = 4;
else if (iPlayers > 10)
iFakesNeeded = 3;
else if (iPlayers > 5)
iFakesNeeded = 2;
else
iFakesNeeded = 0;
if(iFakesNeeded == iFakes)
return;
while (iFakes < iFakesNeeded)
{ {
int RandomName = GetRandomInt(0, NUMBEROFNAMES - 1); iFakesNeeded = 0;
int iIndex = CreateFakeClient(g_cName[RandomName]); }
g_bFakePopulation[iIndex] = true; else if(iPlayers > 60)
iFakes++; {
iFakesNeeded = 1;
iFakesInTeamNeeded = 0;
}
else if(iPlayers > 55)
{
iFakesNeeded = 3;
iFakesInTeamNeeded = 2;
}
else if(iPlayers > 40)
{
iFakesInTeamNeeded = 3;
}
else if (iPlayers > 20)
{
iFakesNeeded = 4;
iFakesInTeamNeeded = 2;
}
else if (iPlayers > 10)
{
iFakesNeeded = 3;
iFakesInTeamNeeded = 1;
}
else if (iPlayers > 5)
{
iFakesNeeded = 2;
}
else
{
iFakesNeeded = 0;
iFakesInTeamNeeded = 0;
} }
while (iFakes > iFakesNeeded) if (iFakes != iFakesNeeded)
{ {
for(int i = 1; i <= MaxClients; i++) while (iFakes < iFakesNeeded)
{ {
if(g_bFakePopulation[i]) int RandomName = GetRandomInt(0, NUMBEROFNAMES - 1);
int iIndex = CreateFakeClient(g_cName[RandomName]);
g_bFakePopulation[iIndex] = true;
g_iLatency[iIndex] = GetRandomInt(30, 120);
AdminId FakeAdmin = CreateAdmin();
SetAdminFlag(FakeAdmin, Admin_Custom6, true);
SetUserAdmin(iIndex, FakeAdmin, true);
CS_SetClientClanTag(iIndex, "UNLOZE");
iFakes++;
}
while (iFakes > iFakesNeeded)
{
for(int i = 1; i <= MaxClients; i++)
{ {
g_bFakePopulation[i] = false; if(g_bFakePopulation[i])
KickClientEx(i); {
iFakes--; g_bFakePopulation[i] = false;
break; g_iLatency[i] = 0;
KickClientEx(i);
iFakes--;
break;
}
}
}
}
if (iFakes == iFakesNeeded && iFakesInTeam != iFakesInTeamNeeded)
{
while (iFakesInTeam < iFakesInTeamNeeded)
{
for(int i = 1; i <= MaxClients; i++)
{
if(g_bFakePopulation[i] && GetClientTeam(i) < 1)
{
ChangeClientTeam(i, CS_TEAM_CT);
FakeClientCommandEx(i, "joinclass");
iFakesInTeam++;
break;
}
}
}
while (iFakesInTeam > iFakesInTeamNeeded)
{
for(int i = 1; i <= MaxClients; i++)
{
if(g_bFakePopulation[i] && GetClientTeam(i) > 0)
{
ChangeClientTeam(i, CS_TEAM_SPECTATOR);
iFakesInTeam--;
break;
}
} }
} }
} }
} }
public void OnGameFrame()
{
for(int i = 1; i <= MaxClients; i++)
{
if(g_bFakePopulation[i])
{
int iResEnt = GetPlayerResourceEntity();
if(iResEnt == -1)
return;
SetEntProp(iResEnt, Prop_Send, "m_iPing", g_iLatency[i], _, i);
}
}
}

View File

@ -71,7 +71,7 @@ public void ZR_OnClientHumanPost(int client, bool respawn, bool protect)
public Action ZR_OnClientInfect(int &client, int &attacker, bool &motherInfect, bool &respawnOverride, bool &respawn) public Action ZR_OnClientInfect(int &client, int &attacker, bool &motherInfect, bool &respawnOverride, bool &respawn)
{ {
if(g_bTestRound || (GetClientIdleTime(client) > g_iAFKTime && motherInfect)) if(g_bTestRound || (GetClientIdleTime(client) > g_iAFKTime && motherInfect) || IsFakeClient(client))
return Plugin_Handled; return Plugin_Handled;
return Plugin_Continue; return Plugin_Continue;