boro Posted December 1, 2013 Posted December 1, 2013 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)
TAPL Posted December 1, 2013 Posted December 1, 2013 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)
boro Posted December 3, 2013 Author Posted December 3, 2013 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 ?
TAPL Posted December 3, 2013 Posted December 3, 2013 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.
bandi94 Posted December 3, 2013 Posted December 3, 2013 "setAccountData" has a limit of (i am not shure) but it's somewhere around 100 char's. So maybe @TAPL tryed with one clothe , but when you add more clothes the save will fail bk the larger char count.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now