Skip to content

Commit

Permalink
Update!
Browse files Browse the repository at this point in the history
  • Loading branch information
UnrealKaraulov committed Aug 13, 2024
1 parent a0b8e08 commit 6ed70f3
Show file tree
Hide file tree
Showing 2 changed files with 143 additions and 50 deletions.
82 changes: 55 additions & 27 deletions PLUGIN/plugin.sma
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,45 @@

#define PLUGIN "Unreal Demo Plugin"
#define AUTHOR "karaulov"
#define VERSION "1.61"
#define VERSION "1.62"

// IF NEED REDUCE TRAFFIC USAGE UNCOMMENT THIS LINE
// ЕСЛИ НЕОБХОДИМО БОЛЬШЕ ДЕТЕКТОВ (НО ТАК ЖЕ БОЛЬШЕ ТРАФИКА) ЗАКОММЕНТИРУЙТЕ ЭТУ СТРОКУ
#define SMALL_TRAFFIC

new g_iDemoHelperInitStage[33] = {0,...};
new g_iFrameNum[33] = {0,...};
new g_bNeedResend[33] = {false,...};

new Float:g_flLastEventTime[33] = {0.0,...};
new Float:g_flLastSendTime[33] = {-1.0,...};
new Float:g_flPMoveTime[33] = {0.0,...};
new Float:g_flStartCmdTime[33] = {0.0,...};
new Float:g_flDelay1Msec[33] = {-1.0,...};
new Float:g_flDelay2Time[33] = {-1.0,...};
new Float:g_flPMovePrevPrevAngles[33][3];

new Float:g_flGameTimeReal = 0.0;

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_cvar( "unreal_demoplug", VERSION, FCVAR_SERVER | FCVAR_SPONLY | FCVAR_UNLOGGED );

register_cvar("unreal_demoplug", VERSION, FCVAR_SERVER | FCVAR_SPONLY | FCVAR_UNLOGGED);
register_clcmd("fullupdate", "UnrealDemoHelpInitialize");

RegisterHookChain(RG_PM_Move, "PM_Move", .post =false);
RegisterHookChain(RG_PM_Move, "PM_Move", .post = false);
RegisterHookChain(RG_CBasePlayer_Jump, "HC_CBasePlayer_Jump_Pre", .post = false);

register_forward(FM_PlaybackEvent, "fw_PlaybackEvent");

new plugin_id = get_plugin(-1);
log_amx("Unreal Demo Plugin Loaded. ID: %i. Author: %s. Version: %s", plugin_id, AUTHOR, VERSION);

if (plugin_id != 0)
{
log_error("Error! Unreal Demo Plugin need install at start of plugins.ini file!");

This comment has been minimized.

Copy link
@kovakovi2000

kovakovi2000 Aug 13, 2024

ERROR [47]: argument type mismatch (argument 1)
ERROR [48]: argument type mismatch (argument 1)
ERROR [49]: argument type mismatch (argument 1)

https://www.amxmodx.org/api/amxmodx/log_error

native log_error(error, const fmt[], any:...)
/**

  • Logs an error in the native and breaks into the AMXX debugger.
  • @note This acts as if the calling plugin - the plugin that is calling the
  • native, not the plugin calling this function - triggered the error,
  • just like when AMXX natives error.
  • @param error Error number
  • @param fmt Formatting rules
  • @param ... Variable number of formatting parameters
  • @NoReturn
  • @error The function is guaranteed to throw an error, but will make
  • it appear as if the plugin calling the native triggered it.
    */

This comment has been minimized.

Copy link
@UnrealKaraulov

UnrealKaraulov Aug 14, 2024

Author Owner

Спасибо, все fixed!

log_error("Error! Unreal Demo Plugin need install at start of plugins.ini file!");
log_error("Error! Unreal Demo Plugin need install at start of plugins.ini file!");
}
}

public server_frame()
Expand All @@ -55,6 +65,7 @@ public client_disconnected(id)
g_flDelay1Msec[id] = -1.0;
g_flDelay2Time[id] = -1.0;
g_flPMoveTime[id] = 0.0;
g_bNeedResend[id] = false;

g_flPMovePrevPrevAngles[id][0] = g_flPMovePrevPrevAngles[id][1] = g_flPMovePrevPrevAngles[id][2] = 0.0;

Expand Down Expand Up @@ -171,17 +182,24 @@ public PM_Move(const id)

public UnrealDemoHelpInitialize(id)
{
g_flLastEventTime[id] = 0.0;
g_flLastSendTime[id] = 0.0;
g_iFrameNum[id] = 0;
g_iDemoHelperInitStage[id] = 0;

if (is_user_connected(id))
{
remove_task(id);
if (!is_user_hltv(id) && !is_user_bot(id))
if (task_exists(id))
{
set_task(1.0,"DemoHelperInitializeTask",id);
g_bNeedResend[id] = true;
}
else
{
g_flLastEventTime[id] = 0.0;
g_flLastSendTime[id] = 0.0;
g_iFrameNum[id] = 0;
g_iDemoHelperInitStage[id] = 0;

remove_task(id);
if (!is_user_hltv(id) && !is_user_bot(id))
{
set_task(1.25,"DemoHelperInitializeTask",id);
}
}
}
}
Expand All @@ -206,7 +224,6 @@ public DemoHelperInitializeTask(id)
new szAuth[64];
get_user_authid(id,szAuth,charsmax(szAuth));
WriteDemoInfo(id,"UDS/AUTH/%s",szAuth);

new szDate[64];
get_time( "%d.%m.%Y %H:%M:%S", szDate, charsmax( szDate ) );
WriteDemoInfo(id,"UDS/DATE/%s",szDate);
Expand All @@ -216,34 +233,45 @@ public DemoHelperInitializeTask(id)
{
WriteDemoInfo(id,"UDS/MINR/%i",get_cvar_num("sv_minrate"));
WriteDemoInfo(id,"UDS/MAXR/%i",get_cvar_num("sv_maxrate"));

WriteDemoInfo(id,"UDS/MINUR/%i",get_cvar_num("sv_minupdaterate"));
WriteDemoInfo(id,"UDS/MAXUR/%i",get_cvar_num("sv_maxupdaterate"));

g_flLastEventTime[id] = 0.0;
g_iDemoHelperInitStage[id] = -1;
set_task(1.0,"DemoHelperInitializeTask",id);
}
case 4:
{
if (g_bNeedResend[id])
{
g_bNeedResend[id] = false;
g_iDemoHelperInitStage[id] = 0;
set_task(1.0,"DemoHelperInitializeTask",id);
}
else
{
g_flLastEventTime[id] = 0.0;
g_iDemoHelperInitStage[id] = -1;
}
}
}
}

// SVC_RESOURCELOCATION ignore all strings not started with http or https
// and can be used to save any info to demo
// Updated to more stable
public WriteDemoInfo(const index, const message[], any:... )
{
new buffer[ 256 ];
static buffer[256];
buffer[0] = EOS;

message_begin(MSG_ONE, SVC_RESOURCELOCATION, _, index);
new numArguments = numargs();

if (numArguments == 2)
{
message_begin(MSG_ONE, SVC_RESOURCELOCATION, _, index)
write_string(message)
message_end()
formatex(buffer, charsmax(buffer), "%s", message);
}
else
{
vformat( buffer, charsmax( buffer ), message, 3 );
message_begin(MSG_ONE, SVC_RESOURCELOCATION, _, index)
write_string(buffer)
message_end()
vformat(buffer, charsmax(buffer), message, 3);
}
write_string(buffer);
message_end();
}
111 changes: 88 additions & 23 deletions UnrealDemoScanner/UnrealDemoScanner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace DemoScanner.DG
public static class DemoScanner
{
public const string PROGRAMNAME = "Unreal Demo Scanner";
public const string PROGRAMVERSION = "1.72.14b";
public const string PROGRAMVERSION = "1.72.15b";

public static bool DEMOSCANNER_HLTV = false;

Expand Down Expand Up @@ -275,11 +275,13 @@ public MyTreeNode(string text)
public static bool SecondFound;
public static string LastSecondString = "";
public static int CurrentFps;
public static int CurrentFpsSecond;
public static int RealFpsMin = int.MaxValue;
public static int RealFpsMax = int.MinValue;
public static float LastFpsCheckTime = -1.0f;
public static bool SecondFound2;
public static int CurrentFps2;
public static int CurrentFps2Second;
public static int RealFpsMin2 = int.MaxValue;
public static int RealFpsMax2 = int.MinValue;
public static float LastFpsCheckTime2 = -1.0f;
Expand Down Expand Up @@ -3416,7 +3418,7 @@ public static void RunDemoScanner(string[] args)
MaxBytesPerSecond = CurrentMsgBytes;
}

if (CurrentMsgBytes >= 100000)
if (CurrentMsgBytes >= 970000)
{
MsgOverflowSecondsCount++;
}
Expand Down Expand Up @@ -3446,6 +3448,7 @@ public static void RunDemoScanner(string[] args)
CurrentMsgBytes = CurrentMsgHudCount = CurrentMsgStuffCmdCount = CurrentMsgPrintCount = CurrentMsgDHudCount = 0;
SecondFound = true;
averagefps.Add(CurrentFps);
CurrentFpsSecond = CurrentFps;
CurrentFps = 0;
CurrentGameSecond++;
}
Expand Down Expand Up @@ -6043,6 +6046,7 @@ следующий кадр изменение и 5 кадров нет движ
averagefps2.Add(1000.0f / (1000.0f * nf.RParms.Frametime));
}

CurrentFps2Second = CurrentFps2;
CurrentFps2 = 0;
}
else
Expand Down Expand Up @@ -8940,6 +8944,7 @@ следующий кадр изменение и 5 кадров нет движ
}

Console.WriteLine("Codecname:" + VoiceCodec);

if (CheatKey > 0)
{
Console.WriteLine("Possible press cheat key " + CheatKey + " times. (???)");
Expand Down Expand Up @@ -8977,26 +8982,73 @@ следующий кадр изменение и 5 кадров нет движ
}
}

Console.WriteLine("Max input bytes per second : " + MaxBytesPerSecond);
Console.WriteLine("Max channel overflows ( > 100kbytes rate) : " + MsgOverflowSecondsCount);
Console.WriteLine("Max HUD messages per seconds : " + MaxHudMsgPerSecond);
Console.WriteLine("Max DHUD messages per seconds : " + MaxDHudMsgPerSecond);
Console.WriteLine("Max PRINT messages per seconds : " + MaxPrintCmdMsgPerSecond);
Console.WriteLine("Max STUFFCMD messages per seconds : " + MaxStuffCmdMsgPerSecond);
Console.WriteLine("Server lags found(DROP FPS): " + ServerLagCount);
Console.WriteLine("Loss count:" + LossPackets);
Console.WriteLine("Frameskip count:" + LossPackets2);
Console.WriteLine("Choke count(small sv_minrate) : " + ChokePackets);
if (PlayerSensUsageList.Count > 1)
if (IsRussia)
{
if (PlayerSensUsageList.Count > 1)
{
Console.WriteLine("Player 'sensitivity' cvar: " +
(PlayerSensUsageList[0].sens / 0.022).ToString("F2") + "(or " +
(PlayerSensUsageList[1].sens / 0.022).ToString("F2") + ")");
}
else if (PlayerSensUsageList.Count == 1)
{
Console.WriteLine("Player 'sensitivity' cvar: " +
(PlayerSensUsageList[0].sens / 0.022).ToString("F2"));
}
else
{
Console.WriteLine("Can't detect player 'sensitivity' cvar!");
}
}
else
{
if (PlayerSensUsageList.Count > 1)
{
Console.WriteLine("Квар 'sensitivity'(сенс) игрока: " +
(PlayerSensUsageList[0].sens / 0.022).ToString("F2") + "(or " +
(PlayerSensUsageList[1].sens / 0.022).ToString("F2") + ")");
}
else if (PlayerSensUsageList.Count == 1)
{
Console.WriteLine("Квар 'sensitivity'(сенс) игрока: " +
(PlayerSensUsageList[0].sens / 0.022).ToString("F2"));
}
else
{
Console.WriteLine("Не удалось определить 'sensitivity' игрока.");
}
}


if (!IsRussia)
{
Console.WriteLine("Player 'sensitivity' cvar: " +
(PlayerSensUsageList[0].sens / 0.022).ToString("F2") + "(or " +
(PlayerSensUsageList[1].sens / 0.022).ToString("F2") + ")");
Console.WriteLine("[SERVER DIAGNOSTIC DATA]");
Console.WriteLine("Max input bytes per second: " + MaxBytesPerSecond);
Console.WriteLine("Max channel overflows (100kbytes rate): " + MsgOverflowSecondsCount);
Console.WriteLine("Max HUD messages per seconds: " + MaxHudMsgPerSecond);
Console.WriteLine("Max DHUD messages per seconds: " + MaxDHudMsgPerSecond);
Console.WriteLine("Max PRINT messages per seconds: " + MaxPrintCmdMsgPerSecond);
Console.WriteLine("Max STUFFCMD messages per seconds: " + MaxStuffCmdMsgPerSecond);
Console.WriteLine("Server lags found(DROP FPS): " + ServerLagCount);
Console.WriteLine("Loss count: " + LossPackets);
Console.WriteLine("Frameskip count: " + LossPackets2);
Console.WriteLine("Choke count(small sv_minrate): " + ChokePackets);
Console.WriteLine("[END SERVER DIAGNOSTIC DATA]");
}
else if (PlayerSensUsageList.Count == 1)
else
{
Console.WriteLine("Player 'sensitivity' cvar: " +
(PlayerSensUsageList[0].sens / 0.022).ToString("F2"));
Console.WriteLine("[БЛОК ДАННЫХ ДЛЯ ДИАГНОСТИКИ СЕРВЕРА]");
Console.WriteLine("Максимальное количество байт в секунду: " + MaxBytesPerSecond);
Console.WriteLine("Количество перегрузок канала (100кбайт): " + MsgOverflowSecondsCount);
Console.WriteLine("Количество HUD сообщений в секунду: " + MaxHudMsgPerSecond);
Console.WriteLine("Количество DHUD сообщений в секунду: " + MaxDHudMsgPerSecond);
Console.WriteLine("Количество PRINT сообщений в секунду: " + MaxPrintCmdMsgPerSecond);
Console.WriteLine("Количество STUFFCMD сообщений в секунду: " + MaxStuffCmdMsgPerSecond);
Console.WriteLine("Количество подвисаний сервера (низкий фпс): " + ServerLagCount);
Console.WriteLine("Игрок отправил потерянных пакетов: " + LossPackets);
Console.WriteLine("Игрок сделал пропуск кадров: " + LossPackets2);
Console.WriteLine("Количество CHOKE(слишком низкий sv_minrate): " + ChokePackets);
Console.WriteLine("[КОНЕЦ БЛОКА ДАННЫХ ДИАГНОСТИКИ СЕРВЕРА]");
}

ForceFlushScanResults();
Expand Down Expand Up @@ -9472,7 +9524,7 @@ public static void ProcessPluginMessage(string cmd)
if (RecordDate.Length == 0)
{
RecordDate = cmdList[2];
DemoScanner_AddWarn("[INFO] Record date:" + RecordDate, true, false,
DemoScanner_AddWarn("[INFO] Record date: " + RecordDate, true, false,
true, true);
}
}
Expand Down Expand Up @@ -9590,7 +9642,7 @@ public static void ProcessPluginMessage(string cmd)
{
if (ms <= 1)
{
if (abs(CurrentTime - LastCmdHack) > 5.0 && CurrentFps < 500 && CurrentFps2 < 500)
if (abs(CurrentTime - LastCmdHack) > 5.0 && CurrentFpsSecond < 450 && CurrentFps2Second < 450)
{
DemoScanner_AddWarn(
"[CMD HACK TYPE 3.1] at (" + CurrentTime + ") " + CurrentTimeString,
Expand Down Expand Up @@ -9710,7 +9762,7 @@ public static void ProcessPluginMessage(string cmd)
{
if (ms <= 1)
{
if (abs(CurrentTime - LastCmdHack) > 5.0 && CurrentFps < 500 && CurrentFps2 < 500)
if (abs(CurrentTime - LastCmdHack) > 5.0 && CurrentFpsSecond < 450 && CurrentFps2Second < 450)
{
DemoScanner_AddWarn(
"[CMD HACK TYPE 3.2] at (" + CurrentTime + ") " + CurrentTimeString,
Expand Down Expand Up @@ -10151,8 +10203,21 @@ public static void ProcessPluginMessage(string cmd)
{
if (abs(CurrentTime - LastCmdHack) > 3.0)
{
DemoScanner_AddWarn("[INTERIUM HACK 2023] at (" + CurrentTime +
string smallcmd = (cmdList[0].Length > 3 ? cmdList[0].Remove(3) : cmdList[0]).Trim();
if (smallcmd.Length > 0 && smallcmd[0] == 'v')
{
DemoScanner_AddWarn("[ALTERNATIVE HACK 2023 version:\"" + smallcmd + "\"] at (" + CurrentTime +
") : " + CurrentTimeString);
}
else
{
if (smallcmd.Length == 0)
{
smallcmd = "UNK";
}
DemoScanner_AddWarn("[INTERIUM HACK 2023 version:\"" + smallcmd + "\"] at (" + CurrentTime +
") : " + CurrentTimeString);
}
LastCmdHack = CurrentTime;
}
}
Expand Down

0 comments on commit 6ed70f3

Please sign in to comment.