OnClientPlayerChangeNick: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
Line 15: Line 15:


==Example==  
==Example==  
This disallows changing a nick
This disallows changing a nick.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addEventHandler( "onClientPlayerChangeNick", getRootElement(),
addEventHandler("onClientPlayerChangeNick", getRootElement(),
function()
  function(oldNick, newNick)
  cancelEvent()
    cancelEvent()
  outputChatBox( "You can't change your nick!", source, 255, 0, 0, false )
    outputChatBox("You can't change your nick!", 255, 0, 0)
end)
  end
)
</syntaxhighlight>
</syntaxhighlight>



Revision as of 14:21, 10 January 2010

This event is triggered when a player changes his nickname.

Parameters

string oldNick, string newNick
  • oldNick: the nickname the player had before.
  • newNick: the new nickname of the player.

Source

The source of this event is the player that changed his nick

Example

This disallows changing a nick.

addEventHandler("onClientPlayerChangeNick", getRootElement(),
  function(oldNick, newNick)
    cancelEvent()
    outputChatBox("You can't change your nick!", 255, 0, 0)
  end
)

See Also

Client player events


Client event functions