diff --git a/core/PlayerManager.cpp b/core/PlayerManager.cpp index 651554da..040944a0 100644 --- a/core/PlayerManager.cpp +++ b/core/PlayerManager.cpp @@ -1777,6 +1777,11 @@ unsigned int CPlayer::GetLanguageId() return m_LangId; } +void CPlayer::SetLanguageId(unsigned int id) +{ + m_LangId = id; +} + int CPlayer::GetUserId() { if (m_UserId == -1) diff --git a/core/PlayerManager.h b/core/PlayerManager.h index 452cf559..ce31287c 100644 --- a/core/PlayerManager.h +++ b/core/PlayerManager.h @@ -82,6 +82,7 @@ public: bool IsInKickQueue(); IPlayerInfo *GetPlayerInfo(); unsigned int GetLanguageId(); + void SetLanguageId(unsigned int id); int GetUserId(); bool RunAdminCacheChecks(); void NotifyPostAdminChecks(); diff --git a/core/logic/smn_lang.cpp b/core/logic/smn_lang.cpp index 62d150dc..3d309893 100644 --- a/core/logic/smn_lang.cpp +++ b/core/logic/smn_lang.cpp @@ -106,14 +106,14 @@ static cell_t sm_GetLanguageInfo(IPluginContext *pContext, const cell_t *params) static cell_t sm_SetClientLanguage(IPluginContext *pContext, const cell_t *params) { - CPlayer *player = g_Players.GetPlayerByIndex(params[1]); + IGamePlayer *player = playerhelpers->GetGamePlayer(params[1]); if (!player || !player->IsInGame()) { return pContext->ThrowNativeError("Invalid client index %d", params[1]); } - player->m_LangId = params[2]; + player->SetLanguageId(params[2]); return 1; } diff --git a/public/IPlayerHelpers.h b/public/IPlayerHelpers.h index 74ad45ff..54855899 100644 --- a/public/IPlayerHelpers.h +++ b/public/IPlayerHelpers.h @@ -41,7 +41,7 @@ #include #define SMINTERFACE_PLAYERMANAGER_NAME "IPlayerManager" -#define SMINTERFACE_PLAYERMANAGER_VERSION 13 +#define SMINTERFACE_PLAYERMANAGER_VERSION 14 struct edict_t; class IPlayerInfo; @@ -220,6 +220,8 @@ namespace SourceMod * to actually add them to the queue. */ virtual void MarkAsBeingKicked() =0; + + virtual void SetLanguageId(unsigned int id) =0; }; /**