[Server] Add GetCurrentMpNum() and SetCurrentMpNum() script functions

This commit is contained in:
David Cernat 2017-04-04 12:43:17 +03:00
parent 8b8c01f389
commit 2716078a30
2 changed files with 16 additions and 0 deletions

View file

@ -11,6 +11,16 @@ unsigned int MiscellaneousFunctions::GetLastPlayerId() noexcept
return Players::getLastPlayerId(); return Players::getLastPlayerId();
} }
int MiscellaneousFunctions::GetCurrentMpNum() noexcept
{
return mwmp::Networking::getPtr()->getCurrentMpNum();
}
void MiscellaneousFunctions::SetCurrentMpNum(int mpNum) noexcept
{
mwmp::Networking::getPtr()->setCurrentMpNum(mpNum);
}
void MiscellaneousFunctions::LogMessage(unsigned short level, const char *message) noexcept void MiscellaneousFunctions::LogMessage(unsigned short level, const char *message) noexcept
{ {
LOG_MESSAGE_SIMPLE(level, "[Script]: %s", message); LOG_MESSAGE_SIMPLE(level, "[Script]: %s", message);

View file

@ -6,6 +6,9 @@
#define MISCELLANEOUSAPI \ #define MISCELLANEOUSAPI \
{"GetLastPlayerId", MiscellaneousFunctions::GetLastPlayerId},\ {"GetLastPlayerId", MiscellaneousFunctions::GetLastPlayerId},\
\ \
{"GetCurrentMpNum", MiscellaneousFunctions::GetCurrentMpNum},\
{"SetCurrentMpNum", MiscellaneousFunctions::SetCurrentMpNum},\
|
{"LogMessage", MiscellaneousFunctions::LogMessage},\ {"LogMessage", MiscellaneousFunctions::LogMessage},\
{"LogAppend", MiscellaneousFunctions::LogAppend} {"LogAppend", MiscellaneousFunctions::LogAppend}
@ -14,6 +17,9 @@ class MiscellaneousFunctions
public: public:
static unsigned int GetLastPlayerId() noexcept; static unsigned int GetLastPlayerId() noexcept;
static int GetCurrentMpNum() noexcept;
static void SetCurrentMpNum(int mpNum) noexcept;
static void LogMessage(unsigned short level, const char *message) noexcept; static void LogMessage(unsigned short level, const char *message) noexcept;
static void LogAppend(unsigned short level, const char *message) noexcept; static void LogAppend(unsigned short level, const char *message) noexcept;
}; };