tcantrell / fivem-appearance

fivem-appearance for qb-core with Tattoos support

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fivem-appearance

Requirements

Features

  • Everything from standalone fivem-appearance
  • Player outfits
  • Rank based Clothing Rooms for Jobs / Gangs
  • Tattoo's Support
  • Hair Textures
  • Polyzone Support
  • Ped Menu command (/pedmenu) (Configurable)
  • Reload Skin command (/reloadskin)
  • Improved code quality
  • No additional SQL needed. Uses the default qb-clothing schema
  • Plastic Surgeons
  • qb-target Support

New Preview (with Tattoos)

https://streamable.com/qev2h7

Setup

NOTE: This might NOT pick up existing outfits / skins. It is recommended to use this on a new server. You can adopt your old outfits / skins as well if you're experienced enough. I will not be providing help on how to do that.

  • Delete / stop qb-clothing
  • Delete / stop any tattoo shop resources e.g., qb-tattooshop
  • Put setr fivem-appearance:locale "en" in your server.cfg
  • Put ensure fivem-appearance in your server.cfg
  • Follow the code below to replace the events

Replace the qb-multicharacter:server:getSkin callback with:

Line: 151 qb-multicharacter/server/main.lua

QBCore.Functions.CreateCallback("qb-multicharacter:server:getSkin", function(source, cb, cid)
    local result = MySQL.Sync.fetchAll('SELECT * FROM playerskins WHERE citizenid = ? AND active = ?', {cid, 1})
    if result[1] ~= nil then
        cb(json.decode(result[1].skin))
    else
        cb(nil)
    end
end)

Replace the RegisterNUICallback('cDataPed', function(data)' callback with:

Line: 109 qb-multicharacter/client/main.lua

RegisterNUICallback('cDataPed', function(data)
    local cData = data.cData
    SetEntityAsMissionEntity(charPed, true, true)
    DeleteEntity(charPed)
    if cData ~= nil then
        QBCore.Functions.TriggerCallback('qb-multicharacter:server:getSkin', function(skinData)
            if skinData then
                local model = skinData.model
                CreateThread(function()
                    RequestModel(GetHashKey(model))
                    while not HasModelLoaded(GetHashKey(model)) do
                        Wait(10)
                    end
                    charPed = CreatePed(2, model, Config.PedCoords.x, Config.PedCoords.y, Config.PedCoords.z - 0.98, Config.PedCoords.w, false, true)
                    SetPedComponentVariation(charPed, 0, 0, 0, 2)
                    FreezeEntityPosition(charPed, false)
                    SetEntityInvincible(charPed, true)
                    PlaceObjectOnGroundProperly(charPed)
                    SetBlockingOfNonTemporaryEvents(charPed, true)
                    exports['fivem-appearance']:setPedAppearance(charPed, skinData)
                end)
            else
                CreateThread(function()
                    local randommodels = {
                        "mp_m_freemode_01",
                        "mp_f_freemode_01",
                    }
                    local model = GetHashKey(randommodels[math.random(1, #randommodels)])
                    RequestModel(model)
                    while not HasModelLoaded(model) do
                        Wait(10)
                    end
                    charPed = CreatePed(2, model, Config.PedCoords.x, Config.PedCoords.y, Config.PedCoords.z - 0.98, Config.PedCoords.w, false, true)
                    SetPedComponentVariation(charPed, 0, 0, 0, 2)
                    FreezeEntityPosition(charPed, false)
                    SetEntityInvincible(charPed, true)
                    PlaceObjectOnGroundProperly(charPed)
                    SetBlockingOfNonTemporaryEvents(charPed, true)
                end)
            end
        end, cData.citizenid)
    else
        Citizen.CreateThread(function()
            local randommodels = {
                "mp_m_freemode_01",
                "mp_f_freemode_01",
            }
            local model = GetHashKey(randommodels[math.random(1, #randommodels)])
            RequestModel(model)
            while not HasModelLoaded(model) do
                Citizen.Wait(0)
            end
            charPed = CreatePed(2, model, Config.PedCoords.x, Config.PedCoords.y, Config.PedCoords.z - 0.98, Config.PedCoords.w, false, true)
            SetPedComponentVariation(charPed, 0, 0, 0, 2)
            FreezeEntityPosition(charPed, false)
            SetEntityInvincible(charPed, true)
            PlaceObjectOnGroundProperly(charPed)
            SetBlockingOfNonTemporaryEvents(charPed, true)
        end)
    end
end)

Credits

About

fivem-appearance for qb-core with Tattoos support

License:MIT License


Languages

Language:Lua 96.2%Language:HTML 3.8%