Jump to content

help saving skins???


Luke_Ferrara

Recommended Posts

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
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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...