TorNix~|nR 21 Posted February 9 Share Posted February 9 Hello guys I'm using my friend @WASSIm.'s script of saving It saves everything except ped clothes, and it have debug problems if (clothes) then for _, cloth in pairs(fromJSON(clothes)) do local type, texture, model = unpack(cloth) addPedClothes(source, type, texture, model) end end function getAllPedClothes(thePed) local clothes = { } for type=0, 17 do local texture, model = getPedClothes(thePed, type) if (texture) and (model) then table.insert(clothes, {type, texture, model}) end end return clothes end fromJSON Expected string at argument 1 got boolean and Expected number, got non-convertible string. This warning may be an error in future versions any help please? Link to post
TorNix~|nR 21 Posted February 9 Author Share Posted February 9 Resource: https://community.multitheftauto.com/index.php?p=resources&s=details&id=10588 Link to post
WASSIm. 13 Posted February 11 Share Posted February 11 (edited) if (clothes) then for _, cloth in pairs(fromJSON(clothes)) do local texture, model, type = unpack(cloth) addPedClothes(source, texture, model, type) end end function getAllPedClothes(thePed) local clothes = { } for type=0, 17 do local texture, model = getPedClothes(thePed, type) if (texture) and (model) then table.insert(clothes, {texture, model, type}) end end return clothes end Try this Edited February 11 by WASSIm. 1 Link to post
TorNix~|nR 21 Posted February 11 Author Share Posted February 11 It's working, but a little problem when you change your clothes and change another skin and you reconnect, the clothes are gone, any fix please? Link to post
WASSIm. 13 Posted February 11 Share Posted February 11 addEventHandler("onElementModelChange", root, function (oldSkin, skin) if not (getElementType(source) == "player") then return end local account = getPlayerAccount(source) if (account) and not (isGuestAccount(account)) then if (oldSkin == 0) then local clothes = getAllPedClothes(source) setAccountData(account, "clothes", toJSON(clothes)) end setAccountData(account, "skin", skin) end end) Add this and try Link to post
TorNix~|nR 21 Posted February 11 Author Share Posted February 11 I tried that, it's the same Link to post
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