<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/wiki/OnAccountNameChange?action=history&amp;feed=atom</id>
	<title>OnAccountNameChange - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/wiki/OnAccountNameChange?action=history&amp;feed=atom"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnAccountNameChange&amp;action=history"/>
	<updated>2026-10-09T12:34:41Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.1</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnAccountNameChange&amp;diff=82917&amp;oldid=prev</id>
		<title>Arran Fortuna: Created page with &quot;__NOTOC__ {{Server event}} {{New items|3.0170|1.7.0| This event is triggered before an account name is changed using setAccountName. |25351}}  ==Parameters== &lt;syntaxhighlight lang=&quot;lua&quot;&gt; account theAccount, string previousName, string newName &lt;/syntaxhighlight&gt; *&#039;&#039;&#039;theAccount:&#039;&#039;&#039; The account being renamed. *&#039;&#039;&#039;previousName:&#039;&#039;&#039; The account&#039;s current name. *&#039;&#039;&#039;newName:&#039;&#039;&#039; The proposed new account name.  ==Source== The source of thi...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnAccountNameChange&amp;diff=82917&amp;oldid=prev"/>
		<updated>2026-10-06T13:15:03Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;__NOTOC__ {{Server event}} {{New items|3.0170|1.7.0| This event is triggered before an &lt;a href=&quot;/wiki/Account&quot; title=&quot;Account&quot;&gt;account&lt;/a&gt; name is changed using &lt;a href=&quot;/wiki/SetAccountName&quot; title=&quot;SetAccountName&quot;&gt;setAccountName&lt;/a&gt;. |25351}}  ==Parameters== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; account theAccount, string previousName, string newName &amp;lt;/syntaxhighlight&amp;gt; *&amp;#039;&amp;#039;&amp;#039;theAccount:&amp;#039;&amp;#039;&amp;#039; The &lt;a href=&quot;/wiki/Account&quot; title=&quot;Account&quot;&gt;account&lt;/a&gt; being renamed. *&amp;#039;&amp;#039;&amp;#039;previousName:&amp;#039;&amp;#039;&amp;#039; The account&amp;#039;s current name. *&amp;#039;&amp;#039;&amp;#039;newName:&amp;#039;&amp;#039;&amp;#039; The proposed new account name.  ==Source== The &lt;a href=&quot;/wiki/Event_system#Event_source&quot; title=&quot;Event system&quot;&gt;source&lt;/a&gt; of thi...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server event}}&lt;br /&gt;
{{New items|3.0170|1.7.0|&lt;br /&gt;
This event is triggered before an [[account]] name is changed using [[setAccountName]].&lt;br /&gt;
|25351}}&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
account theAccount, string previousName, string newName&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;theAccount:&amp;#039;&amp;#039;&amp;#039; The [[account]] being renamed.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;previousName:&amp;#039;&amp;#039;&amp;#039; The account&amp;#039;s current name.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;newName:&amp;#039;&amp;#039;&amp;#039; The proposed new account name.&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the [[root]] element.&lt;br /&gt;
&lt;br /&gt;
==Canceling==&lt;br /&gt;
If this event is [[Event system#Canceling|canceled]], the account name will not change and [[setAccountName]] will return false.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example prevents accounts from being renamed to names starting with &amp;quot;admin&amp;quot;, regardless of capitalization.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onAccountNameChange&amp;quot;, root, function(theAccount, previousName, newName)&lt;br /&gt;
    if newName:lower():sub(1, 5) == &amp;quot;admin&amp;quot; then&lt;br /&gt;
        cancelEvent()&lt;br /&gt;
        outputServerLog(&amp;quot;Blocked account rename from &amp;quot; .. previousName .. &amp;quot; to &amp;quot; .. newName)&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Note==&lt;br /&gt;
The event runs before the name is changed, so [[getAccountName]] still returns the previous name inside the handler.&lt;br /&gt;
&lt;br /&gt;
{{See also/Server event|Server events}}&lt;/div&gt;</summary>
		<author><name>Arran Fortuna</name></author>
	</entry>
</feed>