yMassai Posted July 28, 2012 Share Posted July 28, 2012 pizzao = setElementData( source, "Occupation", "Entregador de Pizza", true ) function pQuit ( ) setAccountData(source,"job",pizzao) end addEventHandler ( "onPlayerQuit", root, pQuit ) function onPlayerLogin ( ) getAccountData ( pizzao, "job" ) setElementData (source, pizzao) end addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin ) why dont work? Link to comment
TAPL Posted July 28, 2012 Share Posted July 28, 2012 Your code is mess Explain what you want to do, and please show your full code. Link to comment
yMassai Posted July 28, 2012 Author Share Posted July 28, 2012 just save the occupation. when the player leaves the game saves and restores when entering on game the occupation given. Link to comment
TAPL Posted July 28, 2012 Share Posted July 28, 2012 Not sure if this what you want. function pQuit() local account = getPlayerAccount(source) if (account) and not isGuestAccount(account) then setAccountData(account,"job",getElementData(source, "Occupation")) end end addEventHandler("onPlayerQuit", root, pQuit) function onPlayerLogin(_,acc) setElementData(source, "Occupation",getAccountData(acc, "job")) end addEventHandler("onPlayerLogin", root, onPlayerLogin) Link to comment
Guest Guest4401 Posted July 28, 2012 Share Posted July 28, 2012 addEventHandler("onPlayerQuit",root, function() local account = getPlayerAccount(source) if not isGuestAccount(account) then setAccountData(account,"job",getElementData(source,"Occupation")) end end ) addEventHandler("onPlayerLogin",root, function(old,new) setElementData(source,"job",getAccountData(new,"job")) end ) Link to comment
albers14 Posted July 28, 2012 Share Posted July 28, 2012 No, it will not work if you job dont set the data of occupation. You sure that one is setted? 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