Jump to content

Ped clothes


TorNix~|nR

Recommended Posts

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
   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 by WASSIm.
  • Like 1
Link to comment
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

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