Jump to content

help error


Apo

Recommended Posts

Use the Lua forum tags for your codes, it wll help us a lot.

function assignSkin(source) 
    skin, skinID = nil, nil 
    if getElementData(source, "jailed") then 
    -- by Apo 
        local race = getElementData(source, "race") 
        if getElementData(source, "gender") == 1 then 
         
            if race == 0 then 
                -- Black Female 
                skin = bFemale 
                skinID = bFemaleID 
            elseif race == 1 then 
                -- White Female 
                skin = wFemale 
                skinID = wFemaleID 
            else 
                 
                skin = aFemale 
                skinID = aFemaleID 
            end 
        else 
             
            if race == 0 then 
                -- Black Male 
                skin = bMale 
                skinID = bMaleID 
            elseif race == 1 then 
                -- White Male 
                skin = wMale 
                skinID = wMaleID 
            else 
                 
                skin = aMale 
                skinID = aMaleID 
            end 
        end 
    else 
        local items = exports['item-system']:getItems( source ) -- [] [1] = itemID [2] = itemValue 
        for itemSlot, itemCheck in ipairs(items) do 
            if itemCheck[1] == 16 then 
                local skinData = split(tostring(itemCheck[2]), ':') 
                skin = tonumber(skinData[1]) 
                skinID = tonumber(skinData[2]) 
            end 
        end 
    end 
-- by Apo 
    if skin then 
        setElementModel(source, skin) 
        setElementData(source, "clothing:id", skinID or nil) 
        mysql:query_free( "UPDATE characters SET skin = '" .. exports.mysql:escape_string(skin) .. "', clothingid = '" .. exports.mysql:escape_string(skinID or 0) .. "' WHERE id = '" .. exports.mysql:escape_string(getElementData( source, "dbid" )).."'" ) 
    end 
end 

About the 3rd line problem, it is clear the problem is 'source'. I guess source is not defined at all in the event you are using, even though you didn't even give us the event(s) you are using.

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