[server] Implement con_loadfs(), con_reloadfs(), con_unloadfs()

This commit is contained in:
RD42 2024-04-12 22:20:30 +08:00
parent f75afc9aa5
commit 5d7faf8fbb
4 changed files with 81 additions and 3 deletions

View File

@ -106,9 +106,81 @@ void con_reloadlog() {
void con_players() {} // TODO: con_players W: 0048A8A0 L: 0809F140
void con_gravity() {} // TODO: con_gravity W: 0048A950 L: 0809F220
void con_weather() {} // TODO: con_weather W: 0048A980 L: 0809F260
void con_loadfs() {} // TODO: con_loadfs W: 0048A9B0 L: 0809F2A0
void con_reloadfs() {} // TODO: con_reloadfs W: 0048AA20 L: 0809F330
void con_unloadfs() {} // TODO: con_unloadfs W: 0048AAC0 L: 0809F410
void con_loadfs()
{
PLAYERID Temp = RconUser;
// Stop sending all the filterscripts prints to the user if they used in-game RCON
RconUser = INVALID_ID;
char* arg = strtok(NULL, "");
if (arg)
{
if(!pNetGame->GetFilterScripts()->LoadFilterScript(arg))
{
RconUser = Temp;
logprintf(" Filterscript '%s.amx' load failed.", arg);
}
else
{
RconUser = Temp;
logprintf(" Filterscript '%s.amx' loaded.", arg);
}
}
}
void con_reloadfs()
{
PLAYERID Temp = RconUser;
// Stop sending all the filterscripts prints to the user if they used in-game RCON
RconUser = INVALID_ID;
char* arg = strtok(NULL, "");
if (arg)
{
if(pNetGame->GetFilterScripts()->UnloadOneFilterScript(arg))
{
RconUser = Temp;
logprintf(" Filterscript '%s.amx' unloaded.", arg);
}
else
{
RconUser = Temp;
logprintf(" Filterscript '%s.amx' unload failed.", arg);
}
RconUser = INVALID_ID;
if(!pNetGame->GetFilterScripts()->LoadFilterScript(arg))
{
RconUser = Temp;
logprintf(" Filterscript '%s.amx' load failed'.", arg);
}
else
{
RconUser = Temp;
logprintf(" Filterscript '%s.amx' loaded.", arg);
}
}
}
void con_unloadfs()
{
PLAYERID Temp = RconUser;
// Stop sending all the filterscripts prints to the user if they used in-game RCON
RconUser = INVALID_ID;
char* arg = strtok(NULL, "");
if (arg)
{
if(pNetGame->GetFilterScripts()->UnloadOneFilterScript(arg))
{
RconUser = Temp;
logprintf(" Filterscript '%s.amx' unloaded.", arg);
}
else
{
RconUser = Temp;
logprintf(" Filterscript '%s.amx' unload failed.", arg);
}
}
}
#define CON_CMDFLAG_DEBUG 1

View File

@ -5,6 +5,8 @@ CNetGame *pNetGame = NULL;
CConsole *pConsole = NULL;
CPlugins *pPlugins = NULL;
PLAYERID RconUser=INVALID_ID;
FILE *pLogFile;
bool bQuitApp = false;
BOOL bGameModeFinished=FALSE;

View File

@ -103,6 +103,8 @@ typedef unsigned short VEHICLEID;
extern CConsole* pConsole;
extern CNetGame* pNetGame;
extern PLAYERID RconUser;
// -------------------
// FUNCTION PROTOTYPES
// -------------------

View File

@ -4,6 +4,8 @@
#define GAMESTATE_RUNNING 1
#define INVALID_ID 0xFFFF
class CNetGame // size: W: 14808 L: 14816
{
private: