Skip to content

Commit 77bad07

Browse files
Synchronize changes from 1.6 master branch [ci skip]
078d46b Add event onAccountNameChange (PR #4270, Fixes #4246)
2 parents cd00375 + 078d46b commit 77bad07

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Server/mods/deathmatch/logic/CGame.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1700,7 +1700,7 @@ void CGame::AddBuiltInEvents()
17001700

17011701
// Account events
17021702
m_Events.AddEvent("onAccountDataChange", "account, key, value", NULL, false);
1703-
1703+
m_Events.AddEvent("onAccountNameChange", "account, previousName, newName", nullptr, false);
17041704
m_Events.AddEvent("onAccountCreate", "account", NULL, false);
17051705
m_Events.AddEvent("onAccountRemove", "account", NULL, false);
17061706

Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11697,7 +11697,15 @@ bool CStaticFunctionDefinitions::SetAccountName(CAccount* pAccount, SString strN
1169711697
}
1169811698
else
1169911699
{
11700+
CLuaArguments arguments;
11701+
arguments.PushAccount(pAccount);
11702+
arguments.PushString(pAccount->GetName().c_str());
11703+
arguments.PushString(strNewName);
11704+
if (!m_pMapManager->GetRootElement()->CallEvent("onAccountNameChange", arguments))
11705+
return false;
11706+
1170011707
pAccount->SetName(strNewName);
11708+
1170111709
return true;
1170211710
}
1170311711
}

0 commit comments

Comments
 (0)