#[QB] [Free] Item based masks

92 messages · Page 1 of 1 (latest)

kind adder
scenic minnow
#

Crazy

earnest shard
#

is that ps-inventory? I may have to start using it too, looks awesome. Is it hard to change everything over to work with it?

kind adder
earnest shard
elder relic
#

Thats wht i did.

earnest shard
elder relic
#

Gonna release mine soon that has QB & OX Support

earnest shard
#

Not working for me mate, /mask or by pressing use from inventory

#

I did follow exactly how you said to install it, apart from not add it to the radial.

kind adder
earnest shard
#

/giveitem 1 mask 1

kind adder
#

yeh you need to take the mask off so it knows what mask it is

#

go to a clothing store or something

earnest shard
#

ahhhh lol okay, maybe mention that in the description 😄

#

thanks mate

kind adder
#

👍

scenic minnow
#

Any experience setting this up with dpclothing aswell? so that u can use dpclothing menu to take it on and off

kind adder
#

ive never used dpclothing but im sure you could replace whatever event it calls when you select the mask option

kind adder
#

i dont see why not. same concept should work for any clothing item

autumn junco
#

does anyone make it work with the hats?

#

it will be nice

scenic minnow
#

@kind adder thanks for the reply, and btw this little script is awesome 🙂

wind tulip
#

W

modest obsidian
#

hmmm when i take of my mask and then join the server again the mask is on and i still have the item

kind adder
kind adder
autumn junco
#

Hey Lucid can you make it for the hats also i wish i could do it i tried to replicate it but did not work 😛

#

And can you share i have the same issue and i use qb-clothing

kind adder
# autumn junco Hey Lucid can you make it for the hats also i wish i could do it i tried to rep...

I dont plan to make a version for hats sorry, but you should be able to make it work in the same way by using something like SetPedPropIndex(ped, 0, 4, 0, true) -- add hat ClearPedProp(ped, 0) -- remove hat

As for the mask fix, you essentially need to find wherever your clothing script is saving the peds appearance. For example with illenium-appearance it is saved here :

    local src = source
    local citizenID = Framework.GetPlayerID(src)
    if appearance ~= nil then
        Framework.SaveAppearance(appearance, citizenID)
    end
end)```
You can then trigger that event whenever the mask is put on/taken off to save the new appearance like so:
```RegisterNetEvent("illenium-appearance:client:SaveCurrentApp", function()
    local appearance = client.getPedAppearance(cache.ped)
    TriggerServerEvent("illenium-appearance:server:saveAppearance", appearance)
end)```
```TriggerEvent("illenium-appearance:client:SaveCurrentApp")```
I dont recall exactly how qb-clothing handles the saving of outfits but im sure its pretty similar
autumn junco
#

❤️ thank you bro

mint gulch
#

anyone have the hat png

distant fulcrum
#
} else if (itemData.name == "mask") {
            $(".item-info-title").html("<p>" + itemData.label + "</p>");
            $(".item-info-description").html(
                "<p><b> Drawable</b> - " + itemData.info.drawableId + " <b>Texture</b> - " + itemData.info.textureId + "</p>"
            );
            $(".item-info-bottom").html("<p style=\"font-size:13.5px\"><b>Weight: </b>" + ((itemData.weight * itemData.amount) / 1000).toFixed(1) + " | <b>Amount: </b> " + itemData.amount + " | <b>Quality: </b> " + "<a style=\"font-size:13.5px;color:green\">" + Math.floor(itemData.info.quality) + "</p></a>");
        } else if (itemData.name == "hat") {
            $(".item-info-title").html("<p>" + itemData.label + "</p>");
            $(".item-info-description").html(
                "<p><b> Drawable</b> - " + itemData.info.drawableId + " <b>Texture</b> - " + itemData.info.textureId + "</p>"
            );
            $(".item-info-bottom").html("<p style=\"font-size:13.5px\"><b>Weight: </b>" + ((itemData.weight * itemData.amount) / 1000).toFixed(1) + " | <b>Amount: </b> " + itemData.amount + " | <b>Quality: </b> " + "<a style=\"font-size:13.5px;color:green\">" + Math.floor(itemData.info.quality) + "</p></a>");
        }
distant fulcrum
#

and the events are the same just what ever says mask is changed to hat .. eg.

lucid-masks:client:MaskOff
would be 
lucid-masks:client:HatOff
earnest shard
honest compass
#

There bug with radialmenu when you take off

scenic minnow
kind adder
kind adder
scenic minnow
kind adder
honest compass
scenic minnow
#

Looking to find a clever solution to if a player has a for example weapon_pistol in invetory they automaticlly equip a holster from illenium-appearance, any good ideas?

distant fulcrum
#

I personally enjoy Renewed Weaponscarry .. everything you need is there

strong dew
#

its possible to do it with hats/glasses im trying to do it but i didnt manage to make it

strong dew
#

already saw it

#

thx

#

im trying but idk what im doing wrong

#

i was able to only remove the hat

#

but when i try to put it back

#

says ive already a hat on

kind adder
distant fulcrum
#

Hope its okay @kind adder

kind adder
distant fulcrum
#

Created a branch for it

earnest shard
#

Getting this suddenly again, using EUP hats/ear-pieces, masks, etc mess it up, taking off a hat, ear-piece, eup mask, any that are part of presets count as a mask 🤣

robust shoal
#

or if i want to add the shoes one then

#
RegisterCommand("shoes", function()
    TriggerEvent("qb-masks:client:ToggleShoe")
end, false)

RegisterNetEvent("qb-masks:client:ToggleShoe", function()
    local ped = PlayerPedId()
    local shoe = GetPedPropIndex(ped, 6)
    local tex = GetPedPropTextureIndex(ped, 6)

    if shoe == -1 then
        TriggerServerEvent("qb-masks:server:ShoeOnByCommand")
    else
        TriggerEvent("qb-masks:client:ShoeOff", shoe, tex)
    end
end)

RegisterNetEvent('qb-masks:client:shoeOn', function(item)
    local ped = PlayerPedId()
    if GetPedPropIndex(ped, 6) ~= -1 then QBCore.Functions.Notify("You are already wearing a shoe", "error") return end

    QBCore.Functions.Progressbar("shoeon", "Putting shoe On..", 600, false, true, {
        disableMovement = false,
        disableCarMovement = false,
        disableMouse = false,
        disableCombat = false,
    }, {
        animDict = "random@domestic",
        anim = "pickup_low",
        flags = 49,
    }, {}, {}, function() -- Done
        SetPedPropIndex(ped, 6, item.info.drawableId, item.info.textureId)
        TriggerServerEvent("qb-masks:server:RemoveShoeItem", item)
    end, function() -- Cancel
    end, "fa-solid fa-boot")
end)

RegisterNetEvent('qb-masks:client:shoeOff', function(shoe, tex)
    local ped = PlayerPedId()
    if GetPedPropIndex(ped, 6) == -1 then QBCore.Functions.Notify("You are not wearing a shoe", "error") return end

    QBCore.Functions.Progressbar("shoeoff", "Taking shoe Off..", 600, false, true, {
        disableMovement = false,
        disableCarMovement = false,
        disableMouse = false,
        disableCombat = false,
    }, {
        animDict = "random@domestic",
        anim = "pickup_low",
        flags = 49,
    }, {}, {}, function() -- Done
        ClearPedProp(ped, 6)
        TriggerServerEvent("qb-masks:server:GiveShoeItem", shoe, tex)
    end, function() -- Cancel
    end, "fa-solid fa-boot")
end)

i done these but didnt work i thing so the GetPedPropIndex(ped,6) =-1

#

is creating issue

#

anyone can help me out

distant fulcrum
# robust shoal or if i want to add the shoes one then

so the number you would want to get is the bare foot shoe in clothing menu .. so if you wearing shoes for example .. and you type /shoe then the native will be something like GetPedPropIndex(ped, 58) for exmaple .. you have to get the number within your clothing menu

#

and I don't think shoes is a prop .. you'll have to use the same native the masks use if I'm not mistaken

#

pretty sure that shoes is a Drawable and not a prop

#
    local mask = GetPedDrawableVariation(ped, 1)
    local tex = GetPedTextureVariation(ped, 1)

Ids
0 - Head
1 - Beard
2 - Hair
3 - Torso
4 - Legs
5 - Hands
6 - Foot
7 - Scarfs/Neck Accessories
8 - Accessories 1
9 - Accessories 2
10- Decals
11 - Auxiliary parts for torso

These are the drawable variations .. so for mask its 1 because it's classified as beard within the natives ..
in your case you'll be using 6 for foor

#

so when you want to take your shoes off you'll use

SetPedComponentVariation(ped, 6, 56) -- 56 in this case is my barefoot within the clothing menu

#

@robust shoal

#

shoule be something like this

RegisterCommand("shoes", function()
    local ped = PlayerPedId()
    local shoe = GetPedDrawableVariation(ped, 6)
    local tex = GetPedTextureVariation(ped, 6)

    if shoe == 56 then
        TriggerServerEvent("lucid-masks:server:MaskOnByCommand")
    else
        TriggerEvent("lucid-masks:client:ShoesOff", shoe, tex)
    end
end, false)


RegisterNetEvent('lucid-masks:client:ShoesOn', function(item)
    local ped = PlayerPedId()
    if GetPedDrawableVariation(ped, 6) ~= 0 then QBCore.Functions.Notify("You are already wearing a mask", "error") return end

    QBCore.Functions.Progressbar("maskon", "Putting Mask On..", 600, false, true, {
        disableMovement = false,
        disableCarMovement = false,
        disableMouse = false,
        disableCombat = false,
    }, {
        animDict = "mp_masks@standard_car@ds@",
        anim = "put_on_mask",
        flags = 49,
    }, {}, {}, function() -- Done
        SetPedComponentVariation(ped, 6, item.info.drawableId, item.info.textureId)
        TriggerServerEvent("lucid-masks:server:RemoveMaskItem", item)
    end, function() -- Cancel

    end)
end)

RegisterNetEvent('lucid-masks:client:ShoesOff', function(shoe, tex)
    local ped = PlayerPedId()
    if GetPedDrawableVariation(ped, 6) == 0 then QBCore.Functions.Notify("You are not wearing a mask", "error") return end

    QBCore.Functions.Progressbar("maskoff", "Taking Mask Off..", 600, false, true, {
        disableMovement = false,
        disableCarMovement = false,
        disableMouse = false,
        disableCombat = false,
    }, {
        animDict = "missfbi4",
        anim = "takeoff_mask",
        flags = 49,
    }, {}, {}, function() -- Done
        SetPedComponentVariation(ped, 6, 56)
        TriggerServerEvent("lucid-masks:server:GiveMaskItem", shoe, tex)
    end, function() -- Cancel

    end)
end)

for client .. you can work out the server

robust shoal
#

I got it @distant fulcrum 🙂 thnx by the way

viral summit
autumn junco
split violet
#

if hasjob then

storm cosmos
hard plank
#

in qbcore when we we take off mask and it comes in inventoy and we leave server and join again the mask comes to the ped again after joining but the item stays in inv and when we do /mask it makes another item anyone knows any fix?

hard plank
#

well i got the fix for the above problem just to help new people who facing my issue

Note - Only For illenium-appearance

Put this in client of illenium-appearance

    local appearance = client.getPedAppearance(cache.ped)
    TriggerServerEvent("illenium-appearance:server:saveAppearance", appearance)
end)```

**Add the trigger in these two events in lucid mask client lua**

*lucid-masks:client:MaskOn*
*lucid-masks:client:MaskOff*

***Like this*** - 


```    }, {}, {}, function() -- Done
        SetPedComponentVariation(ped, 1, item.info.drawableId, item.info.textureId)
        TriggerServerEvent("lucid-masks:server:RemoveMaskItem", item)
        TriggerEvent("illenium-appearance:client:SaveCurrentApp") ------ here
    end, function() -- Cancel

    end)
end)


    }, {}, {}, function() -- Done
        SetPedComponentVariation(ped, 1, 0)
        TriggerServerEvent("lucid-masks:server:GiveMaskItem", mask, tex)
        TriggerEvent("illenium-appearance:client:SaveCurrentApp") ------ here
    end, function() -- Cancel

    end)
end)
hot quartz
#

@kind adder so if a cop takes the mask from your inventory, will that remove it from your face? And from your ability to put it back on?

kind adder
# hot quartz <@134707990107389952> so if a cop takes the mask from your inventory, will that ...

If the player is wearing the mask then it is not in their inventory. If you want to add the ability for cops to remove someones mask you would want to add it to your police/evidence system. Its pretty simple to create that interaction by just triggering the existing events for maskoff and givemaskitem. If you want the cop to recieve the item rather than the player wearing the mask you can edit the givemaskitem event to accept a recipient like so.

    local src = nil
    if mask == 0 then return end

    if reciever then 
        src = reciever 
        print("reciever")
    else
        src = source
        print("player")
    end
    local Player = QBCore.Functions.GetPlayer(src)
    local info = {drawableId = mask, textureId = tex}

    Player.Functions.AddItem("mask", 1, false, info)
    TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["mask"], "add")
end)```
hybrid brook
#

Can you add shirt/pants/full outfit/vest/hat

solar glen
#

i use illeneium-appearance but when i take off my mask and relog, it will spawn with masked on then when i /mask it will add the items so the items duplicated

solar glen
#

okay my bad

#

hehe

#

thank you sho much !