Jump to content

Save clothes problem


boro

Recommended Posts

Hi all i try make Cj clothes saver but it still don't work what is bad ? please help, console is clear..

----server side

--load

function load(player) 
local textures = {} 
local models = {} 
textures = {} 
models = {} 
local account = getPlayerAccount(player) 
local textureLoad = getAccountData(account, "settexture") 
local modelLoad = getAccountData(account, "setmodel") 
local textures = split(textureLoad, 44) 
local models = split(modelLoad, 44) 
setElementModel(player,0) 
for i=0, 17, 1 do 
if ( textures[i+1] ~= " " ) then 
addPedClothes(player, textures[i+1], models[i+1], i) 
end 
end 
textures = {} 
models = {} 
end 
addCommandHandler("load", load) 
  
  
--save 
function save(player) 
local account = getPlayerAccount(player) 
local texture = {} 
local model = {} 
texture = {} 
model = {} 
for i=0, 17, 1 do 
local clothesTexture, clothesModel = getPedClothes(player, i) 
if ( clothesTexture ~= false ) then 
table.insert(texture, clothesTexture) 
table.insert(model, clothesModel) 
else 
table.insert(texture, " ") 
table.insert(model, " ") 
local setTextures = table.concat(texture, ",") 
local setModels = table.concat(model, ",") 
setAccountData(account, "setexture", setTextures) 
setAccountData(account, "setmodel", setModels) 
end 
end 
texture = {} 
model = {} 
end 
addCommandHandler("save", save) 

Link to comment
function load(player) 
    local textures = {} 
    local models = {} 
    local account = getPlayerAccount(player) 
    local textureLoad = getAccountData(account, "setexture") 
    local modelLoad = getAccountData(account, "setmodel") 
    local textures = split(textureLoad, 44) 
    local models = split(modelLoad, 44) 
    setElementModel(player,0) 
    for i=0, 17 do 
        if ( textures[i+1] ~= " " ) then 
            addPedClothes(player, textures[i+1], models[i+1], i) 
        end 
    end 
    textures = {} 
    models = {} 
end 
addCommandHandler("load", load) 
  
  
--save 
function save(player) 
    local account = getPlayerAccount(player) 
    local texture = {} 
    local model = {} 
    for i=0, 17 do 
        local clothesTexture, clothesModel = getPedClothes(player, i) 
        if ( clothesTexture ~= false ) then 
            table.insert(texture, clothesTexture) 
            table.insert(model, clothesModel) 
        else 
            table.insert(texture, " ") 
            table.insert(model, " ") 
        end 
    end 
    local setTextures = table.concat(texture, ",") 
    local setModels = table.concat(model, ",") 
    setAccountData(account, "setexture", setTextures) 
    setAccountData(account, "setmodel", setModels) 
    texture = {} 
    model = {} 
end 
addCommandHandler("save", save) 

Link to comment
hmm it still don't work when i set clothes on cj skin and give command /save and then give command /load

so it set classic cj skin and remove clothes, what ?

I can't understand why always people say the code doesn't work, while i myself TESTED THE CODE AND IT WORK WITHOUT ANY PROBLEM.

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