HITMANzz Posted April 10, 2010 Share Posted April 10, 2010 Hi friends I want know if there is some script for save and load the last team where the player has been. If there is a script, please tell me where i must write it thanks Link to comment
dzek (varez) Posted April 10, 2010 Share Posted April 10, 2010 never seen that .. just script that, its not hard one Link to comment
50p Posted April 10, 2010 Share Posted April 10, 2010 You can save team names in player's account data and load it when he logs back in. Here is a basic idea: addEventHandler( "onPlayerQuit", getRootElement(), function( ) local plrAcc = getPlayerAccount( source ); if not isGuestAccount( plrAcc ) then setAccountData( plrAcc, "teamname", getTeamName( getPlayerTeam( source ) ) ); end end ); addEventHandler( "onPlayerLogin", getRootElement( ), function( _, account ) local teamName = getAccountData( account, "teamname" ); if teamName then setPlayerTeam( source, getTeamFromName( teamName ) ); end end ); Keep in mind that you should do more checks, like if player is in team, if so, get the team's name, if not, don't do anything.. or when loading the data, you should also check if team exists (getTeamFromName would return false or nil if team didn't exist)... 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