PLT Scripts
TEBEXDISCORDCFX TOPICS
  • 👋PLT Fivem Developments
  • 📜Scripts
    • đŸĒĩLumberjack JOBS
      • â„šī¸Technical information
      • âš™ī¸Installation
    • 🚜Farmer Jobs v2
      • đŸ–Ĩī¸Technical information
      • 💰Payment and Boss
      • 🔐Security and Webhoks
      • đŸšī¸Modelling
Powered by GitBook
On this page
  • Framework money & job functions
  • Clothing System
  • Notifications system
  • Arrangement about spawned vehicles
  • Add new tree
  • Add new construction
  1. Scripts
  2. Lumberjack JOBS

Installation

PreviousTechnical informationNextFarmer Jobs v2

Last updated 2 years ago

  • Put the plt_lumberjack & plt_lumberjack-streams files in your resource file. Add them to your server.cfg.

  • Check the config.lua. and configure to script settings how you want.

  • If you are using ESX or QB-Core frameworks; you don't have to make any changes. it is ready to work. Otherwise check

  • The script has no requirements. ui and notifications itself. if you want you can use other notification system. check

  • If you want to do something when vehicle spawns, like giving a key to the player, changing the fuel of the vehicle or something

  • You should set the outfit values according to your own server . The clothes changing system can work standalone. If you want, you can use the qb-clothing or esx_skin system.

Framework money & job functions

If you are use ESX & QB-Core frameworks you don't need to change or add anything, they already been added.

server/server.lua
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
if ESX then 
    function PltAddMoney(src,money)
        ...
    end
else
    QBCore = exports['qb-core']:GetCoreObject()
    function PltAddMoney(src,money)
        ...
    end
end
client/jobs.lua
RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(PlayerData)
	JobUpdate(PlayerData.job.name,PlayerData.job.grade)
end)
RegisterNetEvent('esx:setJob')
AddEventHandler('esx:setJob', function(job)
	JobUpdate(job.name,job.grade)
end)
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
	local QBCore = exports['qb-core']:GetCoreObject()
	while QBCore.Functions.GetPlayerData().job == nil do Citizen.Wait(1000) end
	local PlayerData = QBCore.Functions.GetPlayerData()
	JobUpdate(PlayerData.job.name,PlayerData.job.grade.level)
end)
RegisterNetEvent('QBCore:Client:OnJobUpdate')
AddEventHandler('QBCore:Client:OnJobUpdate', function(JobInfo)
	JobUpdate(JobInfo.name,JobInfo.grade.level)
end)

Delete the ESX and QB-Core function before,

I added the necessary codes, but they are comment lines, activate the codes.

fxmanifest.lua
server_scripts {
	'@vrp/lib/utils.lua',
	...
}
server/server.lua
local Tunnel = module("vrp", "lib/Tunnel")
local Proxy = module("vrp", "lib/Proxy")
vRP = Proxy.getInterface("vRP")
function PltAddMoney(src,money)
    local user_id = vRP.getUserId(src)
    vRP.giveBankMoney(user_id,money)
end
AddEventHandler("vRP:playerSpawn",function(user_id, source, first_spawn)
  if first_spawn then
    local job = vRP.getUserGroupByType({user_id,"job"})
    TriggerClientEvent('plt_lumberjack:JobUpdate',user_id,job,false)
  end
end)
AddEventHandler("vRP:playerJoinGroup", function(user_id, group, gtype)
  if gtype == "job" then 
    TriggerClientEvent('plt_lumberjack:JobUpdate',user_id,jobName,false)
  end
end)

Delete the ESX and QB-Core function before, add the following function to give money in your own framework.

server/server.lua
function PltAddMoney(src,money)
   -- add "money" amount of money to the player whose id is "src", for example;
   -- local xPlayer = ESX.GetPlayerFromId(src)
   -- xPlayer.addMoney(money)
end

Job information should be updated when the player loaded and player's profession is updated, as in the example following

from any where
--following is when will trigger from CLIENT side.
TriggerEvent('plt_lumberjack:JobUpdate',jobName,jobGrade)
--following is when will trigger from Server side.
TriggerServerEvent('plt_lumberjack:JobUpdate',source,jobName,jobGrade)

I added the event that will be triggered, you don't need to do anything about it.

client/jobs.lua
RegisterNetEvent('plt_lumberjack:JobUpdate')
AddEventHandler('plt_lumberjack:JobUpdate', function(jobName,jobGrade)
	JobUpdate(jobName,jobGrade)
end)

Clothing System

client/clothing.lua
---- Adjust the 'PLT.Clothing' table following according to the job clothes on your server.
PLT.Clothing={
	male ={
	--[[ Arms ]]		['arms'] = 67,							
	--[[ Tshirt ]] 		['tshirt_1'] = 85, 	 ['tshirt_2'] = 0,
	--[[ Torso Parts ]]	['torso_1'] = 177, 	 ['torso_2'] = 11,
	..
	},
	female={..}
}
function ChangeOutfit()
	ChangeOutfitStandalone()-- if you want to use the esx_skin or qb-clothing system; Deactivate the this function then Activate the following which you want.
	--ChangeOutfitEsx()		-- if you want to use the esx_skin system; Deactivate the ChangeOutfitStandalone() function then Activate the this function.
	--ChangeOutfitQB()		-- if you want to use the qb-clothing system; Deactivate the ChangeOutfitStandalone() function then Activate the this function.
	TriggerEvent("plt_lumberjack:ClotheChangeAnim")
end

Notifications system

client/other.lua
function Notification(type, message, time)
	SendNUIMessage({statu="single", type = type, text = message, duration = time}) 
	--exports['mythic_ notify']:DoCustomHudText(type, message, time)
	--exports['okokNotify']:Alert("Lumberjack", message, time, type)
	--TriggerEvent('okokNotify:Alert', "Lumberjack", message, time, type)
	--TriggerEvent('QBCore:Notify', message, type, time)
end
client/other.lua
function permenantNotification(msg, thisFrame, beep, duration)
	permenantNotificationText = msg 
	--[[ 	AddTextEntry('pltLumberjackNotify', msg)
	if thisFrame then
		DisplayHelpTextThisFrame('pltLumberjackNotify', false)
	else
		if beep == nil then beep = true end
		BeginTextCommandDisplayHelp('pltLumberjackNotify')
		EndTextCommandDisplayHelp(0, false, beep, duration or -1)
	end ]]
end

Arrangement about spawned vehicles

client/other.lua
function SpawnedVehicle(vehicle, needGiveKey, vehicleModelName)
	if needGiveKey then 
		TriggerEvent("vehiclekeys:client:SetOwner", string.gsub(GetVehicleNumberPlateText(vehicle), '^%s*(.-)%s*$', '%1'))
		TriggerServerEvent('garage:addKeys', GetVehicleNumberPlateText(vehicle))
		TriggerServerEvent("plateEveryone",GetVehicleNumberPlateText(vehicle))
		if vehicleModelName == PLT.Vehicles.forklift or vehicleModelName ==  PLT.Vehicles.telehandler then 
			SetVehicleFuelLevel(vehicle, 99.9) DecorSetFloat(vehicle, "_FUEL_LEVEL", GetVehicleFuelLevel(vehicle))
		else -- here for trucks
			SetVehicleFuelLevel(vehicle, 99.9) DecorSetFloat(vehicle, "_FUEL_LEVEL", GetVehicleFuelLevel(vehicle))
		end
		--next line vehicle max car mod
		--SetVehicleMod(vehicle, 11, (GetNumVehicleMods(vehicle, tonumber(modType)) - 1), false) SetVehicleMod(vehicle, 12, (GetNumVehicleMods(vehicle, tonumber(modType)) - 1), false) SetVehicleMod(vehicle, 13, (GetNumVehicleMods(vehicle, tonumber(modType)) - 1), false) SetVehicleMod(vehicle, 15, (GetNumVehicleMods(vehicle, tonumber(modType)) - 1), false) SetVehicleMod(vehicle, 16, (GetNumVehicleMods(vehicle, tonumber(modType)) - 1), false) ToggleVehicleMod(vehicle, 18, true)
	end
end

Add new tree

Add new construction

📜
đŸĒĩ
âš™ī¸
#Framework money & job functions
#Notifications system
#Arrangement about spawned vehicles
#Clothing System
#Add new tree
#Add new construction