From 9ace3eb0a1fa0cf7193fd970728a48073ce36adf Mon Sep 17 00:00:00 2001 From: Dogan Date: Sun, 29 Sep 2019 22:45:17 +0200 Subject: [PATCH] FakePopulation: another update --- FakePopulation/scripting/FakePopulation.sp | 29 ++++++++++++++++------ 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/FakePopulation/scripting/FakePopulation.sp b/FakePopulation/scripting/FakePopulation.sp index 449cb34b..b56fccd6 100644 --- a/FakePopulation/scripting/FakePopulation.sp +++ b/FakePopulation/scripting/FakePopulation.sp @@ -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);