I built sourcemod from
this pr (it does the same thing when compiled from
this commit tho)
Code:
sm version
SourceMod Version Information:
SourceMod Version: 1.9.0.5958
SourcePawn Engine: 1.9.0.5958, jit-x86 (build 1.9.0.5958)
SourcePawn API: v1 = 4, v2 = 11
Compiled on: Sep 11 2016 14:57:46
Built from: https://github.com/alliedmodders/sourcemod/commit/de5b93a
Build ID: 5958:de5b93a
http://www.sourcemod.net/
This is the test plugin that I am using to comfirm this:
PHP Code:
#include <sourcemod>
public Plugin myinfo =
{
name = "[TESTSUITE] ",
author = "fakuivan",
description = "Tests for RequestFrame hooking Think or GameFrame",
version = "1.0",
url = "https://forums.alliedmods.net/member.php?u=264797"
};
int gi_called;
int gi_divisor;
bool gb_calling;
public void OnPluginStart()
{
gi_divisor = 10
RegAdminCmd("sm_test_set_divisor", Command_SetDivisor, ADMFLAG_RCON, "Sets gi_divisor on plugin.");
RegAdminCmd("sm_test_set_calling", Command_SetCalling, ADMFLAG_RCON, "Sets gb_calling on plugin.");
RegAdminCmd("sm_test_is_processing", Command_IsProcessing, ADMFLAG_RCON, "Is GameFrame being called?");
RegAdminCmd("sm_test_hook_think", Command_AddHook, ADMFLAG_RCON, "Tests for RequestFrame hooking Think or GameFrame");
}
public Action Command_IsProcessing(int i_client, int i_args)
{
ReplyToCommand(i_client, "[SM-TEST] The server %s processing frames", IsServerProcessing() ? "is" : "is not")
}
public Action Command_SetDivisor(int i_client, int i_args)
{
if (i_args != 1)
{
ReplyToCommand(i_client, "[SM-TEST] usage \"command <divisior>\"");
return Plugin_Handled;
}
gi_divisor = GetCmdArgInt(1);
gi_called = 0;
ReplyToCommand(i_client, "[SM-TEST] Setted gi_divisor to %d and gi_called to 0", gi_divisor);
return Plugin_Handled;
}
public Action Command_SetCalling(int i_client, int i_args)
{
if (i_args != 1)
{
ReplyToCommand(i_client, "[SM-TEST] usage \"command <1/0>\"");
return Plugin_Handled;
}
gb_calling = view_as<bool>(GetCmdArgInt(1));
ReplyToCommand(i_client, "[SM-TEST] Setted gb_calling to %s", gb_calling ? "true" : "false");
return Plugin_Handled;
}
public void OnGameFrame()
{
if (!gb_calling) { return; }
if (gi_called < gi_divisor)
{
gi_called++;
return;
}
gi_called = 0;
PrintToServer("[SM-TEST] GameFrame called %d times after the last print", gi_divisor);
}
public Action Command_AddHook(int i_client, int i_args)
{
if (i_args != 2)
{
ReplyToCommand(i_client, "[SM-TEST] usage \"command <data> <1/0>\"");
return Plugin_Handled;
}
int i_data = GetCmdArgInt(1);
bool b_hook_think = view_as<bool>(GetCmdArgInt(2));
ReplyToCommand(i_client, "[SM-TEST] Calling RequestFrame, HookThink set to %d, data: %d", b_hook_think, i_data);
RequestFrame(Callback_Hook, i_data, b_hook_think);
return Plugin_Handled;
}
void Callback_Hook(any data)
{
PrintToServer("[SM-TEST] Someone called us, data: %d", data);
}
stock int GetCmdArgInt(int argnum, int length = 12, int base = 10)
{
char[] s_buffer = new char[length];
GetCmdArg(argnum, s_buffer, length);
return StringToInt(s_buffer, base);
}
Console output:
Code:
sv_pausable 1
sm_test_is_processing
[SM-TEST] The server is processing frames
sm_test_set_divisor 60 //~1 prints/sec
sm_test_set_calling 1
[SM-TEST] Setted gb_calling to true
[SM-TEST] GameFrame called 60 times after the last print
[SM-TEST] GameFrame called 60 times after the last print
[SM-TEST] GameFrame called 60 times after the last print
[SM-TEST] GameFrame called 60 times after the last print
sm_test_set_calling 0
[SM-TEST] Setted gb_calling to false
setpause //on the client
sm_test_is_processing
[SM-TEST] The server is not processing frames
sm_test_set_calling 1
[SM-TEST] Setted gb_calling to true
[SM-TEST] GameFrame called 60 times after the last print
[SM-TEST] GameFrame called 60 times after the last print
[SM-TEST] GameFrame called 60 times after the last print
sm_test_set_calling 0
sm_test_is_processing //just to confirm
[SM-TEST] The server is not processing frames
The same thing happens on map start
Code:
map pl_upward
/.. ../ usual map start bs
status
hostname: Team Fortress
version : 3591277/24 3593021 secure
udp/ip : 192.168.110.101:27080 (public ip: 186.138.154.133)
steamid : [A:1:688189447:7383] (90103702979145735)
account : not logged in (No account specified)
map : pl_upward at: 0 x, 0 y, 0 z
tags : increased_maxplayers,payload
players : 0 humans, 0 bots (32 max)
edicts : 998 used of 2048 max
Spawns Points Kills Deaths Assists
Scout 5 0 0 1 0
Sniper 0 0 0 0 0
Soldier 8 0 0 0 0
Demoman 5 0 0 4 0
Medic 0 0 0 0 0
Heavy 0 0 0 0 0
Pyro 1 0 0 0 0
Spy 0 0 0 0 0
Engineer 0 0 0 0 0
# userid name uniqueid connected ping loss state adr
sm_test_is_processing
[SM-TEST] The server is not processing frames
sm_test_set_calling 1
[SM-TEST] Setted gb_calling to true
[SM-TEST] GameFrame called 60 times after the last print
[SM-TEST] GameFrame called 60 times after the last print
[SM-TEST] GameFrame called 60 times after the last print
sm_test_set_calling 0
Any Ideas on why this is happening?