Jump to content

account data: team


DakiLLa

Recommended Posts

hi. I have saved team name in player account data. And when i want to set player to this team, player switching to the nil value team. How to make that player will be switch to the saved team, not nil value?

strings in accounts.xml

<account name="PlayerOne" password="..." ip="..."> 
      <data team="Cops"/> 
</account> 

script.lua

function try (thePlayer, commandName) 
    local account = getClientAccount ( thePlayer ) 
    local guest = isGuestAccount ( account ) 
    if ( guest ) then 
        outputDebugString ( "Failed to load account data! Guest account" ) 
    else 
        local checkedTeam = getAccountData ( account, "team" ) 
        if ( checkedTeam ) then 
            setPlayerTeam ( thePlayer, checkedTeam ) 
            outputDebugString ( "Setting player team to the saved team." ) 
        else 
            outputDebugString ( "Failed to load team!" ) 
        end 
    end 
end 
addCommandHandler ( "team", try ) 

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