HITMANzz Posted April 10, 2010 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
dzek (varez) Posted April 10, 2010 Posted April 10, 2010 never seen that .. just script that, its not hard one Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online! programista php rzeszów Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting. Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!
50p Posted April 10, 2010 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)... - MTA Script Editor - Ask your scripting questions properly, please. - 50p's public resources - Meta.xml - what is it for? How is it possible LOL
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