Jump to content

Get Player account name from player


GhostXoP

Recommended Posts

How can the server get the users account name from the players Player element

I tried

Client

triggerServerEvent("Test",  getRootResource(), getPlayerName(getLocalPlayer())) 

Server

function Test(PlayerName) -- The event handler is defined, but just to skip to it. 
getAccountName(getAccount(PlayerName)) 
end 

I dont want the players name, i want the account name the player logged in with.

Link to comment
Guest Guest4401
triggerServerEvent('Test',localPlayer) 

addEvent('Test',true) 
addEventHandler('Test',root, 
    function() 
        local account = getPlayerAccount(source) -- get account element from player element 
        local accname = getAccountName(account) -- get account name from account element 
        outputChatBox(accname) -- show the account name 
    end 
) 

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...