Luke_Ferrara Posted November 20, 2009 Share Posted November 20, 2009 function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then local playerskin = getElementModel ( source ) setAccountData ( playeraccount, "skin", playerskin ) end end function onPlayerLogin ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then local playerskin = getAccountData ( playeraccount, "skin" ) if ( playerskin ) then setPedSkin ( source, playerskin ) end end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin ) This should work but I have no idea why it is not, I got this code from another post however that was to save money so I figured if i changed what the code looks for and saves it will save the players skin however it doesn't, it sets the skin to 0 and doesn't update when it is changed Link to comment
50p Posted November 20, 2009 Share Posted November 20, 2009 Before you get/setAccountData, you should check if player's account isGuestAccount. Link to comment
Luke_Ferrara Posted November 21, 2009 Author Share Posted November 21, 2009 function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if isGuestAccount ( playeraccount ) then outputConsole ( "For full features you must register!", playerSource ) else local playerskin = getElementModel ( source ) setAccountData ( playeraccount, "skin", playerskin ) end end function onPlayerLogin ( ) local playeraccount = getPlayerAccount ( source ) if isGuestAccount ( playeraccount ) then outputConsole ("Register", playersource) else local playerskin = getAccountData ( playeraccount, "skin" ) setPedSkin ( source, playerskin ) end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin ) okay now it saves the skin but doesn't call it when player logs in, I have it check for guest account idk whats going wronge Link to comment
50p Posted November 21, 2009 Share Posted November 21, 2009 onPlayerLogin passes 2 account arguments to your function. You can use them instead of getPlayerAccount. account thePreviousAccount, account theCurrentAccount, bool autoLogin theCurrentAccount will be the account player logged into. You can then use getAccountData( currentAccount, "skin" ). And please learn to debug scripts. Debugging scripts will help you so much that you won't even have to ask questions here. Link to comment
Luke_Ferrara Posted November 21, 2009 Author Share Posted November 21, 2009 okay thanks 50 Ill start trying to debug 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