Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Q] Job Requirements #5

Closed
SantyR0 opened this issue Apr 17, 2022 · 8 comments
Closed

[Q] Job Requirements #5

SantyR0 opened this issue Apr 17, 2022 · 8 comments

Comments

@SantyR0
Copy link

SantyR0 commented Apr 17, 2022

Sorry for msg, i know this is already not active but i just wanna ask if u have idea how to put job requirements?

@Trey2k
Copy link
Collaborator

Trey2k commented Apr 17, 2022

To add job requirements you would want to create a custom crafting menu probably from the jobs menu using this trigger TriggerEvent("weasel-crafting:customMenu", (Items structured exactly the same as in the config but for the custom menu), (lvl))

@SantyR0
Copy link
Author

SantyR0 commented Apr 17, 2022

my bad can't make it work, do u have a example? thanks for taking time replying.

i tried it like this, but it keeps giving me errors. I put it on policejob\client\main.lua

local crafttables = {
1917885559
}

exports.qtarget:AddTargetModel(crafttables, {
options = {
{
event = "weasel-crafting:mechcraft",
icon = "fas fa-tools",
label = "Crafting Table"
},
},
distance = 2
})
RegisterNetEvent("weasel-crafting:mechcraft")
AddEventHandler("weasel-crafting:mechcraft", function()
TriggerEvent('weasel-crafting:openMenu',{
Name = "lockpick",
DisplayName = "Lockpick",
Quantity = 2,
MetaData = {},
Time = 10000,
Level = 1,
Recipe = {
{'Schroot', 'scrapmetal', 10, {}, true},
{'Rubber', 'rubber', 2, {}, true},
{'Plastic', 'plastic', 4, {}, true},
{'Staal', 'steel', 3, {}, true},
}})
end)

@Trey2k
Copy link
Collaborator

Trey2k commented Apr 17, 2022

That looks like the qtarget example, are you using qtarget?

@SantyR0
Copy link
Author

SantyR0 commented Apr 17, 2022

Yes. I'm sorry for too many question, but trying to learn. I'm trying to make a craftable items per job. I have managed to make a crafting entity by following the guide but I want to make different craftable items per job.

@Trey2k
Copy link
Collaborator

Trey2k commented Apr 18, 2022

I have attached one of our resources that used a custom crafting menu. You would want to use the same method for the police job.
weasel-selling.zip

@SantyR0
Copy link
Author

SantyR0 commented Apr 18, 2022

Wow thanks, this is good. But I need to make it only accessible for certain job. Is there any way to make it that way?

@Trey2k
Copy link
Collaborator

Trey2k commented Apr 18, 2022

Yes, if you do it exactly the same as the file I sent you but move the event trigger to the jobs menu. Only that job will be able to access it.

@SantyR0
Copy link
Author

SantyR0 commented Apr 18, 2022

Sorry, I don't understand how I can do that instead I do this:

RegisterNetEvent("weasel-crafting:police")
AddEventHandler("weasel-crafting:police", function(Crafting)
EnableGui(true)
SendNUIMessage({
type = "addCraftingItems",
Items = Config.Police,
BtnText = "Craft Item(s)",
})
TriggerEvent('weasel-crafting:police', 1)
end)

exports.qtarget:AddTargetModel({1917885559, 666561306}, {
options = {
{
event = "weasel-crafting:police",
icon = "fas fa-box-circle-check",
label = "action 1",
num = 1,
job = "police",
}
},
distance = 2
})

I believe it works not in a way that the crafting menu is limited to a specific job but I'm receiving this error:
image

Am I doing something wrong?

@SantyR0 SantyR0 closed this as completed Apr 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants