mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Expose kick/ban/unban to UI SQVM
This commit is contained in:
parent
a68f55dac0
commit
3cbd98b900
@ -90,39 +90,7 @@ namespace VSquirrel
|
||||
|
||||
return SQ_OK;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: shutdown local game (host only)
|
||||
//-----------------------------------------------------------------------------
|
||||
SQRESULT ShutdownHostGame(HSQUIRRELVM v)
|
||||
{
|
||||
if (g_pHostState->m_bActiveGame)
|
||||
g_pHostState->m_iNextState = HostStates_t::HS_GAME_SHUTDOWN;
|
||||
|
||||
return SQ_OK;
|
||||
}
|
||||
}
|
||||
#ifndef CLIENT_DLL
|
||||
namespace SERVER
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: gets the number of real players on this server
|
||||
//-----------------------------------------------------------------------------
|
||||
SQRESULT GetNumHumanPlayers(HSQUIRRELVM v)
|
||||
{
|
||||
sq_pushinteger(v, g_pServer->GetNumHumanPlayers());
|
||||
return SQ_OK;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: gets the number of fake players on this server
|
||||
//-----------------------------------------------------------------------------
|
||||
SQRESULT GetNumFakeClients(HSQUIRRELVM v)
|
||||
{
|
||||
sq_pushinteger(v, g_pServer->GetNumFakeClients());
|
||||
return SQ_OK;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: kicks a player by given name
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -175,6 +143,38 @@ namespace VSquirrel
|
||||
SQChar* szCriteria = sq_getstring(v, 1);
|
||||
g_pBanSystem->UnbanPlayer(szCriteria);
|
||||
|
||||
return SQ_OK;
|
||||
}
|
||||
#endif // !CLIENT_DLL
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: shutdown local game (host only)
|
||||
//-----------------------------------------------------------------------------
|
||||
SQRESULT ShutdownHostGame(HSQUIRRELVM v)
|
||||
{
|
||||
if (g_pHostState->m_bActiveGame)
|
||||
g_pHostState->m_iNextState = HostStates_t::HS_GAME_SHUTDOWN;
|
||||
|
||||
return SQ_OK;
|
||||
}
|
||||
}
|
||||
#ifndef CLIENT_DLL
|
||||
namespace SERVER
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: gets the number of real players on this server
|
||||
//-----------------------------------------------------------------------------
|
||||
SQRESULT GetNumHumanPlayers(HSQUIRRELVM v)
|
||||
{
|
||||
sq_pushinteger(v, g_pServer->GetNumHumanPlayers());
|
||||
return SQ_OK;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: gets the number of fake players on this server
|
||||
//-----------------------------------------------------------------------------
|
||||
SQRESULT GetNumFakeClients(HSQUIRRELVM v)
|
||||
{
|
||||
sq_pushinteger(v, g_pServer->GetNumFakeClients());
|
||||
return SQ_OK;
|
||||
}
|
||||
}
|
||||
|
@ -23,17 +23,19 @@ namespace VSquirrel
|
||||
SQRESULT GetAvailableMaps(HSQUIRRELVM v);
|
||||
SQRESULT GetAvailablePlaylists(HSQUIRRELVM v);
|
||||
SQRESULT ShutdownHostGame(HSQUIRRELVM v);
|
||||
#ifndef CLIENT_DLL
|
||||
SQRESULT KickPlayerByName(HSQUIRRELVM v);
|
||||
SQRESULT KickPlayerById(HSQUIRRELVM v);
|
||||
SQRESULT BanPlayerByName(HSQUIRRELVM v);
|
||||
SQRESULT BanPlayerById(HSQUIRRELVM v);
|
||||
SQRESULT UnbanPlayer(HSQUIRRELVM v);
|
||||
#endif // !CLIENT_DLL
|
||||
}
|
||||
#ifndef CLIENT_DLL
|
||||
namespace SERVER
|
||||
{
|
||||
SQRESULT GetNumHumanPlayers(HSQUIRRELVM v);
|
||||
SQRESULT GetNumFakeClients(HSQUIRRELVM v);
|
||||
SQRESULT KickPlayerByName(HSQUIRRELVM v);
|
||||
SQRESULT KickPlayerById(HSQUIRRELVM v);
|
||||
SQRESULT BanPlayerByName(HSQUIRRELVM v);
|
||||
SQRESULT BanPlayerById(HSQUIRRELVM v);
|
||||
SQRESULT UnbanPlayer(HSQUIRRELVM v);
|
||||
}
|
||||
#endif // !CLIENT_DLL
|
||||
#ifndef DEDICATED
|
||||
|
@ -53,15 +53,15 @@ void Script_RegisterServerFunctions(CSquirrelVM* pSquirrelVM)
|
||||
Script_RegisterFunction(pSquirrelVM, "GetAvailableMaps", "Script_GetAvailableMaps", "Gets an array of all available maps", "array< string >", "", &VSquirrel::SHARED::GetAvailableMaps);
|
||||
Script_RegisterFunction(pSquirrelVM, "GetAvailablePlaylists", "Script_GetAvailablePlaylists", "Gets an array of all available playlists", "array< string >", "", &VSquirrel::SHARED::GetAvailablePlaylists);
|
||||
|
||||
Script_RegisterFunction(pSquirrelVM, "KickPlayerByName", "Script_KickPlayerByName", "Kicks a player from the server by name", "void", "string", &VSquirrel::SHARED::KickPlayerByName);
|
||||
Script_RegisterFunction(pSquirrelVM, "KickPlayerById", "Script_KickPlayerById", "Kicks a player from the server by handle or nucleus id", "void", "string", &VSquirrel::SHARED::KickPlayerById);
|
||||
|
||||
Script_RegisterFunction(pSquirrelVM, "BanPlayerByName", "Script_BanPlayerByName", "Bans a player from the server by name", "void", "string", &VSquirrel::SHARED::BanPlayerByName);
|
||||
Script_RegisterFunction(pSquirrelVM, "BanPlayerById", "Script_BanPlayerById", "Bans a player from the server by handle or nucleus id", "void", "string", &VSquirrel::SHARED::BanPlayerById);
|
||||
|
||||
Script_RegisterFunction(pSquirrelVM, "UnbanPlayer", "Script_UnbanPlayer", "Unbans a player from the server by nucleus id or ip address", "void", "string", &VSquirrel::SHARED::UnbanPlayer);
|
||||
|
||||
Script_RegisterFunction(pSquirrelVM, "ShutdownHostGame", "Script_ShutdownHostGame", "Shuts the local host game down", "void", "", &VSquirrel::SHARED::ShutdownHostGame);
|
||||
|
||||
Script_RegisterFunction(pSquirrelVM, "KickPlayerByName", "Script_KickPlayerByName", "Kicks a player from the server by name", "void", "string", &VSquirrel::SERVER::KickPlayerByName);
|
||||
Script_RegisterFunction(pSquirrelVM, "KickPlayerById", "Script_KickPlayerById", "Kicks a player from the server by handle or nucleus id", "void", "string", &VSquirrel::SERVER::KickPlayerById);
|
||||
|
||||
Script_RegisterFunction(pSquirrelVM, "BanPlayerByName", "Script_BanPlayerByName", "Bans a player from the server by name", "void", "string", &VSquirrel::SERVER::BanPlayerByName);
|
||||
Script_RegisterFunction(pSquirrelVM, "BanPlayerById", "Script_BanPlayerById", "Bans a player from the server by handle or nucleus id", "void", "string", &VSquirrel::SERVER::BanPlayerById);
|
||||
|
||||
Script_RegisterFunction(pSquirrelVM, "UnbanPlayer", "Script_UnbanPlayer", "Unbans a player from the server by nucleus id or ip address", "void", "string", &VSquirrel::SERVER::UnbanPlayer);
|
||||
}
|
||||
#endif // !CLIENT_DLL
|
||||
|
||||
@ -113,7 +113,15 @@ void Script_RegisterUIFunctions(CSquirrelVM* pSquirrelVM)
|
||||
|
||||
Script_RegisterFunction(pSquirrelVM, "GetAvailableMaps", "Script_GetAvailableMaps", "Gets an array of all available maps", "array< string >", "", &VSquirrel::SHARED::GetAvailableMaps);
|
||||
Script_RegisterFunction(pSquirrelVM, "GetAvailablePlaylists", "Script_GetAvailablePlaylists", "Gets an array of all available playlists", "array< string >", "", &VSquirrel::SHARED::GetAvailablePlaylists);
|
||||
#ifndef CLIENT_DLL
|
||||
Script_RegisterFunction(pSquirrelVM, "KickPlayerByName", "Script_KickPlayerByName", "Kicks a player from the server by name", "void", "string", &VSquirrel::SHARED::KickPlayerByName);
|
||||
Script_RegisterFunction(pSquirrelVM, "KickPlayerById", "Script_KickPlayerById", "Kicks a player from the server by handle or nucleus id", "void", "string", &VSquirrel::SHARED::KickPlayerById);
|
||||
|
||||
Script_RegisterFunction(pSquirrelVM, "BanPlayerByName", "Script_BanPlayerByName", "Bans a player from the server by name", "void", "string", &VSquirrel::SHARED::BanPlayerByName);
|
||||
Script_RegisterFunction(pSquirrelVM, "BanPlayerById", "Script_BanPlayerById", "Bans a player from the server by handle or nucleus id", "void", "string", &VSquirrel::SHARED::BanPlayerById);
|
||||
|
||||
Script_RegisterFunction(pSquirrelVM, "UnbanPlayer", "Script_UnbanPlayer", "Unbans a player from the server by nucleus id or ip address", "void", "string", &VSquirrel::SHARED::UnbanPlayer);
|
||||
#endif // !CLIENT_DLL
|
||||
Script_RegisterFunction(pSquirrelVM, "ShutdownHostGame", "Script_ShutdownHostGame", "Shuts down the local host game", "void", "", &VSquirrel::SHARED::ShutdownHostGame);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user