Jump to content

changenick to PlayerAccount


monamour

Recommended Posts

hello everyone,

am trying to make script which change playernick to his accountname after he login ( making player having same nick as his account name if he log in)

iv'e tried this but it did not worked: 

addEventHandler ( 'onPlayerLogin', getRootElement ( ),
    function (, changnick )
    localgetPlayerAccount(theCurrentAccount)
then
    setPlayerName ( sPlayerElement, thecurrentaccount )

 

i know there are many mistakes in this script but am just new and i hope to learn

please help me to fix it

Edited by monamour
Link to comment
  • Moderators
addEventHandler ( "onPlayerLogin", root,
function (_, theCurrentAccount )
	setPlayerName ( source, getAccountName(theCurrentAccount) )
end)

 


https://wiki.multitheftauto.com/wiki/GetAccountName

 
  1. string getAccountName ( account theAccount )

 

 


https://wiki.multitheftauto.com/wiki/OnPlayerLogin

Parameters

 
  1.  
  • thePreviousAccount: The account the player was logged into before
  • theCurrentAccount: The account the player logged into just now

 

Source

The source of this event is the player element that just logged in.

Edited by IIYAMA
  • Like 1
Link to comment
12 minutes ago, IIYAMA said:

Show me the lua file and the meta.xml file.

 

meta.xml:

<meta>
    <info name="changenick" author="Gamesnert" type="script" version="0.9.0" description="This resource change nick to account when player login"/>
    
    <script src="changenick_s.lua" type="server"/>
</meta>

 

Lua:

addEventHandler ( "onPlayerLogin", root,

function (_, theCurrentAccount )

setPlayerName ( source, getAccountName(theCurrentAccount) )

end)

Edit : am sorry but it works now , ive forgot to upgrade the Resource 

Thank you very much to help me with this script , i really appreciate it 

i will upload it to community and give you credit for it if you dont mind

Edited by monamour
  • Like 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...