/mz-lumberjack

A progression (XP) based lumberjack job + crafting for QB-CORE based FiveM servers

Primary LanguageLuaGNU Lesser General Public License v2.1LGPL-2.1

MZ-LUMBERJACK - a progression (XP) based lumberjack job + crafting for QB-CORE based FiveM servers

Created by Mr_Zain#4139

PREVIEW

mz-lumberjack

Introduction

  • Chop down trees with your lumberjack axe and turn what you acquire into something that TJ's will acquire for good money.
  • Highly customisable via config, everything from whether your tree chopping uses skillchecks or not to the XP a player obtains for each function is completely customisable (and everything in between including skill parses, progressbar timings, cost of inputs and outputs and sale prices)
  • XP modifier via mz-skills applies for successful lumberjack function. More XP is awarded for successful crafting. The more XP a player has the better the chances of accessing more useful wood products.
  • Resmon 0.00 idle - optimised with no range checking
  • Customised to function with qb-core standard notifications + okokNotify notifications

-- v(2.0.0) Changes:

  • All lumber processing occurs at the same place now (making mulch bags is still performed elsewhere);
  • A blip appears for the lumber processing place (set via config) so that players do not get lost when trying to process lumber and lumber based products;
  • Can now disable the use of mz-skills entirely (rng returns adjusted for no level/skill check);
  • Optional Axe break chance + removal properly configured;
  • if using mz-skills, name of skill + skill gain + amount of XP to advance to the next level can all be set via config;
  • Wood chopping time can be adjusted via config and syncs with animation;
  • Anti-cheat checks added to address exploitation;
  • Removed obsolete event handlers and cleaned up other elements of code;

DEPENDENCIES

NOTE: You should have each of the dependencies other than qb-lock and mz-skills as part of a conventional qb-core install.

mz-skills - to track skill progress. All credit to Kings#4220 for the original qb-skillz now B1-skillz

progressbar

qb-target

OPTIONAL: You will need "plastic" and "rustynails" each of which is given by mz-bins and mz-scrap, respectively. If you are not running those resources, you will either need to add these items separately or replace them as crafting inputs. Both resources, like mz-skills, are freely available at:

mz-bins

mz-scrap

Installation Instruction

A. MZ-SKILLS

  1. If you do not already have mz-skills running in your server, ensure that mz-skills forms part of your running scripts.

  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 "Lumberjack" as well as other jobs)

B. QB-CORE/SHARED/ITEMS.LUA

  1. Add the following items to qb-core/shared/items.lua:
	--mz-lumberjack
	["thinlog"] 		 	 	 	 = {["name"] = "thinlog",           			["label"] = "Thin Pine Log",	 		["weight"] = 700, 		["type"] = "item", 		["image"] = "thinlog.png", 				["unique"] = false, 	["useable"] = false, 	["shouldClose"] = false,   ["combinable"] = nil,   ["description"] = "A freshly cut thin log of pine."},
    ["woodwedge"] 		 	 	 	 = {["name"] = "woodwedge",           			["label"] = "Log Wedge", 				["weight"] = 350,		["type"] = "item", 		["image"] = "woodwedge.png", 			["unique"] = false, 	["useable"] = false, 	["shouldClose"] = false,   ["combinable"] = nil,   ["description"] = "A wedge of a tree log, freshly cut and smelling like the forest."},
	["midlog"] 		 	 	 	 	 = {["name"] = "midlog",           				["label"] = "Medium Pine Log",	 		["weight"] = 1200,		["type"] = "item", 		["image"] = "midlog.png", 				["unique"] = false, 	["useable"] = false, 	["shouldClose"] = false,   ["combinable"] = nil,   ["description"] = "A medium weighted log of pine."},
	["thicklog"] 		 	 	 	 = {["name"] = "thicklog",           			["label"] = "Thick Pine Log",	 		["weight"] = 1550,		["type"] = "item", 		["image"] = "thicklog.png", 			["unique"] = false, 	["useable"] = false, 	["shouldClose"] = false,   ["combinable"] = nil,   ["description"] = "A thick, dense log of pine."},
    ["thickerlog"] 			 	 	 = {["name"] = "thickerlog", 					["label"] = "Thicker Pine Log", 		["weight"] = 2200, 		["type"] = "item", 		["image"] = "thickerlog.png", 			["unique"] = false, 	["useable"] = false, 	["shouldClose"] = false,   ["combinable"] = nil,   ["description"] = "The thickest cut of pine achievable with a hand axe."},
	["treebark"] 		 	 		 = {["name"] = "treebark",           			["label"] = "Tree Bark",	 			["weight"] = 200, 		["type"] = "item", 		["image"] = "treebark.png", 			["unique"] = false, 	["useable"] = false, 	["shouldClose"] = false,   ["combinable"] = nil,   ["description"] = "Wooden bark stripped away from what looks like a pine tree."},
    ["treemulch"] 		 	 	 	 = {["name"] = "treemulch",           			["label"] = "Wooden Mulch", 			["weight"] = 200,		["type"] = "item", 		["image"] = "treemulch.png", 			["unique"] = false, 	["useable"] = false, 	["shouldClose"] = false,   ["combinable"] = nil,   ["description"] = "An array of roughly cut wooden chunks for pulping purposes."},
	["emptymulchbag"] 		 	 	 = {["name"] = "emptymulchbag",           		["label"] = "Empty Mulch Bag",	 		["weight"] = 200,		["type"] = "item", 		["image"] = "emptymulchbag.png", 		["unique"] = false, 	["useable"] = false, 	["shouldClose"] = false,   ["combinable"] = nil,   ["description"] = "A tough and durable bag capable of holding many kilograms of product."},
	["mulchbag"] 		 	 	 	 = {["name"] = "mulchbag",           			["label"] = "Bag of Mulch",	 			["weight"] = 1200,		["type"] = "item", 		["image"] = "mulchbag.png", 			["unique"] = false, 	["useable"] = false, 	["shouldClose"] = false,   ["combinable"] = nil,   ["description"] = "A tough and heavy bag of tree mulch, ready to be sold."},
	["woodenplanks"] 		 	 	 = {["name"] = "woodenplanks",           		["label"] = "Wooden Planks",	 		["weight"] = 1100,		["type"] = "item", 		["image"] = "woodenplanks.png", 		["unique"] = false, 	["useable"] = true, 	["shouldClose"] = false,   ["combinable"] = nil,   ["description"] = "A bundle of 4x2 wooden planks with a variety of residential and commercial purposes."},
    ["woodenpallet"] 			 	 = {["name"] = "woodenpallet", 					["label"] = "Wooden Pallet", 			["weight"] = 1000, 		["type"] = "item", 		["image"] = "woodenpallet.png", 		["unique"] = false, 	["useable"] = false, 	["shouldClose"] = false,   ["combinable"] = nil,   ["description"] = "A sturdy pallet used in storage facilities in order for forklifts to move goods around a warehouse."},
  1. "plastic" should be a part of your default qb-core server, I have included optional additional items here if your server does not include them:
	['plastic'] 					 = {['name'] = 'plastic', 			  	  	  	['label'] = 'Plastic', 					['weight'] = 100, 		['type'] = 'item', 		['image'] = 'plastic.png', 				['unique'] = false, 	['useable'] = false, 	['shouldClose'] = false,   ['combinable'] = nil,   ['description'] = 'A neat piece which has been recycled. Plastic has a number of uses, what will you do with this?'},
	["rustynails"]         	 	 = {["name"] = "rustynails",         		["label"] = "Rusted Nails",    			["weight"] = 150,       ["type"] = "item",      ["image"] = "rustynails.png",     		["unique"] = false,     ["useable"] = true,     ["shouldClose"] = true,    ["combinable"] = nil,   ["description"] = "A collection of nails that have seen better days... Perhaps they can be cleaned?"},

C. IMAGES

  1. Add the images which appear in the "images" folder to your inventory images folder. For example, if you are using lj-inventory, add the images to: lj-inventory/html/images/

D. LUMBER AXE

  1. The resource will work regardless of what you call your axe, however, for aesthetic purposes, you can replace the item "weapon_battleaxe" with the following:
	['weapon_battleaxe'] 			 = {['name'] = 'weapon_battleaxe', 		 	  	['label'] = 'Lumber Axe', 				['weight'] = 1000, 		['type'] = 'weapon', 	['ammotype'] = nil,						['image'] = 'weapon_battleaxe.png', 	['unique'] = true, 		['useable'] = false, 	['description'] = 'A large broad-bladed axe used in ancient warfare'},

Please note: The change to the battle axe is purely aesthetic, if it causes an issue with the functionality of the resource, the change can be reverted:

    ['weapon_battleaxe'] 			 = {['name'] = 'weapon_battleaxe', 		 	  	['label'] = 'Battle Axe', 				['weight'] = 1000, 		['type'] = 'weapon', 	['ammotype'] = nil,						['image'] = 'weapon_battleaxe.png', 	['unique'] = true, 		['useable'] = false, 	['description'] = 'A large broad-bladed axe used in ancient warfare'},
  1. In order to allow the axe to be purchaseable, you can amend QB-SHOPS/CONFIG.LUA to add the following to the end of the "hardware" store (starting at line 258 of config.lua if you have not otherwise amended qb-shops):
        [16] = {
            name = "weapon_battleaxe",
            price = 750,
            amount = 50,
            info = {},
            type = "item",
            slot = 16,
        },

E. RESTART SERVER

  1. 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.

  2. Please restart your server ensuring that mz-lumberjack is ensured/starts after qb-core starts (ideally it should just form part of your [qb] folder). Happy tree chopping and crafting!

  3. mz-lumberjack is inspired by TRClassic#0001's "tr-lumberjack" resource - Please visit: tr-lumberjack