diff --git a/Server/mods/deathmatch/logic/CGame.cpp b/Server/mods/deathmatch/logic/CGame.cpp index 16e7b7312b..9f0de608a3 100644 --- a/Server/mods/deathmatch/logic/CGame.cpp +++ b/Server/mods/deathmatch/logic/CGame.cpp @@ -1697,7 +1697,7 @@ void CGame::AddBuiltInEvents() // Account events m_Events.AddEvent("onAccountDataChange", "account, key, value", NULL, false); - + m_Events.AddEvent("onAccountNameChange", "account, previousName, newName", nullptr, false); m_Events.AddEvent("onAccountCreate", "account", NULL, false); m_Events.AddEvent("onAccountRemove", "account", NULL, false); diff --git a/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp b/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp index f8bfad986a..9cba7900bd 100644 --- a/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp +++ b/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp @@ -11674,7 +11674,15 @@ bool CStaticFunctionDefinitions::SetAccountName(CAccount* pAccount, SString strN } else { + CLuaArguments arguments; + arguments.PushAccount(pAccount); + arguments.PushString(pAccount->GetName().c_str()); + arguments.PushString(strNewName); + if (!m_pMapManager->GetRootElement()->CallEvent("onAccountNameChange", arguments)) + return false; + pAccount->SetName(strNewName); + return true; } }