Jump to content

Help Needed - Get account name


maky55

Recommended Posts

Hello, scripting newb here! I'm trying to make a test script that output True or False depending if the user is on the specified account (2kjoe2k), here is the script:

 

function getPlayerAccountName(playerSource, commandName)
    
    local accname = getAccountName(getPlayerAccount(playerSource))
            
    if accname == "2kjoe2k" then
    
        outputChatBox("True")
    else
        outputChatBox("False")
    end
end
addCommandHandler("test", getPlayerAccountName)

It's probably because I'm a newb but I can't get it to work. It doesn't post anything to chat and I get no errors with debugscript 3.

Can anyone help?

Thanks.

Link to comment
4 minutes ago, pa3ck said:

Yea... the command "test" cannot be used in MTA, your code looks fine and will work as soon as you change the command to something else, like "myaccount".

Thank you, I can't believe I didn't think to change the name of the command!

 

 

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