diff --git a/apps/openmw-mp/Script/ScriptFunctions.cpp b/apps/openmw-mp/Script/ScriptFunctions.cpp index 771fbd3a3..f0658aace 100644 --- a/apps/openmw-mp/Script/ScriptFunctions.cpp +++ b/apps/openmw-mp/Script/ScriptFunctions.cpp @@ -10,6 +10,7 @@ #include #include #include +#include "MasterClient.hpp" template constexpr char TypeString::value[]; @@ -138,3 +139,13 @@ int ScriptFunctions::GetAvgPing(unsigned short pid) noexcept GET_PLAYER(pid, player,-1); return mwmp::Networking::get().getAvgPing(player->guid); } + +void ScriptFunctions::SetModname(const char *name) noexcept +{ + mwmp::Networking::getPtr()->getMasterClient()->SetModname(name); +} + +void ScriptFunctions::SetHostname(const char *name) noexcept +{ + mwmp::Networking::getPtr()->getMasterClient()->SetHostname(name); +} diff --git a/apps/openmw-mp/Script/ScriptFunctions.hpp b/apps/openmw-mp/Script/ScriptFunctions.hpp index a3f5fac9e..f1cc5f407 100644 --- a/apps/openmw-mp/Script/ScriptFunctions.hpp +++ b/apps/openmw-mp/Script/ScriptFunctions.hpp @@ -62,6 +62,8 @@ public: static const char *GetServerVersion() noexcept; static const char *GetProtocolVersion() noexcept; static int GetAvgPing(unsigned short pid) noexcept; + static void SetModname(const char* name) noexcept; + static void SetHostname(const char* name) noexcept; static constexpr ScriptFunctionData functions[]{ {"CreateTimer", ScriptFunctions::CreateTimer}, @@ -82,6 +84,8 @@ public: {"GetServerVersion", ScriptFunctions::GetServerVersion}, {"GetProtocolVersion", ScriptFunctions::GetProtocolVersion}, {"GetAvgPing", ScriptFunctions::GetAvgPing}, + {"SetModname", ScriptFunctions::SetModname}, + {"SetHostname", ScriptFunctions::SetHostname}, TRANSLOCATIONFUNCTIONS, STATSFUNCTIONS,