Jump to content

A little help of a save system!


Chaz-CR

Recommended Posts

Hello guys, i was trying to make a save system of the teams, and it works BUT when i remove a player of a team and he leaves from the server, when he login again he's still in the team i removed before he quit. Any help?

function setTeam() 
local account = getPlayerAccount(source) 
local team = getAccountData (account, "team")  
if (team) and getTeamFromName(team) then 
      setPlayerTeam(source, getTeamFromName(team)) 
     end 
end 
addEventHandler("onPlayerLogin",root,setTeam)  
  
function save() 
 local team = getPlayerTeam(source) 
local account = getPlayerAccount(source) 
if (team) and not isGuestAccount(account) then  
setAccountData(account, "team", getTeamName(team)) 
 end 
    end 
addEventHandler("onPlayerQuit", getRootElement(), save) 

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