TorNix~|nR Posted February 9, 2021 Share Posted February 9, 2021 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 comment
TorNix~|nR Posted February 9, 2021 Author Share Posted February 9, 2021 Resource: https://community.multitheftauto.com/index.php?p=resources&s=details&id=10588 Link to comment
WASSIm. Posted February 11, 2021 Share Posted February 11, 2021 (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, 2021 by WASSIm. 1 Link to comment
TorNix~|nR Posted February 11, 2021 Author Share Posted February 11, 2021 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 comment
WASSIm. Posted February 11, 2021 Share Posted February 11, 2021 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 comment
TorNix~|nR Posted February 11, 2021 Author Share Posted February 11, 2021 I tried that, it's the same Link to comment
TorNix~|nR Posted February 12, 2021 Author Share Posted February 12, 2021 Problem solved! Link to comment
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