#[QB] [Free] Item based masks
92 messages · Page 1 of 1 (latest)
Crazy
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?
yeh ps-inventory. I guess it depends what you are currently using. I was using lj-inventory before so it was an easy transition
Yup, using it now, simple as replace qb-inventory with ps-inventory. What clothing store script is that you are using also? 🙂
I have created almost the same thing what lucid a while ago for my current server I run but added some extra stuff to it that people can take of your mask if your dead, unconscious or handcuffed.
https://discord.com/channels/897744257237000222/1083166655816929360
Thats wht i did.
You should share that as a snippet 😉
Gonna release mine soon that has QB & OX Support
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.
did you spawn the item in using a menu or command? That wont work.
/giveitem 1 mask 1
yeh you need to take the mask off so it knows what mask it is
go to a clothing store or something
👍
Any experience setting this up with dpclothing aswell? so that u can use dpclothing menu to take it on and off
ive never used dpclothing but im sure you could replace whatever event it calls when you select the mask option
i dont see why not. same concept should work for any clothing item
@kind adder thanks for the reply, and btw this little script is awesome 🙂
W
hmmm when i take of my mask and then join the server again the mask is on and i still have the item
i have just fixed this, i will update the github shortly
actually... my fix is for illenium-appearance only, i can share that snippet with you if you want but you would have to adapt it yourself for a different clothing system.
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
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
❤️ thank you bro
anyone have the hat png
} 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>");
}
goes into your qb-inventory/html/app.js .. just made them actually say the Drawable and Texture .. (Note I am using a different inventory so you'll have to adapt the code to your inventory)
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
Using dpclothing myself and it works fine 🙂
There bug with radialmenu when you take off
is this already inside of illenium-appearance? or would i have to add that client event.
(for the saving appearance fix on masks)
"illenium-appearance:client:SaveCurrentApp" was added by me
you are correct, working on a fix for it now
Appreciate it!
Just pushed a fix for the radialmenu, thanks @honest compass for spotting the issue. Please update and pay attention to step 3 of the install as it has changed slightly https://github.com/Lucidkniight/lucid-masks
All g letting you know
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?
I personally enjoy Renewed Weaponscarry .. everything you need is there
its possible to do it with hats/glasses im trying to do it but i didnt manage to make it
scroll up 
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
I didnt write these additions, but at a glance they look correct. Credit to @distant fulcrum.
Hope its okay @kind adder
Of course! Its open source for a reason. Thanks for contributing 
Created a branch for it
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 🤣
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
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
I got it @distant fulcrum 🙂 thnx by the way
so i did this with the script to remove vest/kutte and add it as a item but i get this error with ps inventory
you need to modify js.lua in qb-inventory i think like here but for the vest #1129473952876597278 message
if hasjob then
I really preferred the layout of the old ps-inventory. But i think it was called something else.. lj-inventory?
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?
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)
@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?
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)```
Where would I put this?
Can you add shirt/pants/full outfit/vest/hat
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
.