├── images ├── ace.png ├── wd40.png ├── crayons.png ├── fabric.png ├── pistol1.png ├── teddy.png ├── wallet.png ├── binjuice.png ├── blankusb.png ├── brokencup.png ├── actionfigure.png ├── bottlecaps.png ├── crushedcan.png ├── emptybottle.png ├── screwdriver.png ├── sunglasses.png └── bullet_casing.png ├── fxmanifest.lua ├── locales └── en.lua ├── README.md ├── config.lua ├── server └── main.lua ├── LICENSE └── client └── main.lua /images/ace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrZainRP/mz-bins/HEAD/images/ace.png -------------------------------------------------------------------------------- /images/wd40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrZainRP/mz-bins/HEAD/images/wd40.png -------------------------------------------------------------------------------- /images/crayons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrZainRP/mz-bins/HEAD/images/crayons.png -------------------------------------------------------------------------------- /images/fabric.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrZainRP/mz-bins/HEAD/images/fabric.png -------------------------------------------------------------------------------- /images/pistol1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrZainRP/mz-bins/HEAD/images/pistol1.png -------------------------------------------------------------------------------- /images/teddy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrZainRP/mz-bins/HEAD/images/teddy.png -------------------------------------------------------------------------------- /images/wallet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrZainRP/mz-bins/HEAD/images/wallet.png -------------------------------------------------------------------------------- /images/binjuice.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrZainRP/mz-bins/HEAD/images/binjuice.png -------------------------------------------------------------------------------- /images/blankusb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrZainRP/mz-bins/HEAD/images/blankusb.png -------------------------------------------------------------------------------- /images/brokencup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrZainRP/mz-bins/HEAD/images/brokencup.png -------------------------------------------------------------------------------- /images/actionfigure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrZainRP/mz-bins/HEAD/images/actionfigure.png -------------------------------------------------------------------------------- /images/bottlecaps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrZainRP/mz-bins/HEAD/images/bottlecaps.png -------------------------------------------------------------------------------- /images/crushedcan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrZainRP/mz-bins/HEAD/images/crushedcan.png -------------------------------------------------------------------------------- /images/emptybottle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrZainRP/mz-bins/HEAD/images/emptybottle.png -------------------------------------------------------------------------------- /images/screwdriver.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrZainRP/mz-bins/HEAD/images/screwdriver.png -------------------------------------------------------------------------------- /images/sunglasses.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrZainRP/mz-bins/HEAD/images/sunglasses.png -------------------------------------------------------------------------------- /images/bullet_casing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrZainRP/mz-bins/HEAD/images/bullet_casing.png -------------------------------------------------------------------------------- /fxmanifest.lua: -------------------------------------------------------------------------------- 1 | fx_version 'cerulean' 2 | 3 | game 'gta5' 4 | 5 | author 'Mr_Zain#4139' 6 | 7 | description 'mz-bins - a bin diving resource with crafting + sale components (with or without mz-skill integration)' 8 | 9 | version '1.5.0' 10 | 11 | shared_scripts { 12 | '@qb-core/shared/locale.lua', 13 | 'config.lua', 14 | 'locales/en.lua', 15 | } 16 | 17 | client_script 'client/main.lua' 18 | 19 | server_script 'server/main.lua' 20 | 21 | lua54 'yes' 22 | 23 | -------------------------------------------------------------------------------- /locales/en.lua: -------------------------------------------------------------------------------- 1 | local Translations = { 2 | error = { 3 | negative = 'You cannot sell a negative amount...', 4 | no_items = 'You do not have this amount of the item you are selling', 5 | skillfail = 'Ouch! Did something just poke me?', 6 | xpdown = '-%{value}XP to %{value2}.', 7 | doingtask = 'You are already doing something, calm down!', 8 | searched = 'You already searched this dumpster.', 9 | failfind = 'Darn... you didn\'t find anything...', 10 | cancelled = "Process cancelled...", 11 | needcans = "You need soda cans to press...", 12 | cansruined = 'You apply too much force to the press and ruin the cans...', 13 | cansxpdown = '-%{value}XP to %{value2}.', 14 | needbottles = 'You need empty bottles to crush...', 15 | bottlesruined = 'Your hand slips and the plastic breaks into unusable parts...', 16 | bottlesxpdown = '-%{value}XP to %{value2}.', 17 | needcaps = "You need bottlecaps to process...", 18 | capsruined = "The bottlecaps pop under the pressure... Ruined...", 19 | capsxpdown = '-%{value}XP to %{value2}.', 20 | needcups = 'You need something glass to process...', 21 | cupsruined = 'The glass shatters into unuseable pieces...', 22 | cupsxpdown = '-%{value}XP to %{value2}.', 23 | nocraft = "You have no material on you capable of being crafted...", 24 | }, 25 | success = { 26 | sold = 'You have sold %{value2} many %{value}s for a total of $%{value3}', 27 | presscans = 'You begin pressing down the cans...', 28 | crushbottles = "You begin crushing the plastic bottles...", 29 | processcaps = "You begin processing the bottlecaps...", 30 | workcups = 'You begin crushing the scrap glass...', 31 | yescraft = "Yes you do, please use this workbench again.", 32 | binjuice = "You feel strange...", 33 | }, 34 | info = { 35 | sell = 'Sell Items', 36 | sell_pawn = 'Sell Items To The Pawn Shop', 37 | sell_items = 'We are paying $%{value} per item!', 38 | back = '⬅ Go Back', 39 | max = 'You currently hold %{value} of these.', 40 | submit = 'Exchange', 41 | title = 'Connie\'s Trash \'n Treasure', 42 | menu9 = 'Woah, its the veteran diver, give them double on everything! (100% PREMIUM)', 43 | menu8 = 'Hey, I\'ve seen you before, special prices for you. (75% PREMIUM)', 44 | menu7 = "Hey, I\'ve seen you before, special prices for you. (60% PREMIUM)", 45 | menu6 = 'Hey, I\'ve seen you before, special prices for you. (50% PREMIUM)', 46 | menu5 = 'Hey, I\'ve seen you before, special prices for you. (40% PREMIUM)', 47 | menu4 = 'Hey, I\'ve seen you before, special prices for you. (30% PREMIUM)', 48 | menu3 = 'Hey, I\'ve seen you before, special prices for you. (20% PREMIUM)', 49 | menu2 = 'Hey, I\'ve seen you before, special prices for you. (10% PREMIUM)', 50 | }, 51 | progress = { 52 | searching = "Searching for treasure...", 53 | canspress = "Pressing down cans...", 54 | crushbottles = "Crushing bottles...", 55 | processcaps = "Processing bottlecaps...", 56 | processcups = "Processing glass fragments...", 57 | binjuice = "Taking a sip...", 58 | }, 59 | -- The following "label" fields are relevant to okokNotify notifications, if you are using qb-core notifications please ignore these. 60 | label = { 61 | skillfail = "OUCH!", 62 | mzskills = "SKILLS", 63 | doingtask = "SLOW DOWN!", 64 | searched = "ALREADY SEARCHED", 65 | failfind = "NOTHING HERE", 66 | cancelled = "CANCELLED", 67 | needcans = "NEED CANS", 68 | presscans = "PRESSING CANS", 69 | cansruined = "CANS RUINED", 70 | needbottles = "NEED BOTTLES", 71 | crushbottles = "CRUSH BOTTLES", 72 | bottlesruined = "BOTTLES RUINED", 73 | needcaps = "NEED BOTTLE CAPS", 74 | processcaps = "PROCESS BOTTLECAPS", 75 | capsruined = "BOTTLECAPS RUINED", 76 | needcups = "NEED GLASS", 77 | workcups = "PROCESS GLASS", 78 | cupsruined = "GLASS RUINED", 79 | menu9 = "VIP BONUS", 80 | menu8 = "LOYALTY BONUS", 81 | menu7 = "LOYALTY BONUS", 82 | menu6 = "LOYALTY BONUS", 83 | menu5 = "LOYALTY BONUS", 84 | menu4 = "LOYALTY BONUS", 85 | menu3 = "LOYALTY BONUS", 86 | menu2 = "LOYALTY BONUS", 87 | negative = "NEGATIVE?", 88 | nocraft = "NO MATERIALS?", 89 | yescraft = "MATERIALS FOUNDS!", 90 | binjuice = "BIN JUICE!", 91 | }, 92 | } 93 | 94 | Lang = Locale:new({ 95 | phrases = Translations, 96 | warnOnMissing = true 97 | }) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### MZ-BINS - a skill based bin-dive function for QB-CORE based FiveM servers 2 | 3 | ### Introduction 4 | - The ultimate, progression based bin-diving function where players are able to interact with bins found around the map to find useful things that the locals have thrown out. 5 | - Some of the items are sellable directly at "Trash 'n Treasure", other items can be broken down or processed into materials for use in crafting and other items have a rare drop rare or a unique purpose. 6 | - This resource is self-contained in respect of dumpster props that can be interacted with (to which more can be easily added), a crafting location that can be configured in the same way that qb-target locations can be changed by changing the coordinates for the relevant polyzone or PED and a functioning shop - again, the location of which can eb easily changed by changing the qb-target export in the client.lua (be sure to also change the same details in the config.lua to ensure the shop blip location is correct). 7 | - XP modifier via mz-skills applies for successful bin diving, more XP is awarded for successful crafting. 8 | - The benefit of leveling up is that the shop vendor pays higher for bin-dive sellable items. The config.lua explains the multiplier by reference to calling separate configurations. Changing the prices of items that the vendor will purchase will adjust the impact XP will have on the mz-bins progression. Server owners can tailor this to their economic needs. Further, in an RP-based server this can create a separate sub-economy whereby proficient bin divers can not only bin dive for items but might also seek to buy them from players for more than the vendor would pay a low XP player and profit off the margin - encouraging an RP interaction. 9 | 10 | ### Dependencies 11 | - mz-skills (a modified version of qb-skillz (now B1-skillz) made and distributed by Kings#4220 of Burn One Studios - accessible at: https://github.com/Burn-One-Studios/B1-skillz) 12 | - progressbar 13 | - qb-target 14 | - qb-skillbar 15 | - OPTIONAL: (Configured to work with okokNotify as well as base qb-core notifications). 16 | 17 | ### Installation Instruction 18 | 19 | ### A. MZ-SKILLS 20 | 21 | 1. If you do not already have mz-skills running in your server, ensure that mz-skills forms part of your running scripts. 22 | 23 | 2. If this is your first time running mz-skills, be sure to run the "skills.sql" sql file and open the database. (This will add a data table to the existing "players" database which will hold the skill value for "Scraping" as well as other jobs) 24 | 25 | ### B. QB-CORE/SHARED/ITEMS.LUA 26 | 27 | 3. Add the following items to qb-core/shared/items.lua (NOTE: IF YOU ARE RUNNING MZ-SCRAP THERE IS NO NEED TO ADD THE FIRST 3 ITEMS WHICH WILL ALREADY BE IN YOUR ITEMS.LUA): 28 | 29 | ```lua 30 | ['screwdriver'] = {['name'] = 'screwdriver', ['label'] = 'Screwdriver', ['weight'] = 100, ['type'] = 'item', ['image'] = 'screwdriver.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil, ['description'] = 'A flathead screwdriver. I mean sure the handle is a bit worn but this thing probably works.'}, 31 | ['wd40'] = {['name'] = 'wd40', ['label'] = 'WD-40', ['weight'] = 250, ['type'] = 'item', ['image'] = 'wd40.png', ['unique'] = true, ['useable'] = false, ['shouldClose'] = false, ['combinable'] = nil, ['description'] = 'A chemical compound with multiple purposes, including the removal of corrosion.'}, 32 | ["pistol1"] = {["name"] = "pistol1", ["label"] = "Pistol Grip", ["weight"] = 100, ["type"] = "item", ["image"] = "pistol1.png", ["unique"] = false, ["useable"] = false, ["shouldClose"] = false, ["combinable"] = nil, ["description"] = "The barrel of a Walther P-99 Pistol."}, 33 | 34 | ['blankusb'] = {['name'] = 'blankusb', ['label'] = 'Blank USB', ['weight'] = 0, ['type'] = 'item', ['image'] = 'blankusb.png', ['unique'] = false, ['useable'] = false, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'Non-descript USB, wonder if there is anything on it?'}, 35 | ['bottlecaps'] = {['name'] = 'bottlecaps', ['label'] = 'Bottle caps', ['weight'] = 300, ['type'] = 'item', ['image'] = 'bottlecaps.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'Some plastic caps for what looks like a variety of soda bottles.'}, 36 | ['brokencup'] = {['name'] = 'brokencup', ['label'] = 'Broken Cup', ['weight'] = 500, ['type'] = 'item', ['image'] = 'brokencup.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'A nice piece of glasswear... or it would have been if the handle wasn\'t cracked.'}, 37 | ['sodacan'] = {['name'] = 'sodacan', ['label'] = 'Soda Can', ['weight'] = 500, ['type'] = 'item', ['image'] = 'crushedcan.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'What was once a refreshing beverage is now just a tin can...'}, 38 | ['emptybottle'] = {['name'] = 'emptybottle', ['label'] = 'Empty bottle', ['weight'] = 300, ['type'] = 'item', ['image'] = 'emptybottle.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil, ['description'] = 'Makes a satisfying crunch when you press on it, not a single drop left...'}, 39 | ['bulletcasing'] = {['name'] = 'bulletcasing', ['label'] = 'Bullet casing', ['weight'] = 400, ['type'] = 'item', ['image'] = 'bullet_casing.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil, ['description'] = 'A used bullet shell... Still in tact though... Interesting.'}, 40 | ['actiontoy'] = {['name'] = 'actiontoy', ['label'] = 'Action figure', ['weight'] = 350, ['type'] = 'item', ['image'] = 'actionfigure.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil, ['description'] = 'An old toy, looks kinda neat - might be valuable?'}, 41 | ['ace'] = {['name'] = 'ace', ['label'] = 'Ace of Spades', ['weight'] = 100, ['type'] = 'item', ['image'] = 'ace.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil, ['description'] = 'An old trading card - kinda crusty...'}, 42 | ['wallet'] = {['name'] = 'wallet', ['label'] = 'Old Wallet', ['weight'] = 350, ['type'] = 'item', ['image'] = 'wallet.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil, ['description'] = 'Feels like leather... Clearly been used and abused though...'}, 43 | ["sunglasses"] = {["name"] = "sunglasses", ["label"] = "Sunnies", ["weight"] = 100, ["type"] = "item", ["image"] = "sunglasses.png", ["unique"] = false, ["useable"] = true, ["shouldClose"] = true, ["combinable"] = nil, ["description"] = "A pair of what look like expenssive UV spec, designer shades - except they say Gouccy?"}, 44 | ["crayons"] = {["name"] = "crayons", ["label"] = "Crayons", ["weight"] = 100, ["type"] = "item", ["image"] = "crayons.png", ["unique"] = false, ["useable"] = true, ["shouldClose"] = true, ["combinable"] = nil, ["description"] = "A small set of pastel coloured crayons, used to decorate illustrations. Stay within the lines!"}, 45 | ["teddy"] = {["name"] = "teddy", ["label"] = "Teddy bear", ["weight"] = 150, ["type"] = "item", ["image"] = "teddy.png", ["unique"] = false, ["useable"] = true, ["shouldClose"] = true, ["combinable"] = nil, ["description"] = "A teddy bear that appears to be unwanted, still has the tag on it and everything."}, 46 | ["fabric"] = {["name"] = "fabric", ["label"] = "Fabric scrap", ["weight"] = 150, ["type"] = "item", ["image"] = "fabric.png", ["unique"] = false, ["useable"] = true, ["shouldClose"] = true, ["combinable"] = nil, ["description"] = "Looks like someone has thrown an old strip of fabric, must have bought too much?"}, 47 | ``` 48 | 49 | 4. Add the images which appear in the "images" folder to your inventory images folder. If using lj-inventory, add the images to: lj-inventory/html/images/ 50 | 51 | 5. If you attend to all of the above steps you will need to restart the server in order for the new added items to be recognised by qb-core. Starting the mz-scrap resource without doing this will cause errors. Please restart your server ensuring that mz-scrap is ensured/starts after qb-core starts (ideally it should just form part of your [qb] folder). Happy sbin diving! 52 | 53 | ## C. SUPPORT 54 | 55 | 6. When seeking support, please address the following questions and ensure you are seeking support in the correct sub-forum if possible. This will allow myself and others to address your concerns quicker than would otherwise be the case. 56 | 57 | - A. What is the issue? What were you doing to cause the issue? 58 | 59 | - B. Have you checked for console errors? If yes, please provide them. If not, please check both F8 and server sided consoles for error messages. 60 | 61 | - C. Have you restarted the server to see if console errors arise upon loading the resource? Please do this and provide screenshots of your console. 62 | 63 | - D. What have you done to try and fix the issue? 64 | 65 | - E. Do you have any evidence to show what the issue is? (Screengrabs or short clips are very useful in working out how the error is caused in the first place - which makes finding a fix a lot easier). 66 | 67 | ----------------------- 68 | 69 | Please note, failure to provide the detail set out above will simply mean that time needs to be spent working out what the issue is in the first place rather than responding to it. 70 | -------------------------------------------------------------------------------- /config.lua: -------------------------------------------------------------------------------- 1 | Config = Config or {} 2 | 3 | --DEFAULT CRAFTING LOCATION: -1156.22, -1999.3, 13.18 (Change the "BinParts" boxZone to relocate the crafting location) 4 | 5 | ----------- 6 | --MZ-BINS-- 7 | ----------- 8 | 9 | Config.NotifyType = 'okok' -- notification type: 'qb' for qb-core standard notifications, 'okok' for okokNotify notifications 10 | 11 | ------------------------- 12 | --BIN DIVING PROPERTIES-- 13 | ------------------------- 14 | 15 | --Fail function + chance of failure 16 | Config.FailEnabled = true -- change to "false" if you do not want a player to have a chance to find nothing from searching a bin 17 | Config.FailChance = 5 -- Percentage chance for a player to fail to find anything useful upon a successful search of a bin 18 | 19 | --Time it takes to search bin: 20 | Config.SearchTimeLow = 3 -- Lowest time it will take to search a bin (in seconds) 21 | Config.SearchTimeHigh = 5 -- Highest time it will take to search a bin (in seconds) 22 | 23 | ------------- 24 | --MZ-SKILLS-- 25 | ------------- 26 | 27 | Config.mzskills = true -- change to 'false' to utilise resource without using mz-skills re: "Searching" skill 28 | -- If "Config.mzskills = true", the following parameters will apply: 29 | 30 | Config.BinSkill = "Searching" -- Name of the skill that will apply when using mz-bins (must be the same as a skill from mz-skills/config.lua) 31 | 32 | Config.diveXPlow = 1 -- Lowest amount of XP player will get for dumpster diving 33 | Config.diveXPhigh = 3 -- Highest amount of XP player will get for dumpster diving 34 | Config.diveXPloss = 2 -- Amount of XP lost for failing skillcheck (if skillcheck is enabled) 35 | 36 | -- XP modifier (for use with mz-skills) 37 | Config.DualXP = true -- Change to false to disable the use of 2x XP 38 | Config.DualXPitem = "binjuice" -- Item to consume to activate 2x XP? 39 | Config.dualXPtime = 30 -- Time (in minutes) for player to have double XP. 40 | 41 | ----------------------- 42 | --BIN DIVE SKILLCHECK-- 43 | ----------------------- 44 | 45 | Config.skillcheck = true -- change to 'false' to remove the skillcheck connected to each bin dive. 46 | --If you chose to use a skillcheck, the following parameters will apply 47 | Config.diveparse = 1 -- Lowest number of skillcheck parses possible when bin diving. 48 | Config.diveparsetime = 12 -- Time for bindive skill check (NOTE: A higher time makes the skillcheck slower but generally easier) 49 | 50 | -------------- 51 | --RARE ITEMS-- 52 | -------------- 53 | 54 | Config.rareitems = true -- change to 'false' to disable (NOTE: Rare drops are in addition to standard drops, not in substitution) 55 | 56 | --If you choose to have a potential for rare items to drop from searching bins, the following properties apply: 57 | Config.Rareitem1 = "wd40" -- 1.5% chance to find when searching a bin 58 | Config.Rareitem2 = "blankusb" -- 1% chance to find when searching a bin 59 | Config.Rareitem3 = "binjuice" -- 0.5% chance to find when searching a bin 60 | Config.Rareitem4 = "screwdriver" -- 0.5% chance to find when searching a bin 61 | 62 | ------------ 63 | --CRAFTING-- 64 | ------------ 65 | 66 | Config.CraftSkillCheck = true -- Change to false to disable a skillcheck for each crafting component 67 | 68 | --1. CRUSHING CANS 69 | Config.canslow = 3 -- Lowest number of skillchecks to crush cans. 70 | Config.canshigh = 5 -- Highest number of skillchecks to crush cans. 71 | Config.canstimelow = 6 -- Lowest time (in seconds) to crush cans. 72 | Config.canstimehigh = 10 -- Highest time (in seconds) to crush cans. 73 | 74 | --If using "mz-skills" the following XP parameters will apply: 75 | Config.cansXPlow = 3 -- Lowest amount of "Searching" XP gained from crushing cans. 76 | Config.cansXPhigh = 6 -- Highest amount of "Searching" XP gained from crushing cans. 77 | Config.cansXPloss = 3 -- Amount of "Searching" XP lost from failing to crush cans. 78 | 79 | --Inputs and outputs 80 | Config.cansamount = 3 -- Number of cans needed in order to be able to crush them. 81 | Config.cansreturnlow = 3 -- Lowest return for crushing cans. 82 | Config.cansreturnhigh = 5 -- Highest return for crushing cans. 83 | 84 | ---------------------------------------------------- 85 | 86 | --2. CRUSHING BOTTLES 87 | Config.bottleslow = 3 -- Lowest number of skillchecks to crush bottles. 88 | Config.bottleshigh = 5 -- Highest number of skillchecks to crush bottles. 89 | Config.bottlestimelow = 6 -- Lowest time (in seconds) to crush bottles. 90 | Config.bottlestimehigh = 10 -- Highest time (in seconds) to crush bottles. 91 | 92 | --If using "mz-skills" the following XP parameters will apply: 93 | Config.bottlesXPlow = 3 -- Lowest amount of "Searching" XP gained from crushing bottles. 94 | Config.bottlesXPhigh = 6 -- Highest amount of "Searching" XP gained from crushing bottles. 95 | Config.bottlesXPloss = 3 -- Amount of "Searching" XP lost from failing to crush bottles. 96 | 97 | --Inputs and outputs 98 | Config.bottlesamount = 3 -- Number of bottles needed in order to be able to crush them. 99 | Config.bottlesreturnlow = 3 -- Lowest return for crushing bottles. 100 | Config.bottlesreturnhigh = 5 -- Highest return for crushing bottles. 101 | 102 | ---------------------------------------------------- 103 | 104 | --3. CRUSHING BOTTLECAPS 105 | Config.bottlecapslow = 5 -- Lowest number of skillchecks to crush bottlecaps. 106 | Config.bottlecapshigh = 7 -- Highest number of skillchecks to crush bottlecaps. 107 | Config.bottlecapstimelow = 6 -- Lowest time (in seconds) to crush bottlecaps. 108 | Config.bottlecapstimehigh = 10 -- Highest time (in seconds) to crush bottlecaps. 109 | 110 | --If using "mz-skills" the following XP parameters will apply: 111 | Config.bottlecapsXPlow = 3 -- Lowest amount of "Searching" XP gained from crushing bottlecaps. 112 | Config.bottlecapsXPhigh = 6 -- Highest amount of "Searching" XP gained from crushing bottlecaps. 113 | Config.bottlecapsXPloss = 3 -- Amount of "Searching" XP lost from failing to crush bottlecaps. 114 | 115 | --Inputs and outputs 116 | Config.bottlecapsamount = 3 -- Number of bottlecaps needed in order to be able to crush them. 117 | Config.bottlecapsreturnlow = 3 -- Lowest return for crushing bottlecaps. 118 | Config.bottlecapsreturnhigh = 8 -- Highest return for crushing bottlecaps. 119 | 120 | ---------------------------------------------------- 121 | 122 | --4. CRUSHING BROKENCUP 123 | Config.brokencuplow = 5 -- Lowest number of skillchecks to crush broken cups. 124 | Config.brokencuphigh = 7 -- Highest number of skillchecks to crush broken cups. 125 | Config.brokencuptimelow = 6 -- Lowest time (in seconds) to crush broken cups. 126 | Config.brokencuptimehigh = 10 -- Highest time (in seconds) to crush broken cups. 127 | 128 | --If using "mz-skills" the following XP parameters will apply: 129 | Config.brokencupXPlow = 4 -- Lowest amount of "Searching" XP gained from crushing broken cups. 130 | Config.brokencupXPhigh = 7 -- Highest amount of "Searching" XP gained from crushing broken cups. 131 | Config.brokencupXPloss = 3 -- Amount of "Searching" XP lost from failing to crush broken cups. 132 | 133 | --Inputs and outputs 134 | Config.brokencupamount = 3 -- Number of brokencup needed in order to be able to crush them. 135 | Config.brokencupreturnlow = 3 -- Lowest return for crushing broken cups. 136 | Config.brokencupreturnhigh = 7 -- Highest return for crushing broken cups. 137 | 138 | ---------------------------------------------------- 139 | 140 | --OBJECTS-- 141 | 142 | -- Trash objects player can interact with - add more props to this list if you wish to expand the bin searching function to those props 143 | Config.Objects = { 144 | "prop_dumpster_01a", 145 | "prop_dumpster_01a", 146 | "prop_dumpster_02a", 147 | "prop_dumpster_02b", 148 | } 149 | 150 | ----------------- 151 | --SELLING ITEMS-- 152 | ----------------- 153 | 154 | Config.SellLocation = { 155 | -- PLEASE NOTE: If you change this - be sure to also change the details for the "sellbinitems" boxZone in client/main.lua. 156 | -- Those details should match the details in this config variable. 157 | [1] = { 158 | coords = vector3(1703.29, 3779.5, 34.75), 159 | length = 1.2, 160 | width = 0.5, 161 | heading = 125, 162 | debugPoly = false, 163 | minZ = 32.15, 164 | maxZ = 36.15, 165 | distance = 1.0 166 | }, 167 | } 168 | 169 | -- NO MZ-SKILLS 170 | -- The following table applies if you are not using "mz-skills". 171 | 172 | Config.TrashItemsNOXP = { 173 | [1] = { 174 | item = "bottlecaps", 175 | price = 15 176 | }, 177 | [2] = { 178 | item = "ace", 179 | price = 50 180 | }, 181 | [3] = { 182 | item = "sunglasses", 183 | price = 60 184 | }, 185 | [4] = { 186 | item = "crayons", 187 | price = 70 188 | }, 189 | [5] = { 190 | item = "teddy", 191 | price = 85 192 | }, 193 | [6] = { 194 | item = "fabric", 195 | price = 100 196 | }, 197 | [7] = { 198 | item = "actiontoy", 199 | price = 130 200 | }, 201 | [8] = { 202 | item = "wd40", 203 | price = 150 204 | }, 205 | [9] = { 206 | item = "screwdriver", 207 | price = 170 208 | }, 209 | } 210 | 211 | --MZ-SKILLS 212 | --The following tables apply if you are using "mz-skills". The relevant table called depends on the amount of "Searching" XP a player has at the time of attempting to sell items found in bins. 213 | 214 | Config.TrashItems = { 215 | [1] = { 216 | item = "bottlecaps", 217 | price = 15 218 | }, 219 | [2] = { 220 | item = "ace", 221 | price = 50 222 | }, 223 | [3] = { 224 | item = "sunglasses", 225 | price = 60 226 | }, 227 | [4] = { 228 | item = "crayons", 229 | price = 70 230 | }, 231 | [5] = { 232 | item = "teddy", 233 | price = 85 234 | }, 235 | [6] = { 236 | item = "fabric", 237 | price = 100 238 | }, 239 | [7] = { 240 | item = "actiontoy", 241 | price = 130 242 | }, 243 | [8] = { 244 | item = "wd40", 245 | price = 150 246 | }, 247 | [9] = { 248 | item = "screwdriver", 249 | price = 170 250 | }, 251 | } 252 | 253 | Config.TrashItems2 = { -- 10% increase in price (off base prices) rounded to the nearest dollar 254 | [1] = { 255 | item = "bottlecaps", 256 | price = 17 257 | }, 258 | [2] = { 259 | item = "ace", 260 | price = 55 261 | }, 262 | [3] = { 263 | item = "sunglasses", 264 | price = 66 265 | }, 266 | [4] = { 267 | item = "crayons", 268 | price = 77 269 | }, 270 | [5] = { 271 | item = "teddy", 272 | price = 94 273 | }, 274 | [6] = { 275 | item = "fabric", 276 | price = 110 277 | }, 278 | [7] = { 279 | item = "actiontoy", 280 | price = 143 281 | }, 282 | [8] = { 283 | item = "wd40", 284 | price = 165 285 | }, 286 | [9] = { 287 | item = "screwdriver", 288 | price = 187 289 | }, 290 | } 291 | 292 | Config.TrashItems3 = { -- 20% increase in price (off base prices) rounded to the nearest dollar 293 | [1] = { 294 | item = "bottlecaps", 295 | price = 18 296 | }, 297 | [2] = { 298 | item = "ace", 299 | price = 60 300 | }, 301 | [3] = { 302 | item = "sunglasses", 303 | price = 72 304 | }, 305 | [4] = { 306 | item = "crayons", 307 | price = 84 308 | }, 309 | [5] = { 310 | item = "teddy", 311 | price = 102 312 | }, 313 | [6] = { 314 | item = "fabric", 315 | price = 120 316 | }, 317 | [7] = { 318 | item = "actiontoy", 319 | price = 156 320 | }, 321 | [8] = { 322 | item = "wd40", 323 | price = 180 324 | }, 325 | [9] = { 326 | item = "screwdriver", 327 | price = 204 328 | }, 329 | } 330 | 331 | Config.TrashItems4 = { -- 30% increase in price (off base prices) rounded to the nearest dollar 332 | [1] = { 333 | item = "bottlecaps", 334 | price = 20 335 | }, 336 | [2] = { 337 | item = "ace", 338 | price = 65 339 | }, 340 | [3] = { 341 | item = "sunglasses", 342 | price = 78 343 | }, 344 | [4] = { 345 | item = "crayons", 346 | price = 91 347 | }, 348 | [5] = { 349 | item = "teddy", 350 | price = 111 351 | }, 352 | [6] = { 353 | item = "fabric", 354 | price = 130 355 | }, 356 | [7] = { 357 | item = "actiontoy", 358 | price = 169 359 | }, 360 | [8] = { 361 | item = "wd40", 362 | price = 195 363 | }, 364 | [9] = { 365 | item = "screwdriver", 366 | price = 221 367 | }, 368 | } 369 | 370 | Config.TrashItems5 = { -- 40% increase in price (off base prices) rounded to the nearest dollar 371 | [1] = { 372 | item = "bottlecaps", 373 | price = 21 374 | }, 375 | [2] = { 376 | item = "ace", 377 | price = 70 378 | }, 379 | [3] = { 380 | item = "sunglasses", 381 | price = 84 382 | }, 383 | [4] = { 384 | item = "crayons", 385 | price = 98 386 | }, 387 | [5] = { 388 | item = "teddy", 389 | price = 119 390 | }, 391 | [6] = { 392 | item = "fabric", 393 | price = 140 394 | }, 395 | [7] = { 396 | item = "actiontoy", 397 | price = 182 398 | }, 399 | [8] = { 400 | item = "wd40", 401 | price = 210 402 | }, 403 | [9] = { 404 | item = "screwdriver", 405 | price = 238 406 | }, 407 | } 408 | 409 | Config.TrashItems6 = { -- 50% increase in price (off base prices) rounded to the nearest dollar 410 | [1] = { 411 | item = "bottlecaps", 412 | price = 23 413 | }, 414 | [2] = { 415 | item = "ace", 416 | price = 75 417 | }, 418 | [3] = { 419 | item = "sunglasses", 420 | price = 90 421 | }, 422 | [4] = { 423 | item = "crayons", 424 | price = 110 425 | }, 426 | [5] = { 427 | item = "teddy", 428 | price = 128 429 | }, 430 | [6] = { 431 | item = "fabric", 432 | price = 150 433 | }, 434 | [7] = { 435 | item = "actiontoy", 436 | price = 195 437 | }, 438 | [8] = { 439 | item = "wd40", 440 | price = 225 441 | }, 442 | [9] = { 443 | item = "screwdriver", 444 | price = 255 445 | }, 446 | } 447 | 448 | Config.TrashItems7 = { -- 60% increase in price (off base prices) rounded to the nearest dollar 449 | [1] = { 450 | item = "bottlecaps", 451 | price = 24 452 | }, 453 | [2] = { 454 | item = "ace", 455 | price = 80 456 | }, 457 | [3] = { 458 | item = "sunglasses", 459 | price = 96 460 | }, 461 | [4] = { 462 | item = "crayons", 463 | price = 112 464 | }, 465 | [5] = { 466 | item = "teddy", 467 | price = 136 468 | }, 469 | [6] = { 470 | item = "fabric", 471 | price = 160 472 | }, 473 | [7] = { 474 | item = "actiontoy", 475 | price = 208 476 | }, 477 | [8] = { 478 | item = "wd40", 479 | price = 240 480 | }, 481 | [9] = { 482 | item = "screwdriver", 483 | price = 272 484 | }, 485 | } 486 | 487 | Config.TrashItems8 = { -- 75% increase in price (off base prices) rounded to the nearest dollar 488 | [1] = { 489 | item = "bottlecaps", 490 | price = 27 491 | }, 492 | [2] = { 493 | item = "ace", 494 | price = 88 495 | }, 496 | [3] = { 497 | item = "sunglasses", 498 | price = 105 499 | }, 500 | [4] = { 501 | item = "crayons", 502 | price = 123 503 | }, 504 | [5] = { 505 | item = "teddy", 506 | price = 149 507 | }, 508 | [6] = { 509 | item = "fabric", 510 | price = 175 511 | }, 512 | [7] = { 513 | item = "actiontoy", 514 | price = 228 515 | }, 516 | [8] = { 517 | item = "wd40", 518 | price = 263 519 | }, 520 | [9] = { 521 | item = "screwdriver", 522 | price = 298 523 | }, 524 | } 525 | 526 | Config.TrashItems9 = { -- 100% increase in price (off base prices) rounded to the nearest dollar 527 | [1] = { 528 | item = "bottlecaps", 529 | price = 30 530 | }, 531 | [2] = { 532 | item = "ace", 533 | price = 100 534 | }, 535 | [3] = { 536 | item = "sunglasses", 537 | price = 120 538 | }, 539 | [4] = { 540 | item = "crayons", 541 | price = 140 542 | }, 543 | [5] = { 544 | item = "teddy", 545 | price = 170 546 | }, 547 | [6] = { 548 | item = "fabric", 549 | price = 200 550 | }, 551 | [7] = { 552 | item = "actiontoy", 553 | price = 260 554 | }, 555 | [8] = { 556 | item = "wd40", 557 | price = 300 558 | }, 559 | [9] = { 560 | item = "screwdriver", 561 | price = 340 562 | }, 563 | } -------------------------------------------------------------------------------- /server/main.lua: -------------------------------------------------------------------------------- 1 | local QBCore = exports['qb-core']:GetCoreObject() 2 | 3 | local ItemList = { 4 | ["sodacan"] = "sodacan", 5 | ["emptybottle"] = "emptybottle", 6 | ["bottlecaps"] = "bottlecaps", 7 | ["brokencup"] = "brokencup", 8 | ["wallet"] = "wallet", 9 | } 10 | 11 | QBCore.Functions.CreateCallback('mz-bins:getItem', function(source, cb, binCheck) 12 | if not binCheck then 13 | local src = source 14 | local Player = QBCore.Functions.GetPlayer(src) 15 | local chance = math.random(1, 200) 16 | if chance > 0 and chance < 50 then 17 | Player.Functions.AddItem(QBCore.Shared.Items["sodacan"].name, 1) 18 | TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["sodacan"], "add") 19 | elseif chance > 49 and chance < 71 then 20 | Player.Functions.AddItem(QBCore.Shared.Items["bottlecaps"].name, 1) 21 | TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["bottlecaps"], "add") 22 | elseif chance > 70 and chance < 91 then 23 | Player.Functions.AddItem(QBCore.Shared.Items["emptybottle"].name, 1) 24 | TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["emptybottle"], "add") 25 | elseif chance > 90 and chance < 116 then 26 | Player.Functions.AddItem(QBCore.Shared.Items["brokencup"].name, 1) 27 | TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["brokencup"], "add") 28 | elseif chance > 115 and chance < 136 then 29 | Player.Functions.AddItem(QBCore.Shared.Items["ace"].name, 1) 30 | TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["ace"], "add") 31 | elseif chance > 135 and chance < 156 then 32 | Player.Functions.AddItem(QBCore.Shared.Items["crayons"].name, 1) 33 | TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["crayons"], "add") 34 | elseif chance > 155 and chance < 166 then 35 | Player.Functions.AddItem(QBCore.Shared.Items["sunglasses"].name, 1) 36 | TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["sunglasses"], "add") 37 | elseif chance > 166 and chance < 175 then 38 | Player.Functions.AddItem(QBCore.Shared.Items["teddy"].name, 1) 39 | TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["teddy"], "add") 40 | elseif chance > 174 and chance < 182 then 41 | Player.Functions.AddItem(QBCore.Shared.Items["fabric"].name, 1) 42 | TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["fabric"], "add") 43 | elseif chance > 181 and chance < 186 then 44 | Player.Functions.AddItem(QBCore.Shared.Items["actiontoy"].name, 1) 45 | TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["actiontoy"], "add") 46 | elseif chance > 185 and chance < 201 then 47 | Player.Functions.AddItem(QBCore.Shared.Items["bulletcasing"].name, 1) 48 | TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["bulletcasing"], "add") 49 | end 50 | if Config.NotifyType == 'qb' then 51 | TriggerClientEvent('QBCore:Notify', src, "This might be useful, nice!", 'success') 52 | elseif Config.NotifyType == "okok" then 53 | TriggerClientEvent('okokNotify:Alert', source, "YOU FOUND SOMETHING!", "This might be useful, nice!", 3500, 'success') 54 | end 55 | else 56 | print('Attempt to trigger "mz-bins:getItem" externally has been detected') 57 | end 58 | end) 59 | 60 | RegisterServerEvent('mz-bins:server:GetItemRare', function(binCheck) 61 | if not binCheck then 62 | local src = source 63 | local Player = QBCore.Functions.GetPlayer(src) 64 | local chance2 = math.random(1, 200) 65 | if chance2 > 0 and chance2 <= 3 then 66 | Player.Functions.AddItem(QBCore.Shared.Items[Config.Rareitem1].name, 1) 67 | TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[Config.Rareitem1], "add") 68 | if Config.NotifyType == 'qb' then 69 | TriggerClientEvent('QBCore:Notify', src, "Woah, you also found a "..Config.Rareitem1..".", 'success') 70 | elseif Config.NotifyType == "okok" then 71 | TriggerClientEvent('okokNotify:Alert', source, "NICE!", "Woah, you also found a "..Config.Rareitem1..".", 3500, 'success') 72 | end 73 | elseif chance2 > 3 and chance2 <= 5 then 74 | Player.Functions.AddItem(QBCore.Shared.Items[Config.Rareitem2].name, 1) 75 | TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[Config.Rareitem2], "add") 76 | if Config.NotifyType == 'qb' then 77 | TriggerClientEvent('QBCore:Notify', src, "Woah, you also found a "..Config.Rareitem2..".", 'success') 78 | elseif Config.NotifyType == "okok" then 79 | TriggerClientEvent('okokNotify:Alert', source, "NICE!", "Woah, you also found a "..Config.Rareitem2..".", 3500, 'success') 80 | end 81 | elseif chance2 == 6 then 82 | Player.Functions.AddItem(QBCore.Shared.Items[Config.Rareitem3].name, 1) 83 | TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[Config.Rareitem3], "add") 84 | if Config.NotifyType == 'qb' then 85 | TriggerClientEvent('QBCore:Notify', src, "Woah, you also found a "..Config.Rareitem3..".", 'success') 86 | elseif Config.NotifyType == "okok" then 87 | TriggerClientEvent('okokNotify:Alert', source, "NICE!", "Woah, you also found a "..Config.Rareitem3..".", 3500, 'success') 88 | end 89 | elseif chance2 == 7 then 90 | Player.Functions.AddItem(QBCore.Shared.Items[Config.Rareitem4].name, 1) 91 | TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[Config.Rareitem4], "add") 92 | if Config.NotifyType == 'qb' then 93 | TriggerClientEvent('QBCore:Notify', src, "Woah, you also found a "..Config.Rareitem4..".", 'success') 94 | elseif Config.NotifyType == "okok" then 95 | TriggerClientEvent('okokNotify:Alert', source, "NICE!", "Woah, you also found a "..Config.Rareitem4..".", 3500, 'success') 96 | end 97 | end 98 | else 99 | print('Attempt to trigger "mz-bins:server:GetItemRare" externally has been detected') 100 | end 101 | end) 102 | 103 | RegisterServerEvent('mz-bins:getItem', function() 104 | QBCore.Functions.BanInjection(source, 'mz-bins (getItem)') 105 | end) 106 | 107 | ------------ 108 | --CRAFTING-- 109 | ------------ 110 | 111 | ------------ 112 | --ALUMINUM-- 113 | ------------ 114 | 115 | RegisterServerEvent('mz-bins:server:BreakdownCans', function() 116 | local src = source 117 | local Player = QBCore.Functions.GetPlayer(src) 118 | local sodacan = Player.Functions.GetItemByName('sodacan') 119 | if Player.PlayerData.items ~= nil then 120 | if sodacan ~= nil then 121 | if sodacan.amount >= Config.cansamount then 122 | Player.Functions.RemoveItem("sodacan", Config.cansamount) 123 | TriggerClientEvent('inventory:client:ItemBox', source, QBCore.Shared.Items['sodacan'], "remove", Config.cansamount) 124 | TriggerClientEvent("mz-bins:client:BreakdownCansMinigame", src) 125 | else 126 | TriggerClientEvent('mz-bins:client:emoteCancel', src) 127 | if Config.NotifyType == 'qb' then 128 | TriggerClientEvent('QBCore:Notify', src, "You do not have enough soda cans to press (Need "..Config.cansamount..")", 'error') 129 | elseif Config.NotifyType == "okok" then 130 | TriggerClientEvent('okokNotify:Alert', source, "NEED CANS", "You do not have enough soda cans to press (Need "..Config.cansamount..")", 3500, 'error') 131 | end 132 | end 133 | end 134 | end 135 | end) 136 | 137 | RegisterServerEvent('mz-bins:server:GetAluminum', function(alumniumCheck) 138 | if not alumniumCheck then 139 | local Player = QBCore.Functions.GetPlayer(source) 140 | local amount = math.random(Config.cansreturnlow, Config.cansreturnhigh) 141 | Player.Functions.AddItem("aluminum", amount) 142 | TriggerClientEvent('inventory:client:ItemBox', source, QBCore.Shared.Items['aluminum'], "add", amount) 143 | else 144 | print('Attempt to trigger "mz-bins:server:GetAluminum" externally has been detected') 145 | end 146 | end) 147 | 148 | ------------ 149 | --PLASTIC-- 150 | ------------ 151 | 152 | RegisterServerEvent('mz-bins:server:BreakdownBottles', function() 153 | local src = source 154 | local Player = QBCore.Functions.GetPlayer(src) 155 | local emptybottle = Player.Functions.GetItemByName('emptybottle') 156 | if Player.PlayerData.items ~= nil then 157 | if emptybottle ~= nil then 158 | if emptybottle.amount >= Config.bottlesamount then 159 | Player.Functions.RemoveItem("emptybottle", Config.bottlesamount) 160 | TriggerClientEvent('inventory:client:ItemBox', source, QBCore.Shared.Items['emptybottle'], "remove", Config.bottlesamount) 161 | TriggerClientEvent("mz-bins:client:BreakdownBottlesMinigame", src) 162 | else 163 | TriggerClientEvent('mz-bins:client:emoteCancel', src) 164 | if Config.NotifyType == 'qb' then 165 | TriggerClientEvent('QBCore:Notify', src, "You do not have enough empty bottles to crush (Need "..Config.bottlesamount..")", 'error') 166 | elseif Config.NotifyType == "okok" then 167 | TriggerClientEvent('okokNotify:Alert', source, "NEED BOTTLES", "You do not have enough empty bottles to crush (Need "..Config.bottlesamount..")", 3500, 'error') 168 | end 169 | end 170 | end 171 | end 172 | end) 173 | 174 | RegisterServerEvent('mz-bins:server:GetPlastic', function(plasticCheck) 175 | if not plasticCheck then 176 | local Player = QBCore.Functions.GetPlayer(source) 177 | local amount = math.random(Config.bottlesreturnlow, Config.bottlesreturnhigh) 178 | Player.Functions.AddItem("plastic", amount) 179 | TriggerClientEvent('inventory:client:ItemBox', source, QBCore.Shared.Items['plastic'], "add", amount) 180 | else 181 | print('Attempt to trigger "mz-bins:server:GetPlastic" externally has been detected') 182 | end 183 | end) 184 | 185 | ------------- 186 | --PLASTIC 2-- 187 | ------------- 188 | 189 | RegisterServerEvent('mz-bins:server:BreakdownBottlecaps', function() 190 | local src = source 191 | local Player = QBCore.Functions.GetPlayer(src) 192 | local bottlecaps = Player.Functions.GetItemByName('bottlecaps') 193 | if Player.PlayerData.items ~= nil then 194 | if bottlecaps ~= nil then 195 | if bottlecaps.amount >= Config.bottlecapsamount then 196 | Player.Functions.RemoveItem("bottlecaps", Config.bottlecapsamount) 197 | TriggerClientEvent('inventory:client:ItemBox', source, QBCore.Shared.Items['bottlecaps'], "remove", Config.bottlecapsamount) 198 | TriggerClientEvent("mz-bins:client:BreakdownBottlecapsMinigame", src) 199 | else 200 | TriggerClientEvent('mz-bins:client:emoteCancel', src) 201 | if Config.NotifyType == 'qb' then 202 | TriggerClientEvent('QBCore:Notify', src, "You do not have enough empty bottles to crush (Need "..Config.bottlecapsamount..")", 'error') 203 | elseif Config.NotifyType == "okok" then 204 | TriggerClientEvent('okokNotify:Alert', source, "NEED BOTTLES", "You do not have enough empty bottles to crush (Need "..Config.bottlecapsamount..")", 3500, 'error') 205 | end 206 | end 207 | end 208 | end 209 | end) 210 | 211 | RegisterServerEvent('mz-bins:server:GetPlastic2', function(plasticCheck) 212 | if not plasticCheck then 213 | local Player = QBCore.Functions.GetPlayer(source) 214 | local amount = math.random(Config.bottlecapsreturnlow, Config.bottlecapsreturnhigh) 215 | Player.Functions.AddItem("plastic", amount) 216 | TriggerClientEvent('inventory:client:ItemBox', source, QBCore.Shared.Items['plastic'], "add", amount) 217 | else 218 | print('Attempt to trigger "mz-bins:server:GetPlastic2" externally has been detected') 219 | end 220 | end) 221 | 222 | --------- 223 | --GLASS-- 224 | --------- 225 | 226 | RegisterServerEvent('mz-bins:server:BreakdownCup', function() 227 | local src = source 228 | local Player = QBCore.Functions.GetPlayer(src) 229 | local brokencup = Player.Functions.GetItemByName('brokencup') 230 | if Player.PlayerData.items ~= nil then 231 | if brokencup ~= nil then 232 | if brokencup.amount >= Config.brokencupamount then 233 | Player.Functions.RemoveItem("brokencup", Config.brokencupamount) 234 | TriggerClientEvent('inventory:client:ItemBox', source, QBCore.Shared.Items['brokencup'], "remove", Config.brokencupamount) 235 | TriggerClientEvent("mz-bins:client:BreakdownBrokencupMinigame", src) 236 | else 237 | TriggerClientEvent('mz-bins:client:emoteCancel', src) 238 | if Config.NotifyType == 'qb' then 239 | TriggerClientEvent('QBCore:Notify', src, "You do not have enough glass cups (Need "..Config.brokencupamount..")", 'error') 240 | elseif Config.NotifyType == "okok" then 241 | TriggerClientEvent('okokNotify:Alert', source, "NEED CUPS", "You do not have enough glass cups (Need "..Config.brokencupamount..")", 3500, 'error') 242 | end 243 | end 244 | end 245 | end 246 | end) 247 | 248 | RegisterServerEvent('mz-bins:server:GetGlass', function(glassCheck) 249 | if not glassCheck then 250 | local Player = QBCore.Functions.GetPlayer(source) 251 | local amount = math.random(Config.brokencupreturnlow , Config.brokencupreturnhigh) 252 | Player.Functions.AddItem("glass", amount) 253 | TriggerClientEvent('inventory:client:ItemBox', source, QBCore.Shared.Items['glass'], "add", amount) 254 | else 255 | print('Attempt to trigger "mz-bins:server:GetGlass" externally has been detected') 256 | end 257 | end) 258 | 259 | ---------- 260 | --TRADER-- 261 | ---------- 262 | 263 | QBCore.Functions.CreateCallback('mz-bins:server:getInv', function(source, cb) 264 | local Player = QBCore.Functions.GetPlayer(source) 265 | local inventory = Player.PlayerData.items 266 | return cb(inventory) 267 | end) 268 | 269 | RegisterNetEvent("mz-bins:server:sellTrashItems", function(itemName, itemAmount, itemPrice) 270 | local src = source 271 | local Player = QBCore.Functions.GetPlayer(src) 272 | local totalPrice = (tonumber(itemAmount) * itemPrice) 273 | if Player.Functions.RemoveItem(itemName, tonumber(itemAmount)) then 274 | Player.Functions.AddMoney("cash", totalPrice) 275 | if Config.NotifyType == "qb" then 276 | TriggerClientEvent("QBCore:Notify", src, Lang:t('success.sold', {value = tonumber(itemAmount), value2 = QBCore.Shared.Items[itemName].label, value3 = totalPrice}), 'success') 277 | elseif Config.NotifyType == "okok" then 278 | TriggerClientEvent('okokNotify:Alert', source, "SOLD!", Lang:t('success.sold', {value = tonumber(itemAmount), value2 = QBCore.Shared.Items[itemName].label, value3 = totalPrice}), 3500, 'success') 279 | end 280 | TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[itemName], 'remove') 281 | else 282 | if Config.NotifyType == "qb" then 283 | TriggerClientEvent("QBCore:Notify", src, Lang:t('error.no_items'), "error") 284 | elseif Config.NotifyType == "okok" then 285 | TriggerClientEvent('okokNotify:Alert', source, "WRONG ITEMS?", "You do not have the necessary items", 3500, 'error') 286 | end 287 | end 288 | end) 289 | 290 | ----------- 291 | --WALLETS-- 292 | ----------- 293 | 294 | QBCore.Functions.CreateUseableItem("wallet", function(source, item) 295 | TriggerClientEvent("mz-bins:client:walletOpen", source, item.name) 296 | end) 297 | 298 | RegisterServerEvent('mz-bins:server:walletReward', function() 299 | local src = source 300 | local Player = QBCore.Functions.GetPlayer(src) 301 | local wallet = Player.Functions.GetItemByName('wallet') 302 | local walletcash = math.random(1, 500) 303 | local chancey = math.random(1, 10) 304 | if chancey < 3 then 305 | Player.Functions.AddMoney("cash", walletcash) 306 | if Config.NotifyType == "qb" then 307 | TriggerClientEvent("QBCore:Notify", src, "Hey, you found some cash! Nice!", "success", 3500) 308 | elseif Config.NotifyType == "okok" then 309 | TriggerClientEvent('okokNotify:Alert', source, "CASH FOUND", "You found some cash! Nice!", 3500, 'success') 310 | end 311 | elseif chancey > 2 and chancey < 7 then 312 | if Config.NotifyType == "qb" then 313 | TriggerClientEvent("QBCore:Notify", src, "Found a note 'Be good to your mother' ...") 314 | elseif Config.NotifyType == "okok" then 315 | TriggerClientEvent('okokNotify:Alert', source, "META FOUND", "Found a note 'Be good to your mother' ...", 3500, 'success') 316 | end 317 | elseif chancey > 6 and chancey < 11 then 318 | if Config.NotifyType == "qb" then 319 | TriggerClientEvent("QBCore:Notify", src, "Empty... It came from a bin, what did you expect?", "error", 3500) 320 | elseif Config.NotifyType == "okok" then 321 | TriggerClientEvent('okokNotify:Alert', source, "NOTHING HERE", "Empty... It came from a bin, what did you expect?", 3500, 'error') 322 | end 323 | end 324 | Player.Functions.RemoveItem("wallet", 1) 325 | TriggerClientEvent('inventory:client:ItemBox', source, QBCore.Shared.Items['wallet'], "remove", 1) 326 | end) 327 | 328 | ------ 329 | --XP-- 330 | ------ 331 | 332 | QBCore.Functions.CreateUseableItem(Config.DualXPitem, function(source, item) 333 | TriggerClientEvent("mz-bins:client:XPBuff", source, item.name) 334 | local src = source 335 | local Player = QBCore.Functions.GetPlayer(src) 336 | Player.Functions.RemoveItem(Config.DualXPitem, 1) 337 | TriggerClientEvent('inventory:client:ItemBox', source, QBCore.Shared.Items[Config.DualXPitem], "remove", 1) 338 | end) -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /client/main.lua: -------------------------------------------------------------------------------- 1 | local QBCore = exports['qb-core']:GetCoreObject() 2 | 3 | local PlayerData = {} 4 | local isLoggedIn = false 5 | local percent = false 6 | local searching = false 7 | local isInVehicle = false 8 | local NeededAttempts = 0 9 | local SucceededAttempts = 0 10 | local FailedAttemps = 0 11 | local craftcheck = false 12 | local craftprocesscheck = false 13 | 14 | local dualXP = false 15 | local binparse 16 | 17 | local hascans = false 18 | local hasbottles = false 19 | local hasbottlecaps = false 20 | local hascups = false 21 | 22 | cachedBins = {} 23 | 24 | closestBin = { 25 | 'prop_dumpster_01a', 26 | 'prop_dumpster_02a', 27 | 'prop_dumpster_02b', 28 | 'prop_dumpster_3a' 29 | } 30 | 31 | AddEventHandler('onResourceStart', function(resource) 32 | if GetCurrentResourceName() == resource then 33 | PlayerJob = QBCore.Functions.GetPlayerData().job 34 | TriggerEvent('mz-bins:client:NoCrafting') 35 | while binparse do 36 | if QBCore.Functions.HasItem("sodacan") then 37 | hascans = true 38 | else 39 | hascans = false 40 | end 41 | if QBCore.Functions.HasItem("emptybottle") then 42 | hasbottles = true 43 | else 44 | hasbottles = false 45 | end 46 | if QBCore.Functions.HasItem("bottlecaps") then 47 | hasbottlecaps = true 48 | else 49 | hasbottlecaps = false 50 | end 51 | if QBCore.Functions.HasItem("brokencup") then 52 | hascups = true 53 | else 54 | hascups = false 55 | end 56 | Wait(2000) 57 | end 58 | end 59 | end) 60 | 61 | RegisterNetEvent("QBCore:Client:OnPlayerLoaded", function() 62 | PlayerJob = QBCore.Functions.GetPlayerData().job 63 | isLoggedIn = true 64 | end) 65 | 66 | CreateThread(function() 67 | exports['qb-target']:AddBoxZone("craftbinparts", vector3(-1156.22, -1999.3, 13.18), 3.8, 1, { 68 | name = "craftbinparts", 69 | heading = 314, 70 | debugPoly = false, 71 | minZ = 9.78, 72 | maxZ = 13.78, 73 | }, { 74 | options = { 75 | { 76 | num = 1, 77 | type = "client", 78 | event = "mz-bins:client:BreakdownCans", 79 | icon = 'fas fa-compress-alt', 80 | label = 'Process old cans', 81 | canInteract = function() 82 | return hascans 83 | end, 84 | }, 85 | { 86 | num = 2, 87 | type = "client", 88 | event = "mz-bins:client:BreakdownBottles", 89 | icon = 'fas fa-wine-bottle', 90 | label = 'Crush empty bottles', 91 | canInteract = function() 92 | return hasbottles 93 | end, 94 | }, 95 | { 96 | num = 3, 97 | type = "client", 98 | event = "mz-bins:client:BreakdownBottlecaps", 99 | icon = 'fa-solid fa-circle', 100 | label = 'Process bottlecaps', 101 | canInteract = function() 102 | return hasbottlecaps 103 | end, 104 | }, 105 | { 106 | num = 4, 107 | type = "client", 108 | event = "mz-bins:client:BreakdownCup", 109 | icon = 'fas fa-glass', 110 | label = 'Process glass', 111 | canInteract = function() 112 | return hascups 113 | end, 114 | }, 115 | { 116 | num = 5, 117 | type = "client", 118 | event = "mz-bins:client:NoCrafting", 119 | icon = 'fas fa-glass', 120 | label = 'Do you have materials to process?', 121 | canInteract = function() 122 | return (not hascans) and (not hasbottles) and (not hascups) and (not hasbottlecaps) 123 | end, 124 | }, 125 | }, 126 | distance = 1.2, 127 | }) 128 | end) 129 | 130 | DrawText3Ds = function(x, y, z, text) 131 | SetTextScale(0.35, 0.35) 132 | SetTextFont(4) 133 | SetTextProportional(1) 134 | SetTextColour(255, 255, 255, 215) 135 | SetTextEntry("STRING") 136 | SetTextCentre(true) 137 | AddTextComponentString(text) 138 | SetDrawOrigin(x,y,z, 0) 139 | DrawText(0.0, 0.0) 140 | local factor = (string.len(text)) / 370 141 | DrawRect(0.0, 0.0+0.0125, 0.017+ factor, 0.03, 0, 0, 0, 75) 142 | ClearDrawOrigin() 143 | end 144 | 145 | RegisterNetEvent("mz-bins:client:XPBuff", function() 146 | TriggerEvent('animations:client:EmoteCommandStart', {"drink"}) 147 | local drinktime = math.random(4000, 6000) 148 | QBCore.Functions.Progressbar("grind_coke", Lang:t('progress.binjuice'), drinktime, false, true, { 149 | disableMovement = true, 150 | disableCarMovement = true, 151 | disableMouse = false, 152 | disableCombat = true, 153 | }, {}, {}, {}, function() -- Done 154 | if Config.NotifyType == 'qb' then 155 | QBCore.Functions.Notify(Lang:t('success.binjuice'), "success", 3500) 156 | elseif Config.NotifyType == 'okok' then 157 | exports['okokNotify']:Alert(Lang:t('label.binjuice'), Lang:t('success.binjuice'), 3500, "success") 158 | end 159 | TriggerEvent('animations:client:EmoteCommandStart', {"c"}) 160 | dualXP = true 161 | Wait(1000 * 60 * Config.dualXPtime) 162 | dualXP = false 163 | end, function() -- Cancel 164 | TriggerEvent('animations:client:EmoteCommandStart', {"c"}) 165 | if Config.NotifyType == 'qb' then 166 | QBCore.Functions.Notify(Lang:t('error.cancelled'), "error", 3500) 167 | elseif Config.NotifyType == "okok" then 168 | exports['okokNotify']:Alert(Lang:t('label.cancelled'), Lang:t('error.cancelled'), 3500, "error") 169 | end 170 | end) 171 | end) 172 | 173 | RegisterNetEvent("mz-bins:SearchBin", function() 174 | local playerPed = PlayerPedId() 175 | local playerCoords = GetEntityCoords(playerPed) 176 | TriggerEvent('animations:client:EmoteCommandStart', {"mechanic"}) 177 | for i = 1, #closestBin do 178 | local x = GetClosestObjectOfType(playerCoords, 1.0, GetHashKey(closestBin[i]), false, false, false) 179 | local entity = nil 180 | if DoesEntityExist(x) and not IsPedSittingInAnyVehicle(PlayerPedId()) then 181 | entity = x 182 | if not cachedBins[entity] then 183 | if not searching then 184 | searching = true 185 | if Config.skillcheck then 186 | exports['ps-ui']:Circle(function(success) 187 | if success then 188 | TriggerEvent('animations:client:EmoteCommandStart', {"c"}) 189 | openBin(entity) 190 | Wait(2000) 191 | if Config.mzskills then 192 | local BetterXP = math.random(Config.diveXPlow, Config.diveXPhigh) 193 | local xpmultiple = math.random(1, 4) 194 | if xpmultiple > 3 then 195 | chance = BetterXP 196 | elseif xpmultiple < 4 then 197 | chance = Config.diveXPlow 198 | end 199 | if not dualXP then 200 | exports["mz-skills"]:UpdateSkill(Config.BinSkill, chance) 201 | elseif dualXP then 202 | exports["mz-skills"]:UpdateSkill(Config.BinSkill, (chance * 2)) 203 | end 204 | end 205 | else 206 | TriggerEvent('animations:client:EmoteCommandStart', {"c"}) 207 | if Config.NotifyType == 'qb' then 208 | QBCore.Functions.Notify(Lang:t('error.skillfail'), "error", 3500) 209 | elseif Config.NotifyType == 'okok' then 210 | exports['okokNotify']:Alert(Lang:t('label.skillfail'), Lang:t('error.skillfail'), 3500, "error") 211 | end 212 | Wait(1000) 213 | if Config.mzskills then 214 | local deteriorate = -Config.diveXPloss 215 | exports["mz-skills"]:UpdateSkill(Config.BinSkill, deteriorate) 216 | Wait(800) 217 | if Config.NotifyType == 'qb' then 218 | QBCore.Functions.Notify(Lang:t('error.xpdown', {value = Config.diveXPloss, value2 = Config.BinSkill}), "error", 3500) 219 | elseif Config.NotifyType == "okok" then 220 | exports['okokNotify']:Alert(Lang:t('label.mzskills'), Lang:t('error.xpdown', {value = Config.diveXPloss, value2 = Config.BinSkill}), 3500, "error") 221 | end 222 | end 223 | searching = false 224 | end 225 | end, Config.diveparse, Config.diveparsetime) 226 | elseif not Config.skillcheck then 227 | openBin(entity) 228 | Wait(2000) 229 | if Config.mzskills then 230 | local BetterXP = math.random(Config.diveXPlow, Config.diveXPhigh) 231 | local xpmultiple = math.random(1, 4) 232 | if xpmultiple > 3 then 233 | chance = BetterXP 234 | elseif xpmultiple < 4 then 235 | chance = Config.diveXPlow 236 | end 237 | if not dualXP then 238 | exports["mz-skills"]:UpdateSkill(Config.BinSkill, chance) 239 | elseif dualXP then 240 | exports["mz-skills"]:UpdateSkill(Config.BinSkill, (chance * 2)) 241 | end 242 | end 243 | end 244 | else 245 | if Config.NotifyType == 'qb' then 246 | QBCore.Functions.Notify(Lang:t('error.doingtask'),"error", 3500) 247 | elseif Config.NotifyType == "okok" then 248 | exports['okokNotify']:Alert(Lang:t('label.doingtask'), Lang:t('error.doingtask'), 3500, "error") 249 | end 250 | end 251 | else 252 | TriggerEvent('animations:client:EmoteCommandStart', {"c"}) 253 | if Config.NotifyType == 'qb' then 254 | QBCore.Functions.Notify(Lang:t('error.searched'),"error", 3500) 255 | elseif Config.NotifyType == "okok" then 256 | exports['okokNotify']:Alert(Lang:t('label.searched'), Lang:t('error.searched'), 3500, "error") 257 | end 258 | end 259 | end 260 | end 261 | end) 262 | 263 | Citizen.CreateThread(function() 264 | Citizen.Wait(100) 265 | while true do 266 | local sleep = 1000 267 | if percent then 268 | local playerPed = PlayerPedId() 269 | local playerCoords = GetEntityCoords(playerPed) 270 | for i = 1, #closestBin do 271 | local x = GetClosestObjectOfType(playerCoords, 1.0, GetHashKey(closestBin[i]), false, false, false) 272 | local entity = nil 273 | if DoesEntityExist(x) then 274 | sleep = 5 275 | entity = x 276 | bin = GetEntityCoords(entity) 277 | DrawText3Ds(bin.x, bin.y, bin.z + 1.5, TimeLeft .. '~g~%~s~') 278 | break 279 | end 280 | end 281 | end 282 | Citizen.Wait(sleep) 283 | end 284 | end) 285 | 286 | Citizen.CreateThread(function() 287 | while true do 288 | Citizen.Wait(0) 289 | if searching then 290 | DisableControlAction(0, 73) 291 | end 292 | end 293 | end) 294 | 295 | local binCheck = true 296 | 297 | openBin = function(entity) 298 | local LowTime = (Config.SearchTimeLow * 1000) 299 | local HighTime = (Config.SearchTimeHigh * 1000) 300 | local searchtime = math.random(LowTime, HighTime) 301 | QBCore.Functions.Progressbar("search_register", Lang:t('progress.searching'), searchtime, false, true, { 302 | disableMovement = true, 303 | disableCarMovement = true, 304 | disableMouse = false, 305 | disableCombat = true, 306 | DisableControlAction(0, 170, true), 307 | }, { 308 | animDict = "amb@prop_human_bum_bin@base", 309 | anim = "base", 310 | flags = 50, 311 | }, {}, {}, function() -- Done 312 | searching = true 313 | cachedBins[entity] = true 314 | if Config.FailEnabled then 315 | local bindivechance = math.random(1, 100) 316 | if Config.FailChance >= bindivechance then 317 | if Config.NotifyType == 'qb' then 318 | QBCore.Functions.Notify(Lang:t('error.failfind'), "error", 3500) 319 | elseif Config.NotifyType == "okok" then 320 | exports['okokNotify']:Alert(Lang:t('label.failfind'), Lang:t('error.failfind'), 3500, "error") 321 | end 322 | searching = false 323 | else 324 | binCheck = false 325 | QBCore.Functions.TriggerCallback('mz-bins:getItem', function(result, binCheck) 326 | end) 327 | binCheck = true 328 | if Config.rareitems then 329 | Wait(1000) 330 | binCheck = false 331 | TriggerServerEvent('mz-bins:server:GetItemRare', binCheck) 332 | binCheck = true 333 | end 334 | searching = false 335 | end 336 | elseif not Config.FailEnabled then 337 | binCheck = false 338 | QBCore.Functions.TriggerCallback('mz-bins:getItem', function(result, binCheck) 339 | end) 340 | binCheck = true 341 | if Config.rareitems then 342 | Wait(1000) 343 | binCheck = false 344 | TriggerServerEvent('mz-bins:server:GetItemRare', binCheck) 345 | binCheck = false 346 | end 347 | searching = false 348 | end 349 | ClearPedTasks(PlayerPedId()) 350 | StopAnimTask(PlayerPedId(), "amb@prop_human_bum_bin@base", "base", 1.0) 351 | searching = false 352 | end, function() -- Cancel 353 | StopAnimTask(PlayerPedId(), "amb@prop_human_bum_bin@base", "base", 1.0) 354 | ClearPedTasks(PlayerPedId()) 355 | if Config.NotifyType == 'qb' then 356 | QBCore.Functions.Notify(Lang:t('error.cancelled'), "error", 3500) 357 | elseif Config.NotifyType == "okok" then 358 | exports['okokNotify']:Alert(Lang:t('label.cancelled'), Lang:t('error.cancelled'), 3500, "error") 359 | end 360 | end) 361 | end 362 | 363 | ------------ 364 | --CRAFTING-- 365 | ------------ 366 | 367 | local Working = false 368 | 369 | -------------------- 370 | --BREAK DOWN PARTS-- 371 | -------------------- 372 | 373 | RegisterNetEvent('mz-bins:client:emoteCancel', function() 374 | TriggerEvent('animations:client:EmoteCommandStart', {"c"}) 375 | end) 376 | 377 | ------------ 378 | --ALUMINUM-- 379 | ------------ 380 | 381 | RegisterNetEvent('mz-bins:client:BreakdownCans', function() 382 | if not Working then 383 | if QBCore.Functions.HasItem("sodacan") then 384 | TriggerEvent('animations:client:EmoteCommandStart', {"mechanic"}) 385 | TriggerServerEvent("mz-bins:server:BreakdownCans") 386 | else 387 | hascans = false 388 | local requiredItems = { 389 | [1] = {name = QBCore.Shared.Items["sodacan"]["name"], image = QBCore.Shared.Items["sodacan"]["image"]}, 390 | } 391 | if Config.NotifyType == 'qb' then 392 | QBCore.Functions.Notify(Lang:t('error.needcans'),"error", 3500) 393 | elseif Config.NotifyType == "okok" then 394 | exports['okokNotify']:Alert(Lang:t('label.needcans'), Lang:t('error.needcans'), 3500, "error") 395 | end 396 | TriggerEvent('inventory:client:requiredItems', requiredItems, true) 397 | Wait(3000) 398 | TriggerEvent('inventory:client:requiredItems', requiredItems, false) 399 | end 400 | else 401 | if Config.NotifyType == 'qb' then 402 | QBCore.Functions.Notify(Lang:t('error.doingtask'),"error", 3500) 403 | elseif Config.NotifyType == "okok" then 404 | exports['okokNotify']:Alert(Lang:t('label.doingtask'), Lang:t('error.doingtask'), 3500, "error") 405 | end 406 | end 407 | end) 408 | 409 | RegisterNetEvent('mz-bins:client:BreakdownCansMinigame', function(source) 410 | Working = true 411 | hascans = false 412 | TriggerEvent('animations:client:EmoteCommandStart', {"mechanic"}) 413 | if Config.CraftSkillCheck then 414 | BreakdownCansMinigame(source) 415 | else 416 | BreakCansProcess() 417 | end 418 | end) 419 | 420 | function BreakdownCansMinigame(source) 421 | local Skillbar = exports['qb-skillbar']:GetSkillbarObject() 422 | if NeededAttempts == 0 then 423 | NeededAttempts = math.random(Config.canslow, Config.canshigh) 424 | end 425 | local maxwidth = 30 426 | local maxduration = 3000 427 | Skillbar.Start({ 428 | duration = math.random(1400, 1500), 429 | pos = math.random(15, 30), 430 | width = math.random(13, 17), 431 | }, function() 432 | if SucceededAttempts + 1 >= NeededAttempts then 433 | BreakCansProcess() 434 | Wait(500) 435 | if Config.NotifyType == 'qb' then 436 | QBCore.Functions.Notify(Lang:t('success.presscans'), "success", 3500) 437 | elseif Config.NotifyType == "okok" then 438 | exports['okokNotify']:Alert(Lang:t('label.presscans'), Lang:t('success.presscans'), 3500, "success") 439 | end 440 | Wait(500) 441 | FailedAttemps = 0 442 | SucceededAttempts = 0 443 | NeededAttempts = 0 444 | else 445 | SucceededAttempts = SucceededAttempts + 1 446 | Skillbar.Repeat({ 447 | duration = math.random(1200, 1500), 448 | pos = math.random(10, 30), 449 | width = math.random(11, 12), 450 | }) 451 | end 452 | end, function() 453 | if Config.NotifyType == 'qb' then 454 | QBCore.Functions.Notify(Lang:t('error.cansruined'),"error", 3500) 455 | elseif Config.NotifyType == "okok" then 456 | exports['okokNotify']:Alert(Lang:t('label.cansruined'), Lang:t('error.cansruined'), 3500, "error") 457 | end 458 | Wait(500) 459 | if Config.mzskills then 460 | local deteriorate = -Config.cansXPloss 461 | exports["mz-skills"]:UpdateSkill(Config.BinSkill, deteriorate) 462 | if Config.NotifyType == 'qb' then 463 | QBCore.Functions.Notify(Lang:t('error.cansxpdown', {value = Config.cansXPloss, value2 = Config.BinSkill}), "error", 3500) 464 | elseif Config.NotifyType == "okok" then 465 | exports['okokNotify']:Alert(Lang:t('label.mzskills'), Lang:t('error.cansxpdown', {value = Config.cansXPloss, value2 = Config.BinSkill}), 3500, "error") 466 | end 467 | end 468 | FailedAttemps = 0 469 | SucceededAttempts = 0 470 | NeededAttempts = 0 471 | craftprocesscheck = false 472 | Working = false 473 | ClearPedTasks(PlayerPedId()) 474 | end) 475 | end 476 | 477 | local alumniumCheck = true 478 | 479 | function BreakCansProcess() 480 | local canstime = math.random(Config.canstimelow*1000, Config.canstimehigh*1000) 481 | QBCore.Functions.Progressbar("grind_coke", Lang:t('progress.canspress'), canstime, false, true, { 482 | disableMovement = true, 483 | disableCarMovement = true, 484 | disableMouse = false, 485 | disableCombat = true, 486 | }, {}, {}, {}, function() -- Done 487 | alumniumCheck = false 488 | TriggerServerEvent("mz-bins:server:GetAluminum", alumniumCheck) 489 | alumniumCheck = true 490 | TriggerEvent('animations:client:EmoteCommandStart', {"c"}) 491 | ClearPedTasks(PlayerPedId()) 492 | Working = false 493 | Wait(1000) 494 | if Config.mzskills then 495 | local BetterXP = math.random(Config.cansXPlow, Config.cansXPhigh) 496 | local multiplier = math.random(1, 4) 497 | if multiplier >= 3 then 498 | skillup = BetterXP 499 | else 500 | skillup = Config.cansXPlow 501 | end 502 | exports["mz-skills"]:UpdateSkill(Config.BinSkill, skillup) 503 | end 504 | craftcheck = false 505 | end, function() -- Cancel 506 | Working = false 507 | ClearPedTasks(PlayerPedId()) 508 | if Config.NotifyType == 'qb' then 509 | QBCore.Functions.Notify(Lang:t('error.cancelled'), "error", 3500) 510 | elseif Config.NotifyType == "okok" then 511 | exports['okokNotify']:Alert(Lang:t('label.cancelled'), Lang:t('error.cancelled'), 3500, "error") 512 | end 513 | end) 514 | end 515 | 516 | ------------ 517 | --PLASTIC-- 518 | ------------ 519 | 520 | local plasticCheck = true 521 | 522 | RegisterNetEvent('mz-bins:client:BreakdownBottles', function() 523 | if not Working then 524 | if QBCore.Functions.HasItem("emptybottle") then 525 | TriggerEvent('animations:client:EmoteCommandStart', {"mechanic"}) 526 | TriggerServerEvent("mz-bins:server:BreakdownBottles") 527 | else 528 | hasbottles = false 529 | local requiredItems = { 530 | [1] = {name = QBCore.Shared.Items["emptybottle"]["name"], image = QBCore.Shared.Items["emptybottle"]["image"]}, 531 | } 532 | if Config.NotifyType == 'qb' then 533 | QBCore.Functions.Notify(Lang:t('error.needbottles'), "error", 3500) 534 | elseif Config.NotifyType == "okok" then 535 | exports['okokNotify']:Alert(Lang:t('label.needbottles'), Lang:t('error.needbottles'), 3500, "error") 536 | end 537 | TriggerEvent('inventory:client:requiredItems', requiredItems, true) 538 | Wait(3000) 539 | TriggerEvent('inventory:client:requiredItems', requiredItems, false) 540 | end 541 | else 542 | if Config.NotifyType == 'qb' then 543 | QBCore.Functions.Notify(Lang:t('error.doingtask'),"error", 3500) 544 | elseif Config.NotifyType == "okok" then 545 | exports['okokNotify']:Alert(Lang:t('label.doingtask'), Lang:t('error.doingtask'), 3500, "error") 546 | end 547 | end 548 | end) 549 | 550 | RegisterNetEvent('mz-bins:client:BreakdownBottlesMinigame', function(source) 551 | Working = true 552 | hasbottles = false 553 | TriggerEvent('animations:client:EmoteCommandStart', {"mechanic"}) 554 | if Config.CraftSkillCheck then 555 | BreakdownBottlesMinigame(source) 556 | else 557 | BreakBottlesProcess() 558 | end 559 | end) 560 | 561 | function BreakdownBottlesMinigame(source) 562 | local Skillbar = exports['qb-skillbar']:GetSkillbarObject() 563 | if NeededAttempts == 0 then 564 | NeededAttempts = math.random(Config.bottleslow, Config.bottleshigh) 565 | end 566 | local maxwidth = 30 567 | local maxduration = 3000 568 | Skillbar.Start({ 569 | duration = math.random(1400, 1500), 570 | pos = math.random(15, 30), 571 | width = math.random(13, 17), 572 | }, function() 573 | if SucceededAttempts + 1 >= NeededAttempts then 574 | BreakBottlesProcess() 575 | Wait(500) 576 | if Config.NotifyType == 'qb' then 577 | QBCore.Functions.Notify(Lang:t('success.crushbottles'), "success", 3500) 578 | elseif Config.NotifyType == "okok" then 579 | exports['okokNotify']:Alert(Lang:t('label.crushbottles'), Lang:t('success.crushbottles'), 3500, "success") 580 | end 581 | FailedAttemps = 0 582 | SucceededAttempts = 0 583 | NeededAttempts = 0 584 | else 585 | SucceededAttempts = SucceededAttempts + 1 586 | Skillbar.Repeat({ 587 | duration = math.random(1200, 1500), 588 | pos = math.random(10, 30), 589 | width = math.random(11, 12), 590 | }) 591 | end 592 | end, function() 593 | if Config.NotifyType == 'qb' then 594 | QBCore.Functions.Notify(Lang:t('error.bottlesruined'),"error", 3500) 595 | elseif Config.NotifyType == "okok" then 596 | exports['okokNotify']:Alert(Lang:t('label.bottlesruined'), Lang:t('error.bottlesruined'), 3500, "error") 597 | end 598 | Wait(500) 599 | if Config.mzskills then 600 | local deteriorate = -Config.bottlesXPloss 601 | exports["mz-skills"]:UpdateSkill(Config.BinSkill, deteriorate) 602 | if Config.NotifyType == 'qb' then 603 | QBCore.Functions.Notify(Lang:t('error.bottlesxpdown', {value = Config.bottlesXPloss, value2 = Config.BinSkill}), "error", 3500) 604 | elseif Config.NotifyType == "okok" then 605 | exports['okokNotify']:Alert(Lang:t('label.mzskills'), Lang:t('error.bottlesxpdown', {value = Config.bottlesXPloss, value2 = Config.BinSkill}), 3500, "error") 606 | end 607 | end 608 | FailedAttemps = 0 609 | SucceededAttempts = 0 610 | NeededAttempts = 0 611 | craftprocesscheck = false 612 | Working = false 613 | ClearPedTasks(PlayerPedId()) 614 | end) 615 | end 616 | 617 | function BreakBottlesProcess() 618 | local bottlestime = math.random(Config.bottlestimelow*1000, Config.bottlestimehigh*1000) 619 | QBCore.Functions.Progressbar("grind_coke", Lang:t('progress.crushbottles'), bottlestime, false, true, { 620 | disableMovement = true, 621 | disableCarMovement = true, 622 | disableMouse = false, 623 | disableCombat = true, 624 | }, {}, {}, {}, function() -- Done 625 | plasticCheck = false 626 | TriggerServerEvent("mz-bins:server:GetPlastic", plasticCheck) 627 | plasticCheck = true 628 | TriggerEvent('animations:client:EmoteCommandStart', {"c"}) 629 | ClearPedTasks(PlayerPedId()) 630 | craftcheck = false 631 | Working = false 632 | Wait(500) 633 | if Config.mzskills then 634 | local BetterXP = math.random(Config.bottlesXPlow, Config.bottlesXPhigh) 635 | local multiplier = math.random(1, 4) 636 | if multiplier >= 3 then 637 | skillup = BetterXP 638 | else 639 | skillup = Config.bottlesXPlow 640 | end 641 | exports["mz-skills"]:UpdateSkill(Config.BinSkill, skillup) 642 | end 643 | end, function() -- Cancel 644 | Working = false 645 | ClearPedTasks(PlayerPedId()) 646 | if Config.NotifyType == 'qb' then 647 | QBCore.Functions.Notify(Lang:t('error.cancelled'), "error", 3500) 648 | elseif Config.NotifyType == "okok" then 649 | exports['okokNotify']:Alert(Lang:t('label.cancelled'), Lang:t('error.cancelled'), 3500, "error") 650 | end 651 | end) 652 | end 653 | 654 | ------------- 655 | --PLASTIC 2-- 656 | ------------- 657 | 658 | RegisterNetEvent('mz-bins:client:BreakdownBottlecaps', function() 659 | if not Working then 660 | if QBCore.Functions.HasItem("bottlecaps") then 661 | TriggerEvent('animations:client:EmoteCommandStart', {"mechanic"}) 662 | TriggerServerEvent("mz-bins:server:BreakdownBottlecaps") 663 | else 664 | hasbottlecaps = false 665 | local requiredItems = { 666 | [1] = {name = QBCore.Shared.Items["bottlecaps"]["name"], image = QBCore.Shared.Items["bottlecaps"]["image"]}, 667 | } 668 | if Config.NotifyType == 'qb' then 669 | QBCore.Functions.Notify(Lang:t('error.needcaps'), "error", 3500) 670 | elseif Config.NotifyType == "okok" then 671 | exports['okokNotify']:Alert(Lang:t('label.needcaps'), Lang:t('error.needcaps'), 3500, "error") 672 | end 673 | TriggerEvent('inventory:client:requiredItems', requiredItems, true) 674 | Wait(3000) 675 | TriggerEvent('inventory:client:requiredItems', requiredItems, false) 676 | end 677 | else 678 | if Config.NotifyType == 'qb' then 679 | QBCore.Functions.Notify(Lang:t('error.doingtask'),"error", 3500) 680 | elseif Config.NotifyType == "okok" then 681 | exports['okokNotify']:Alert(Lang:t('label.doingtask'), Lang:t('error.doingtask'), 3500, "error") 682 | end 683 | end 684 | end) 685 | 686 | RegisterNetEvent('mz-bins:client:BreakdownBottlecapsMinigame', function(source) 687 | Working = true 688 | hasbottlecaps = false 689 | TriggerEvent('animations:client:EmoteCommandStart', {"mechanic"}) 690 | if Config.CraftSkillCheck then 691 | BreakdownBottlecapsMinigame(source) 692 | else 693 | BreakBottlesProcess() 694 | end 695 | end) 696 | 697 | function BreakdownBottlecapsMinigame(source) 698 | local Skillbar = exports['qb-skillbar']:GetSkillbarObject() 699 | if NeededAttempts == 0 then 700 | NeededAttempts = math.random(Config.bottlecapslow, Config.bottlecapshigh) 701 | end 702 | local maxwidth = 30 703 | local maxduration = 3000 704 | Skillbar.Start({ 705 | duration = math.random(1200, 1500), 706 | pos = math.random(14, 30), 707 | width = math.random(12, 15), 708 | }, function() 709 | if SucceededAttempts + 1 >= NeededAttempts then 710 | BreakBottlesProcess() 711 | Wait(500) 712 | if Config.NotifyType == 'qb' then 713 | QBCore.Functions.Notify(Lang:t('success.processcaps'), "success", 3500) 714 | elseif Config.NotifyType == "okok" then 715 | exports['okokNotify']:Alert(Lang:t('label.processcaps'), Lang:t('success.processcaps'), 3500, "success") 716 | end 717 | FailedAttemps = 0 718 | SucceededAttempts = 0 719 | NeededAttempts = 0 720 | else 721 | SucceededAttempts = SucceededAttempts + 1 722 | Skillbar.Repeat({ 723 | duration = math.random(1100, 1500), 724 | pos = math.random(10, 30), 725 | width = math.random(10, 12), 726 | }) 727 | end 728 | end, function() 729 | if Config.NotifyType == 'qb' then 730 | QBCore.Functions.Notify(Lang:t('error.capsruined'),"error", 3500) 731 | elseif Config.NotifyType == "okok" then 732 | exports['okokNotify']:Alert(Lang:t('label.capsruined'), Lang:t('error.capsruined'), 3500, "error") 733 | end 734 | Wait(500) 735 | if Config.mzskills then 736 | local deteriorate = -Config.bottlecapsXPloss 737 | exports["mz-skills"]:UpdateSkill(Config.BinSkill, deteriorate) 738 | if Config.NotifyType == 'qb' then 739 | QBCore.Functions.Notify(Lang:t('error.capsxpdown', {value = Config.bottlecapsXPloss, value2 = Config.BinSkill}), "error", 3500) 740 | elseif Config.NotifyType == "okok" then 741 | exports['okokNotify']:Alert(Lang:t('label.mzskills'), Lang:t('error.capsxpdown', {value = Config.bottlecapsXPloss, value2 = Config.BinSkill}), 3500, "error") 742 | end 743 | end 744 | FailedAttemps = 0 745 | SucceededAttempts = 0 746 | NeededAttempts = 0 747 | craftprocesscheck = false 748 | Working = false 749 | ClearPedTasks(PlayerPedId()) 750 | end) 751 | end 752 | 753 | function BreakBottlesProcess() 754 | local bottlecapstime = math.random(Config.bottlecapstimelow*1000, Config.bottlecapstimehigh*1000) 755 | QBCore.Functions.Progressbar("grind_coke", Lang:t('progress.processcaps'), bottlecapstime, false, true, { 756 | disableMovement = true, 757 | disableCarMovement = true, 758 | disableMouse = false, 759 | disableCombat = true, 760 | }, {}, {}, {}, function() -- Done 761 | plasticCheck = false 762 | TriggerServerEvent("mz-bins:server:GetPlastic2", plasticCheck) 763 | plasticCheck = true 764 | TriggerEvent('animations:client:EmoteCommandStart', {"c"}) 765 | ClearPedTasks(PlayerPedId()) 766 | Working = false 767 | craftcheck = false 768 | Wait(500) 769 | if Config.mzskills then 770 | local BetterXP = math.random(Config.bottlecapsXPlow, Config.bottlecapsXPhigh) 771 | local multiplier = math.random(1, 4) 772 | if multiplier >= 3 then 773 | skillup = BetterXP 774 | else 775 | skillup = Config.bottlecapsXPlow 776 | end 777 | exports["mz-skills"]:UpdateSkill(Config.BinSkill, skillup) 778 | end 779 | end, function() -- Cancel 780 | openingDoor = false 781 | Working = false 782 | ClearPedTasks(PlayerPedId()) 783 | if Config.NotifyType == 'qb' then 784 | QBCore.Functions.Notify(Lang:t('error.cancelled'), "error", 3500) 785 | elseif Config.NotifyType == "okok" then 786 | exports['okokNotify']:Alert(Lang:t('label.cancelled'), Lang:t('error.cancelled'), 3500, "error") 787 | end 788 | end) 789 | end 790 | 791 | --------- 792 | --GLASS-- 793 | --------- 794 | 795 | local glassCheck = true 796 | 797 | RegisterNetEvent('mz-bins:client:BreakdownCup', function() 798 | if not Working then 799 | if QBCore.Functions.HasItem("brokencup") then 800 | TriggerEvent('animations:client:EmoteCommandStart', {"mechanic"}) 801 | TriggerServerEvent("mz-bins:server:BreakdownCup") 802 | else 803 | hascups = false 804 | local requiredItems = { 805 | [1] = {name = QBCore.Shared.Items["brokencup"]["name"], image = QBCore.Shared.Items["brokencup"]["image"]}, 806 | } 807 | if Config.NotifyType == 'qb' then 808 | QBCore.Functions.Notify(Lang:t('error.needcups'),"error", 3500) 809 | elseif Config.NotifyType == "okok" then 810 | exports['okokNotify']:Alert(Lang:t('label.needcups'), Lang:t('error.needcups'), 3500, "error") 811 | end 812 | TriggerEvent('inventory:client:requiredItems', requiredItems, true) 813 | Wait(3000) 814 | TriggerEvent('inventory:client:requiredItems', requiredItems, false) 815 | end 816 | else 817 | if Config.NotifyType == 'qb' then 818 | QBCore.Functions.Notify(Lang:t('error.doingtask'),"error", 3500) 819 | elseif Config.NotifyType == "okok" then 820 | exports['okokNotify']:Alert(Lang:t('label.doingtask'), Lang:t('error.doingtask'), 3500, "error") 821 | end 822 | end 823 | end) 824 | 825 | RegisterNetEvent('mz-bins:client:BreakdownBrokencupMinigame', function(source) 826 | Working = true 827 | hascups = false 828 | TriggerEvent('animations:client:EmoteCommandStart', {"mechanic"}) 829 | if Config.CraftSkillCheck then 830 | BreakdownBrokencupMinigame(source) 831 | else 832 | BreakBrokencupProcess() 833 | end 834 | end) 835 | 836 | function BreakdownBrokencupMinigame(source) 837 | local Skillbar = exports['qb-skillbar']:GetSkillbarObject() 838 | if NeededAttempts == 0 then 839 | NeededAttempts = math.random(Config.brokencuplow, Config.brokencuphigh) 840 | end 841 | local maxwidth = 30 842 | local maxduration = 3000 843 | Skillbar.Start({ 844 | duration = math.random(1200, 1500), 845 | pos = math.random(14, 30), 846 | width = math.random(12, 15), 847 | }, function() 848 | if SucceededAttempts + 1 >= NeededAttempts then 849 | BreakBrokencupProcess() 850 | Wait(500) 851 | if Config.NotifyType == 'qb' then 852 | QBCore.Functions.Notify(Lang:t('success.workcups'),"error", 3500) 853 | elseif Config.NotifyType == "okok" then 854 | exports['okokNotify']:Alert(Lang:t('label.workcups'), Lang:t('success.workcups'), 3500, "error") 855 | end 856 | FailedAttemps = 0 857 | SucceededAttempts = 0 858 | NeededAttempts = 0 859 | else 860 | SucceededAttempts = SucceededAttempts + 1 861 | Skillbar.Repeat({ 862 | duration = math.random(1100, 1500), 863 | pos = math.random(10, 30), 864 | width = math.random(10, 12), 865 | }) 866 | end 867 | end, function() 868 | if Config.NotifyType == 'qb' then 869 | QBCore.Functions.Notify(Lang:t('error.cupsruined'),"error", 3500) 870 | elseif Config.NotifyType == "okok" then 871 | exports['okokNotify']:Alert(Lang:t('label.cupsruined'), Lang:t('error.cupsruined'), 3500, "error") 872 | end 873 | Wait(500) 874 | if Config.mzskills then 875 | local deteriorate = -Config.brokencupXPloss 876 | exports["mz-skills"]:UpdateSkill(Config.BinSkill, deteriorate) 877 | if Config.NotifyType == 'qb' then 878 | QBCore.Functions.Notify(Lang:t('error.cupsxpdown', {value = Config.brokencupXPloss, value2 = Config.BinSkill}), "error", 3500) 879 | elseif Config.NotifyType == "okok" then 880 | exports['okokNotify']:Alert(Lang:t('label.mzskills'), Lang:t('error.cupsxpdown', {value = Config.brokencupXPloss, value2 = Config.BinSkill}), 3500, "error") 881 | end 882 | end 883 | FailedAttemps = 0 884 | SucceededAttempts = 0 885 | NeededAttempts = 0 886 | craftprocesscheck = false 887 | Working = false 888 | ClearPedTasks(PlayerPedId()) 889 | end) 890 | end 891 | 892 | function BreakBrokencupProcess() 893 | local brokencuptime = math.random(Config.brokencuptimelow*1000, Config.brokencuptimehigh*1000) 894 | QBCore.Functions.Progressbar("grind_coke", Lang:t('progress.processcups'), brokencuptime, false, true, { 895 | disableMovement = true, 896 | disableCarMovement = true, 897 | disableMouse = false, 898 | disableCombat = true, 899 | }, {}, {}, {}, function() -- Done 900 | glassCheck = false 901 | TriggerServerEvent("mz-bins:server:GetGlass", glassCheck) 902 | glassCheck = true 903 | TriggerEvent('animations:client:EmoteCommandStart', {"c"}) 904 | ClearPedTasks(PlayerPedId()) 905 | craftcheck = false 906 | Working = false 907 | Wait(500) 908 | if Config.mzskills then 909 | local BetterXP = math.random(Config.brokencupXPlow, Config.brokencupXPhigh) 910 | local multiplier = math.random(1, 4) 911 | if multiplier >= 3 then 912 | skillup = BetterXP 913 | else 914 | skillup = Config.brokencupXPlow 915 | end 916 | exports["mz-skills"]:UpdateSkill(Config.BinSkill, skillup) 917 | end 918 | end, function() -- Cancel 919 | Working = false 920 | ClearPedTasks(PlayerPedId()) 921 | if Config.NotifyType == 'qb' then 922 | QBCore.Functions.Notify(Lang:t('error.cancelled'), "error", 3500) 923 | elseif Config.NotifyType == "okok" then 924 | exports['okokNotify']:Alert(Lang:t('label.cancelled'), Lang:t('error.cancelled'), 3500, "error") 925 | end 926 | end) 927 | end 928 | 929 | ------------ 930 | --NO CRAFT-- 931 | ------------ 932 | 933 | local loadparse = true 934 | 935 | RegisterNetEvent('mz-bins:client:NoCrafting', function() 936 | if QBCore.Functions.HasItem("sodacan") then 937 | hascans = true 938 | end 939 | if QBCore.Functions.HasItem("emptybottle") then 940 | hasbottles = true 941 | end 942 | if QBCore.Functions.HasItem("bottlecaps") then 943 | hasbottlecaps = true 944 | end 945 | if QBCore.Functions.HasItem("brokencup") then 946 | hascups = true 947 | end 948 | if not loadparse then 949 | if hascans or hasbottles or hasbottlecaps or hascups then 950 | if Config.NotifyType == 'qb' then 951 | QBCore.Functions.Notify(Lang:t('success.yescraft'),"success", 3500) 952 | elseif Config.NotifyType == "okok" then 953 | exports['okokNotify']:Alert(Lang:t('label.yescraft'), Lang:t('success.yescraft'), 3500, "success") 954 | end 955 | else 956 | if Config.NotifyType == 'qb' then 957 | QBCore.Functions.Notify(Lang:t('error.nocraft'),"error", 3500) 958 | elseif Config.NotifyType == "okok" then 959 | exports['okokNotify']:Alert(Lang:t('label.nocraft'), Lang:t('error.nocraft'), 3500, "error") 960 | end 961 | end 962 | end 963 | loadparse = false 964 | end) 965 | 966 | -------------- 967 | --SELL ITEMS-- 968 | -------------- 969 | 970 | RegisterNetEvent('mz-bins:client:menuSelect', function() 971 | if Config.mzskills then 972 | local lvl8 = false 973 | local lvl7 = false 974 | local lvl6 = false 975 | local lvl5 = false 976 | local lvl4 = false 977 | local lvl3 = false 978 | local lvl2 = false 979 | local lvl1 = false 980 | local lvl0 = false 981 | --Skill check call for config.menu prices on items 982 | exports["mz-skills"]:CheckSkill(Config.BinSkill, 12800, function(hasskill) 983 | if hasskill then lvl8 = true end 984 | end) 985 | exports["mz-skills"]:CheckSkill(Config.BinSkill, 6400, function(hasskill) 986 | if hasskill then lvl7 = true end 987 | end) 988 | exports["mz-skills"]:CheckSkill(Config.BinSkill, 3200, function(hasskill) 989 | if hasskill then lvl6 = true end 990 | end) 991 | exports["mz-skills"]:CheckSkill(Config.BinSkill, 1600, function(hasskill) 992 | if hasskill then lvl5 = true end 993 | end) 994 | exports["mz-skills"]:CheckSkill(Config.BinSkill, 800, function(hasskill) 995 | if hasskill then lvl4 = true end 996 | end) 997 | exports["mz-skills"]:CheckSkill(Config.BinSkill, 400, function(hasskill) 998 | if hasskill then lvl3 = true end 999 | end) 1000 | exports["mz-skills"]:CheckSkill(Config.BinSkill, 200, function(hasskill) 1001 | if hasskill then lvl2 = true end 1002 | end) 1003 | exports["mz-skills"]:CheckSkill(Config.BinSkill, 100, function(hasskill) 1004 | if hasskill then lvl1 = true end 1005 | end) 1006 | exports["mz-skills"]:CheckSkill(Config.BinSkill, 0, function(hasskill) 1007 | if hasskill then lvl0 = true end 1008 | end) 1009 | if lvl8 then 1010 | TriggerEvent('mz-bins:client:openMenu9') 1011 | Wait(1000) 1012 | if Config.NotifyType == 'qb' then 1013 | QBCore.Functions.Notify(Lang:t('info.menu9'),"info", 3500) 1014 | elseif Config.NotifyType == "okok" then 1015 | exports['okokNotify']:Alert(Lang:t('label.menu9'), Lang:t('info.menu9'), 3500, "info") 1016 | end 1017 | elseif lvl7 then 1018 | TriggerEvent('mz-bins:client:openMenu8') 1019 | Wait(1000) 1020 | if Config.NotifyType == 'qb' then 1021 | QBCore.Functions.Notify(Lang:t('info.menu8'),"info", 3500) 1022 | elseif Config.NotifyType == "okok" then 1023 | exports['okokNotify']:Alert(Lang:t('label.menu8'), Lang:t('info.menu8'), 3500, "info") 1024 | end 1025 | elseif lvl6 then 1026 | TriggerEvent('mz-bins:client:openMenu7') 1027 | Wait(1000) 1028 | if Config.NotifyType == 'qb' then 1029 | QBCore.Functions.Notify(Lang:t('info.menu7'),"info", 3500) 1030 | elseif Config.NotifyType == "okok" then 1031 | exports['okokNotify']:Alert(Lang:t('label.menu7'), Lang:t('info.menu7'), 3500, "info") 1032 | end 1033 | elseif lvl5 then 1034 | TriggerEvent('mz-bins:client:openMenu6') 1035 | Wait(1000) 1036 | if Config.NotifyType == 'qb' then 1037 | QBCore.Functions.Notify(Lang:t('info.menu6'),"info", 3500) 1038 | elseif Config.NotifyType == "okok" then 1039 | exports['okokNotify']:Alert(Lang:t('label.menu6'), Lang:t('info.menu6'), 3500, "info") 1040 | end 1041 | elseif lvl4 then 1042 | TriggerEvent('mz-bins:client:openMenu5') 1043 | Wait(1000) 1044 | if Config.NotifyType == 'qb' then 1045 | QBCore.Functions.Notify(Lang:t('info.menu5'),"info", 3500) 1046 | elseif Config.NotifyType == "okok" then 1047 | exports['okokNotify']:Alert(Lang:t('label.menu5'), Lang:t('info.menu5'), 3500, "info") 1048 | end 1049 | elseif lvl3 then 1050 | TriggerEvent('mz-bins:client:openMenu4') 1051 | Wait(1000) 1052 | if Config.NotifyType == 'qb' then 1053 | QBCore.Functions.Notify(Lang:t('info.menu4'),"info", 3500) 1054 | elseif Config.NotifyType == "okok" then 1055 | exports['okokNotify']:Alert(Lang:t('label.menu4'), Lang:t('info.menu4'), 3500, "info") 1056 | end 1057 | elseif lvl2 then 1058 | TriggerEvent('mz-bins:client:openMenu3') 1059 | Wait(1000) 1060 | if Config.NotifyType == 'qb' then 1061 | QBCore.Functions.Notify(Lang:t('info.menu3'),"info", 3500) 1062 | elseif Config.NotifyType == "okok" then 1063 | exports['okokNotify']:Alert(Lang:t('label.menu3'), Lang:t('info.menu3'), 3500, "info") 1064 | end 1065 | elseif lvl1 then 1066 | TriggerEvent('mz-bins:client:openMenu2') 1067 | Wait(1000) 1068 | if Config.NotifyType == 'qb' then 1069 | QBCore.Functions.Notify(Lang:t('info.menu2'),"info", 3500) 1070 | elseif Config.NotifyType == "okok" then 1071 | exports['okokNotify']:Alert(Lang:t('label.menu2'), Lang:t('info.menu2'), 3500, "info") 1072 | end 1073 | elseif lvl0 then 1074 | TriggerEvent('mz-bins:client:openMenu') 1075 | end 1076 | elseif not Config.mzskills then 1077 | TriggerEvent('mz-bins:client:openMenuNOXP') 1078 | end 1079 | end) 1080 | 1081 | RegisterNetEvent('mz-bins:client:openMenuNOXP', function() 1082 | local pawnShop = { 1083 | { 1084 | header = "Trash 'n Treasure", 1085 | isMenuHeader = true, 1086 | }, 1087 | { 1088 | header = "Your trash...", 1089 | txt = "... is our treasure!", 1090 | params = { 1091 | event = "mz-bins:client:openPawn", 1092 | args = { 1093 | items = Config.TrashItemsNOXP 1094 | } 1095 | } 1096 | } 1097 | } 1098 | exports['qb-menu']:openMenu(pawnShop) 1099 | end) 1100 | 1101 | RegisterNetEvent('mz-bins:client:openMenu', function() 1102 | local pawnShop = { 1103 | { 1104 | header = "Trash 'n Treasure", 1105 | isMenuHeader = true, 1106 | }, 1107 | { 1108 | header = "Your trash...", 1109 | txt = "... is our treasure!", 1110 | params = { 1111 | event = "mz-bins:client:openPawn", 1112 | args = { 1113 | items = Config.TrashItems 1114 | } 1115 | } 1116 | } 1117 | } 1118 | exports['qb-menu']:openMenu(pawnShop) 1119 | end) 1120 | 1121 | RegisterNetEvent('mz-bins:client:openMenu2', function() 1122 | local pawnShop = { 1123 | { 1124 | header = "Trash 'n Treasure", 1125 | isMenuHeader = true, 1126 | }, 1127 | { 1128 | header = "Your trash...", 1129 | txt = "... is our treasure!", 1130 | params = { 1131 | event = "mz-bins:client:openPawn", 1132 | args = { 1133 | items = Config.TrashItems2 1134 | } 1135 | } 1136 | } 1137 | } 1138 | exports['qb-menu']:openMenu(pawnShop) 1139 | end) 1140 | 1141 | RegisterNetEvent('mz-bins:client:openMenu3', function() 1142 | local pawnShop = { 1143 | { 1144 | header = "Trash 'n Treasure", 1145 | isMenuHeader = true, 1146 | }, 1147 | { 1148 | header = "Your trash...", 1149 | txt = "... is our treasure!", 1150 | params = { 1151 | event = "mz-bins:client:openPawn", 1152 | args = { 1153 | items = Config.TrashItems3 1154 | } 1155 | } 1156 | } 1157 | } 1158 | exports['qb-menu']:openMenu(pawnShop) 1159 | end) 1160 | 1161 | RegisterNetEvent('mz-bins:client:openMenu4', function() 1162 | local pawnShop = { 1163 | { 1164 | header = "Trash 'n Treasure", 1165 | isMenuHeader = true, 1166 | }, 1167 | { 1168 | header = "Your trash...", 1169 | txt = "... is our treasure!", 1170 | params = { 1171 | event = "mz-bins:client:openPawn", 1172 | args = { 1173 | items = Config.TrashItems4 1174 | } 1175 | } 1176 | } 1177 | } 1178 | exports['qb-menu']:openMenu(pawnShop) 1179 | end) 1180 | 1181 | RegisterNetEvent('mz-bins:client:openMenu5', function() 1182 | local pawnShop = { 1183 | { 1184 | header = "Trash 'n Treasure", 1185 | isMenuHeader = true, 1186 | }, 1187 | { 1188 | header = "Your trash...", 1189 | txt = "... is our treasure!", 1190 | params = { 1191 | event = "mz-bins:client:openPawn", 1192 | args = { 1193 | items = Config.TrashItems5 1194 | } 1195 | } 1196 | } 1197 | } 1198 | exports['qb-menu']:openMenu(pawnShop) 1199 | end) 1200 | 1201 | RegisterNetEvent('mz-bins:client:openMenu6', function() 1202 | local pawnShop = { 1203 | { 1204 | header = "Trash 'n Treasure", 1205 | isMenuHeader = true, 1206 | }, 1207 | { 1208 | header = "Your trash...", 1209 | txt = "... is our treasure!", 1210 | params = { 1211 | event = "mz-bins:client:openPawn", 1212 | args = { 1213 | items = Config.TrashItems6 1214 | } 1215 | } 1216 | } 1217 | } 1218 | exports['qb-menu']:openMenu(pawnShop) 1219 | end) 1220 | 1221 | RegisterNetEvent('mz-bins:client:openMenu7', function() 1222 | local pawnShop = { 1223 | { 1224 | header = "Trash 'n Treasure", 1225 | isMenuHeader = true, 1226 | }, 1227 | { 1228 | header = "Your trash...", 1229 | txt = "... is our treasure!", 1230 | params = { 1231 | event = "mz-bins:client:openPawn", 1232 | args = { 1233 | items = Config.TrashItems7 1234 | } 1235 | } 1236 | } 1237 | } 1238 | exports['qb-menu']:openMenu(pawnShop) 1239 | end) 1240 | 1241 | RegisterNetEvent('mz-bins:client:openMenu8', function() 1242 | local pawnShop = { 1243 | { 1244 | header = "Trash 'n Treasure", 1245 | isMenuHeader = true, 1246 | }, 1247 | { 1248 | header = "Your trash...", 1249 | txt = "... is our treasure!", 1250 | params = { 1251 | event = "mz-bins:client:openPawn", 1252 | args = { 1253 | items = Config.TrashItems8 1254 | } 1255 | } 1256 | } 1257 | } 1258 | exports['qb-menu']:openMenu(pawnShop) 1259 | end) 1260 | 1261 | RegisterNetEvent('mz-bins:client:openPawn', function(data) 1262 | QBCore.Functions.TriggerCallback('mz-bins:server:getInv', function(inventory) 1263 | local PlyInv = inventory 1264 | local pawnMenu = { 1265 | { 1266 | header = "Trash 'n Treasure", 1267 | isMenuHeader = true, 1268 | } 1269 | } 1270 | for _, v in pairs(PlyInv) do 1271 | for i = 1, #data.items do 1272 | if v.name == data.items[i].item then 1273 | pawnMenu[#pawnMenu + 1] = { 1274 | header = QBCore.Shared.Items[v.name].label, 1275 | txt = Lang:t('info.sell_items', { value = data.items[i].price }), 1276 | params = { 1277 | event = 'mz-bins:client:pawnitems', 1278 | args = { 1279 | label = QBCore.Shared.Items[v.name].label, 1280 | price = data.items[i].price, 1281 | name = v.name, 1282 | amount = v.amount 1283 | } 1284 | } 1285 | } 1286 | end 1287 | end 1288 | end 1289 | pawnMenu[#pawnMenu + 1] = { 1290 | header = Lang:t('info.back'), 1291 | params = { 1292 | event = 'mz-bins:client:openMenu' 1293 | } 1294 | } 1295 | exports['qb-menu']:openMenu(pawnMenu) 1296 | end) 1297 | end) 1298 | 1299 | RegisterNetEvent('mz-bins:client:pawnitems', function(item) 1300 | local sellingItem = exports['qb-input']:ShowInput({ 1301 | header = Lang:t('info.title'), 1302 | submitText = Lang:t('info.sell'), 1303 | inputs = { 1304 | { 1305 | type = 'number', 1306 | isRequired = false, 1307 | name = 'amount', 1308 | text = Lang:t('info.max', { value = item.amount }) 1309 | } 1310 | } 1311 | }) 1312 | if sellingItem then 1313 | if not sellingItem.amount then 1314 | return 1315 | end 1316 | if tonumber(sellingItem.amount) > 0 then 1317 | TriggerServerEvent('mz-bins:server:sellTrashItems', item.name, sellingItem.amount, item.price) 1318 | else 1319 | if Config.NotifyType == 'qb' then 1320 | QBCore.Functions.Notify(Lang:t('error.negative'), 'error') 1321 | elseif Config.NotifyType == "okok" then 1322 | exports['okokNotify']:Alert(Lang:t('label.negative'), Lang:t('error.negative'), 3500, "error") 1323 | end 1324 | end 1325 | end 1326 | end) 1327 | 1328 | ----------- 1329 | --WALLETS-- 1330 | ----------- 1331 | 1332 | RegisterNetEvent('mz-bins:client:walletOpen', function(itemName) 1333 | TriggerEvent('animations:client:EmoteCommandStart', {"makeitrain"}) 1334 | QBCore.Functions.Progressbar("drink_something", "Opening Wallet", 3500, false, true, { 1335 | disableMovement = false, 1336 | disableCarMovement = false, 1337 | disableMouse = false, 1338 | disableCombat = true, 1339 | }, {}, {}, {}, function() -- Done 1340 | TriggerEvent('animations:client:EmoteCommandStart', {"c"}) 1341 | TriggerServerEvent("mz-bins:server:walletReward") 1342 | end) 1343 | end) 1344 | 1345 | ------------ 1346 | --BOXZONES-- 1347 | ------------ 1348 | 1349 | CreateThread(function() 1350 | exports['qb-target']:AddTargetModel(Config.Objects, { 1351 | options = { 1352 | { 1353 | type = "client", 1354 | event = "mz-bins:SearchBin", 1355 | parameters = {}, 1356 | icon = "fas fa-search", 1357 | label = "Search through trash", 1358 | job = { 1359 | ["unemployed"] = 0, 1360 | ["police"] = 0, 1361 | ["ambulance"] = 0, 1362 | ['realestate'] = 0, 1363 | ['taxi'] = 0, 1364 | ['bus'] = 0, 1365 | ['cardealer'] = 0, 1366 | ['mechanic'] = 0, 1367 | ['judge'] = 0, 1368 | ['lawyer'] = 0, 1369 | ['reporter'] = 0, 1370 | ['tow'] = 0, 1371 | ['vineyard'] = 0, 1372 | ['hotdog'] = 0, 1373 | } 1374 | }, 1375 | }, 1376 | distance = 1.0 1377 | }) 1378 | end) 1379 | 1380 | CreateThread(function() 1381 | exports['qb-target']:AddBoxZone("sellbinitems", vector3(1703.29, 3779.5, 34.75), 1.2, 0.5, { 1382 | name = "sellbinitems", 1383 | heading = 125, 1384 | debugPoly = false, 1385 | minZ = 32.15, 1386 | maxZ = 36.15, 1387 | }, { 1388 | options = { 1389 | { 1390 | type = "client", 1391 | event = "mz-bins:client:menuSelect", 1392 | icon = 'fas fa-trash', 1393 | label = 'Sell Items' 1394 | }, 1395 | }, 1396 | distance = 1.5, 1397 | }) 1398 | end) 1399 | 1400 | CreateThread(function() 1401 | for _, value in pairs(Config.SellLocation) do 1402 | local blip = AddBlipForCoord(value.coords.x, value.coords.y, value.coords.z) 1403 | SetBlipSprite(blip, 374) 1404 | SetBlipDisplay(blip, 4) 1405 | SetBlipScale(blip, 0.7) 1406 | SetBlipAsShortRange(blip, true) 1407 | SetBlipColour(blip, 8) 1408 | BeginTextCommandSetBlipName('STRING') 1409 | AddTextComponentSubstringPlayerName(Lang:t('info.title')) 1410 | EndTextCommandSetBlipName(blip) 1411 | end 1412 | end) --------------------------------------------------------------------------------