Jump to content

Help me Save team


Akranes123

Recommended Posts

hi, I need help

I want it when someone registers and logs into your account when logging into your account automatically passes it to a team such as Team * Civil * I want it when I register and log in to the team * Civil * Automatically .....
Please if you would be so kind to help me with a script like this or give me an idea

Link to comment

Try this (not tested)

function onQuit()
  local Team = getPlayerTeam(source) 
  local account = getPlayerAccount(source)
  if (Team) and (not isGuessAccount(account)) then
    setAccountData(account, "myTeam", getTeamName(Team))
  end
end
addEventHandler("onPlayerQuit", root, onQuit)
addEventHandler("onPlayerLogout", root, onQuit)

function onLogin()
  local account = getPlayerAccount( source )
  local theTeam = getAccountData(account, "myTeam")
  if (theTeam) and (getTeamFromName(theTeam)) then
    setAccountData(account, "myTeam", getTeamFromName(theTeam))
  end
end
addEventHandler("onPlayerLogin", root, onLogin)

 

Edited by Anzo
Link to comment
40 minutes ago, Anzo said:

Try this (not tested)


function onQuit()
  local Team = getPlayerTeam(source) 
  local account = getPlayerAccount(source)
  if (Team) and (not isGuessAccount(account)) then
    setAccountData(account, "myTeam", getTeamName(Team))
  end
end
addEventHandler("onPlayerQuit", root, onQuit)
addEventHandler("onPlayerLogout", root, onQuit)

function onLogin()
  local account = getPlayerAccount( source )
  local theTeam = getAccountData(account, "myTeam")
  if (theTeam) and (getTeamFromName(theTeam)) then
    setAccountData(account, "myTeam", getTeamFromName(theTeam))
  end
end
addEventHandler("onPlayerLogin", root, onLogin)

 

This is not going to work since you are not setting the player team also isGuessAccount you have an extra 's' should be 't' .

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