<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=M</id>
	<title>Multi Theft Auto: Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=M"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/M"/>
	<updated>2026-05-15T11:52:19Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnPlayerChangeNick&amp;diff=41679</id>
		<title>OnPlayerChangeNick</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnPlayerChangeNick&amp;diff=41679"/>
		<updated>2014-08-29T22:35:45Z</updated>

		<summary type="html">&lt;p&gt;M: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server event}}&lt;br /&gt;
__NOTOC__ &lt;br /&gt;
This event is triggered when a player changes his nickname.&lt;br /&gt;
&lt;br /&gt;
Because of bug [https://bugs.mtasa.com/view.php?id=7362] the nick change might've been canceled by admin, but you still receive this event.&lt;br /&gt;
&lt;br /&gt;
==Parameters== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string oldNick, string newNick&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*'''oldNick:''' the nickname the player had before.&lt;br /&gt;
*'''newNick:''' the new nickname of the player.&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The source of this event is the player that changed his nick&lt;br /&gt;
&lt;br /&gt;
==Cancel effect==&lt;br /&gt;
Cancelling this event depends on how it is called, if it is called by the scripting event then it is NOT cancelable. If it is called from the /nick command it IS cancelable. If this event is cancelled and can be cancelled then the name will not change.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function nickChangeHandler(oldNick, newNick)&lt;br /&gt;
    -- check if there's account with newNick as username&lt;br /&gt;
    if getAccount(newNick) then&lt;br /&gt;
        outputChatBox(&amp;quot;Sorry, there already exists an account with your new nickname as username.&amp;quot;, source, 0, 255, 0)&lt;br /&gt;
        outputChatBox(&amp;quot;Please choose another one.&amp;quot;, source, 0, 255, 0)&lt;br /&gt;
        -- cancel the event to prevent the nick from being changed&lt;br /&gt;
        cancelEvent()&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
-- add an event handler&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerChangeNick&amp;quot;, getRootElement(), nickChangeHandler)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example displays a message to everyone every time player changed his nick&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function nickChangeHandler(oldNick, newNick)&lt;br /&gt;
outputChatBox(oldNick..&amp;quot; is now known as &amp;quot;..newNick, getRootElement(), 255, 100, 100) -- display the message&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerChangeNick&amp;quot;, getRootElement(), nickChangeHandler) -- add an event handler&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{See also/Server event|Player events}}&lt;/div&gt;</summary>
		<author><name>M</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnPlayerChangeNick&amp;diff=41678</id>
		<title>OnPlayerChangeNick</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnPlayerChangeNick&amp;diff=41678"/>
		<updated>2014-08-29T22:35:32Z</updated>

		<summary type="html">&lt;p&gt;M: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server event}}&lt;br /&gt;
__NOTOC__ &lt;br /&gt;
This event is triggered when a player changes his nickname.&lt;br /&gt;
Because of bug [https://bugs.mtasa.com/view.php?id=7362] the nick change might've been canceled by admin, but you still receive this event.&lt;br /&gt;
&lt;br /&gt;
==Parameters== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string oldNick, string newNick&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*'''oldNick:''' the nickname the player had before.&lt;br /&gt;
*'''newNick:''' the new nickname of the player.&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The source of this event is the player that changed his nick&lt;br /&gt;
&lt;br /&gt;
==Cancel effect==&lt;br /&gt;
Cancelling this event depends on how it is called, if it is called by the scripting event then it is NOT cancelable. If it is called from the /nick command it IS cancelable. If this event is cancelled and can be cancelled then the name will not change.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function nickChangeHandler(oldNick, newNick)&lt;br /&gt;
    -- check if there's account with newNick as username&lt;br /&gt;
    if getAccount(newNick) then&lt;br /&gt;
        outputChatBox(&amp;quot;Sorry, there already exists an account with your new nickname as username.&amp;quot;, source, 0, 255, 0)&lt;br /&gt;
        outputChatBox(&amp;quot;Please choose another one.&amp;quot;, source, 0, 255, 0)&lt;br /&gt;
        -- cancel the event to prevent the nick from being changed&lt;br /&gt;
        cancelEvent()&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
-- add an event handler&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerChangeNick&amp;quot;, getRootElement(), nickChangeHandler)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example displays a message to everyone every time player changed his nick&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function nickChangeHandler(oldNick, newNick)&lt;br /&gt;
outputChatBox(oldNick..&amp;quot; is now known as &amp;quot;..newNick, getRootElement(), 255, 100, 100) -- display the message&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerChangeNick&amp;quot;, getRootElement(), nickChangeHandler) -- add an event handler&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{See also/Server event|Player events}}&lt;/div&gt;</summary>
		<author><name>M</name></author>
	</entry>
</feed>