I found a code on MTA wiki basicly for storing money I remade it to store skins this is my first script I do atend a computer school so by the code it looks pretty logical if you got any fixes bugs you see please lmk.
function onPlayerQuit ( )
local playeraccount = getPlayerAccount ( Acc )
if ( playeraccount ) and not isGuestAccount ( playeraccount ) then
local playerskin = getElementModel ( Skin )
setAccountData ( playeraccount, "player.skin", playerskin )
end
end
function onPlayerLogin (_, playeraccount )
if ( playeraccount ) then
local playerskin = getAccountData ( playeraccount, "player.skin" )
if ( playerskin ) then
setElementModel ( Acc, Skin )
end
end
end
addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit )
addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin )