Jump to content

Player Clothes Save


Hypnos

Recommended Posts

Posted

This is clothes saver. 31,32 is Warnig , 35 is Error.

vE3pkv.png

function saveClothes() 
local account = getPlayerAccount(source) 
if ( not isGuestAccount(account) ) and ( getElementModel(source) == 0 ) then 
local texture = {} 
local model = {} 
for i=0, 17, 1 do 
local clothesTexture, clothesModel = getPedClothes(source, i) 
if ( clothesTexture ~= false ) then 
table.insert(texture, clothesTexture) 
table.insert(model, clothesModel) 
else 
table.insert(texture, " ") 
table.insert(model, " ") 
end 
end 
local allTextures = table.concat(texture, ",") 
local allModels = table.concat(model, ",") 
setAccountData(account, "Clothessaver:Texture", allTextures) 
setAccountData(account, "Clothessaver:Model", allModels) 
texture = {} 
model = {} 
end 
end 
addEventHandler("onPlayerQuit", getRootElement(), saveClothes) 
  
function setClothes() 
local account = getPlayerAccount(source) 
if ( not isGuestAccount(account) ) then 
local textureString = getAccountData(account, "Clothessaver:Texture") 
local modelString = getAccountData(account, "Clothessaver:Model") 
local textures = split(textureString, 44) 
local models = split(modelString, 44) 
setElementModel(source,0) 
for i=0, 17, 1 do 
if ( textures[i+1] ~= " " ) then 
addPedClothes(source, textures[i+1], models[i+1], i) 
end 
end 
textures = {} 
models = {} 
end 
end 
addEventHandler("onPlayerLogin", getRootElement(), setClothes) 

Help me :arrowleft:

My ingame nick is: Hypnos

Posted

Replace it with:

local textureString = getAccountData(account, "Clothessaver:Texture") or "" 
local modelString = getAccountData(account, "Clothessaver:Model") or "" 

At line 29 and 30.

Please do not PM me with scripting related question nor support, use the forums instead.

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