Chaz-CR Posted March 20, 2014 Share Posted March 20, 2014 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
DNL291 Posted March 20, 2014 Share Posted March 20, 2014 When you remove a player from the team, use setAccountData and remove the old player team from his account. Link to comment
Chaz-CR Posted March 22, 2014 Author Share Posted March 22, 2014 I didn't understand. Link to comment
Reggae Posted March 22, 2014 Share Posted March 22, 2014 Use in your script: setPlayerTeam ( source, nil ) removing it for the team, and after use SetAccountData to save. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now