Hello, I would like to know if there is a way to save a skin, after the player leaves and when it enters the login page, the skin it was going to "createPed".
Example:
-- Server side
function onPlayerQuitSaveSkin()
local playeraccount = getPlayerAccount(source)
if playeraccount and not isGuestAccount(playeraccount) then
local playerSkin = getElementModel(source)
if playerSkin then
setAccountData(playeraccount, "player.skin", playerSkin)
end
end
end
addEventHandler("onPlayerQuit", getRootElement(), onPlayerQuitSaveSkin )
-- Client-side
function onPlayerClientLoadSkin()
local accountName = getPlayerName(getLocalPlayer())
local playeraccount = getPlayerAccount(accountName)
if (playeraccount) then
local playerSkin = tonumber(getAccountData(playeraccount, "player-skin"))
if (playerSkin) then
createPed(playerSkin,-1600.9000244141,-1620.6999511719,36.599998474121,241.908905,0,0)
else
createPed(0,-1600.9000244141,-1620.6999511719,36.599998474121,241.908905,0,0)
end
end
end
Except that the player is still not going to log in, I just want to appear the skin he was in the game on the screen.