FakePopulation: another update

This commit is contained in:
Dogan 2019-09-29 22:45:17 +02:00
parent bafd22615a
commit 9ace3eb0a1

View File

@ -10,6 +10,7 @@ char g_cName[NUMBEROFNAMES][] = {"Dwelitram", "Gwyri", "Caredus", "Arerawia", "V
bool g_bFakePopulation[MAXPLAYERS + 1];
bool g_bMapEnded;
int g_iBaseLatency[MAXPLAYERS + 1];
int g_iLatency[MAXPLAYERS + 1];
int g_iAdminFakes;
bool g_bCheckRequested;
@ -22,7 +23,7 @@ public Plugin myinfo =
name = "ImprovedHitboxes", //camouflage
author = "Neon + Dogan",
description = "Handle Hitboxes via Plugin",
version = "3.0",
version = "3.1",
url = "https://steamcommunity.com/id/n3ontm"
};
@ -36,6 +37,7 @@ public void OnPluginStart()
g_iAdminFakes = -1;
g_bMapEnded = false;
CreateTimer(1.0, RandomizePing, _, TIMER_REPEAT);
RequestFrame(CheckPopulation);
}
@ -62,8 +64,6 @@ public void OnPluginEnd()
public void OnMapStart()
{
g_bMapEnded = false;
//g_iAdminFakes = -1;
}
//----------------------------------------------------------------------------------------------------
@ -72,10 +72,19 @@ public void OnMapStart()
public void OnMapEnd()
{
g_bMapEnded = true;
g_iAdminFakes = -1;
}
LogMessage("OnMapEnd");
//g_iAdminFakes = -1;
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action RandomizePing(Handle timer)
{
for(int i = 1; i <= MaxClients; i++)
{
if(g_bFakePopulation[i])
g_iLatency[i] = g_iBaseLatency[i] + GetRandomInt(-3, 3);
}
}
//----------------------------------------------------------------------------------------------------
@ -233,11 +242,15 @@ public void CheckPopulation()
{
int RandomName = GetRandomInt(0, NUMBEROFNAMES - 1);
int iIndex = CreateFakeClient(g_cName[RandomName]);
SetEntityFlags(iIndex, FL_CLIENT | FL_FAKECLIENT);
SetEntityFlags(iIndex, FL_CLIENT);
DispatchKeyValue(iIndex, "classname", "player");
DispatchSpawn(iIndex);
g_bFakePopulation[iIndex] = true;
g_iLatency[iIndex] = GetRandomInt(30, 120);
g_iBaseLatency[iIndex] = GetRandomInt(20, 110);
g_iLatency[iIndex] = g_iBaseLatency[iIndex];
AdminId FakeAdmin = CreateAdmin();
SetAdminFlag(FakeAdmin, Admin_Custom6, true);
SetUserAdmin(iIndex, FakeAdmin, true);