mirror of
https://github.com/TES3MP/TES3MP.git
synced 2025-09-27 06:55:54 -04:00
Add new functions: GetServerVersion & GetProtocolVersion
This commit is contained in:
parent
a34d46f57e
commit
babc3230b7
@ -9,6 +9,7 @@
|
||||
#include <apps/openmw-mp/Player.hpp>
|
||||
#include <apps/openmw-mp/Networking.hpp>
|
||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||
#include <components/openmw-mp/Version.hpp>
|
||||
|
||||
template<typename... Types>
|
||||
constexpr char TypeString<Types...>::value[];
|
||||
@ -119,3 +120,13 @@ void ScriptFunctions::Kick(unsigned short pid) noexcept
|
||||
GET_PLAYER(pid, player,);
|
||||
mwmp::Networking::GetPtr()->KickPlayer(player->guid);
|
||||
}
|
||||
|
||||
const char *ScriptFunctions::GetServerVersion() noexcept
|
||||
{
|
||||
return TES3MP_VERSION;
|
||||
}
|
||||
|
||||
const char *ScriptFunctions::GetProtocolVersion() noexcept
|
||||
{
|
||||
return to_string((int)TES3MP_PROTO_VERSION).c_str();
|
||||
}
|
@ -58,6 +58,8 @@ public:
|
||||
static bool IsTimerElapsed(int timerId) noexcept;
|
||||
|
||||
static void Kick(unsigned short pid) noexcept;
|
||||
static const char *GetServerVersion() noexcept;
|
||||
static const char *GetProtocolVersion() noexcept;
|
||||
|
||||
static constexpr ScriptFunctionData functions[]{
|
||||
{"CreateTimer", ScriptFunctions::CreateTimer},
|
||||
@ -77,6 +79,8 @@ public:
|
||||
// {"Cast", ScriptFunctions::Cast},
|
||||
{"SendMessage", ScriptFunctions::SendMessage},
|
||||
{"Kick", ScriptFunctions::Kick},
|
||||
{"GetServerVersion", ScriptFunctions::GetServerVersion},
|
||||
{"GetProtocolVersion", ScriptFunctions::GetProtocolVersion},
|
||||
|
||||
TRANSLOCATIONFUNCTIONS,
|
||||
STATSFUNCTIONS,
|
||||
|
Loading…
x
Reference in New Issue
Block a user