Add new functions: GetServerVersion & GetProtocolVersion

pull/58/head
Koncord 8 years ago
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…
Cancel
Save