Editable Files

language files

config.langs.en = {
    necessaries = "Ingredients",
    cook = "Prepare Meal",
    cookFood = "Cook",
    cooking = "Cooking",
    fries = "French fries",
    cutChop = "Cut/chop",
    CuttingChopping = "Cutting/Choping",
    cutChopped = "%s Cut/Choped!",
    drink = "Prepare Drinks",
    preparingADrink = "Preparing Beverage",
    cola = "Cola/Sprunk",
    stash = "Storage",
    shop = "Market",
    incorrectValue = "Incorrect Value",
    noItemHave = "There are no %s grains of %s on you!",
    spilledFloor = "%s Spilled on the Ground!",
    burned = "%s burned!",
    orderOnTable = "Place the Order at the Counter",
    removeTable = "(Remove from Counter)",
    purchaseIt = "(Buy)",
    orderNumber = "Order number:",
    orderPrice = "Order price",
    price = "Price:",
    packageContent = "Contents:",
    noTable = "No Products on the Counter!",
    minMoney = "The Price of the Product Can Be Minimum $%s !",
    maxMoney = "The Price of the Product Can Be Maximum $%s !",
    placedOnTable = "Order Placed on the Counter",
    playerMaxOrder = "You can personally place a maximum of %s orders on the counter.",
    packetError = "You Can Only Put Packaged Products on the Counter! (You can pack with the '%s' command and the item must be in the first slot)",
    noOrder = "There Is No Such Order Anymore, Forget It!",
    cantPackItem = "%s cannot be packed!",
    packet = "Food/Drinks Packed",
    commandError = "You Can't Use This Command!",
    packetOpened = "Package Opened",
    noMoneyBank = "Not Enough Money in the Bank!",
    buyed = "Purchased for %s$!",
    selled = "Order No. %s Sold! %s$ Deposited to Bank Account!",
    removedOrder = "Order No. %s got removed",
    itemPrepared = "1 x %s prepaired!",
    toHeavy = "You're Too Heavy",
    cashregister = "Cash Register",
    shopBuyyed = "%sx %s bought",
    howManyBuy = "How many do you want to buy",
    amount = "Amount",
    handWash = "Wash hands",
    washingHand = "washing...",
    toilet = "Go to the toilet",
    youCant = "You can't do this!",
    chair = "Sit",
    boss = "Boss Menu",
    deliveryJob = "Delivery Job - Start/Cancel",
    uCantStartDelivery = "This job is not for you",
    deliveryVehError = "Job canceled, you are not in the vehicle given to you",
    orderDelivery = "Order Being Delivered",
    newDeliveryOrder = "New Order: %sx %s! Location Marked on GPS",
    deliveryStarted = "You Have Started Delivery! (Wait Until New Order Arrives)",
    cancaledDelivery = "Cancelled the delivery!",
    waitNewDelivery = "Wait For A New Order",
    knockDoor = "Knock the door",
    deliverySaled = "Ordere Delivered! You Made $%s from the Sale!",
    coffee = "Coffee",
    alchol = "Alcohol",
    poleDance = "Pole Dance",
    danceCancel = "Press [X] to cancel",
    lapDance = "Lap Dance",
    eating = "eating...",
    drinking = "drinking...",
    oven = "Oven",
    dough = "Dough",
    formDough = "Form Dough",
    rawPizza = "Prepare Pizza",
    juice = "Juice",
    sushi = "Sushi",
    icecream = "Icecream",
    hookah = "Hookah",
    min = "Min",
    max = "Max",        
    buyReqItems = "Buy the Missing Materials $%s",
    no = "No",
    wantBuyItems = "Do You Want to Buy the Missing Materials?",
    preparing = "prepairing",
    packetCommandDesc = "Pack Items in the First Five Slots",
    hookahKeyX = "~r~[X]~w~ Cancel",
    hookahKeyE = "~g~[E]~w~ Place",
    hookahUse = "~g~[E]~w~ Use",
    hookahRemove = "~r~[X]~w~ Remove",
    hookahSmoke = "~g~[H]~w~ Inhale Smoke!",
    hookahLeave = "~r~[X]~w~ Stop Smoking!",
    chairX = "Stand up",
    chairArrow = "Move Character",
    chairRotate = "Rotate Character",
    f4Label = "Employee Menu",
    f4Packet = "Pack it",
    f4Bill = "Make Invoice",
    noFoundNearbyPlayer = "There Is No Player Nearby!",
    billAmount = "Enter Invoice Fee",
    billLabel = "Catering Business",
    qbBillSended = "Invoice Sent",
    qbBillReceived = "You Have a New Invoice",
    qbBillError = "You Can't Send Invoices to Yourself",
    qbBillOffline = "Player offline"
}

server/editable.lua

if config.framework == "esx" then
    for i=1, #config.packetCommand.jobs do
        TriggerEvent('esx_society:registerSociety', config.packetCommand.jobs[i], config.packetCommand.jobs[i], 'society_'..config.packetCommand.jobs[i], 'society_'..config.packetCommand.jobs[i], 'society_'..config.packetCommand.jobs[i], {type = 'private'})
    end
end

function customItemMetadata(src, cid)
    local info = {}
    info.type = "food"
    info.durubality = os.time()
    info.citizenid = cid
    return info
end

function companyGiveMoney(jobname, money)
    if config.framework == "qb" then
        return exports['qb-management']:AddMoney(jobname, money)
    elseif config.framework == "esx" then
        TriggerEvent('esx_addonaccount:getSharedAccount', "society_"..jobname, function(account)
            account.addMoney(money)
        end)
    end
end

for i=1, #config.consumableItems do
    tgiCore.useableItem(config.consumableItems[i].item, function(source, item)
        TriggerClientEvent("tgiann-food-jobs:eatOrDrink", source, item, config.consumableItems[i])
    end)
end

RegisterServerEvent('tgiann-food-job:deliveryPay')
AddEventHandler('tgiann-food-job:deliveryPay', function(item, job, randomItemAmount)
	local src = source
    local xPlayer = tgiCore.getPlayer(src)
    local itemPrice = getItemPrice(job, item) * config.delivery.sellMoneyMultiplies
    if tgiCore.removeItem(xPlayer, item, randomItemAmount) then
        local price = tgiCore.round(tonumber(itemPrice*randomItemAmount))
        tgiCore.addMoney(xPlayer, 'cash', price)
        tgiCore.notif(src, string.format(lang.deliverySaled, price), "success")
    end
end)

RegisterNetEvent('tgiann-food-jobs:sendBillForQb')
AddEventHandler('tgiann-food-jobs:sendBillForQb', function(target, amount)
    local biller = tgiCore.core.Functions.GetPlayer(source)
    local billed = tgiCore.core.Functions.GetPlayer(target)
    if billed then
        if biller.PlayerData.citizenid ~= billed.PlayerData.citizenid then
            MySQL.insert(
                'INSERT INTO phone_invoices (citizenid, amount, society, sender, sendercitizenid) VALUES (?, ?, ?, ?, ?)',
                {billed.PlayerData.citizenid, amount, biller.PlayerData.job.name,
                biller.PlayerData.charinfo.firstname, biller.PlayerData.citizenid})
            TriggerClientEvent('qb-phone:RefreshPhone', billed.PlayerData.source)
            TriggerClientEvent('QBCore:Notify', biller.PlayerData.source, lang.qbBillSended, 'success')
            TriggerClientEvent('QBCore:Notify', billed.PlayerData.source, lang.qbBillReceived, 'success')
        else
            TriggerClientEvent('QBCore:Notify', biller.PlayerData.source, lang.qbBillError, 'error')
        end
    else
        TriggerClientEvent('QBCore:Notify', biller.PlayerData.source, lang.qbBillOffline, 'error')
    end
end)

client/editable.lua


function billFunction(targetSrc, amount)
    if config.framework == "esx" then
		TriggerServerEvent('esx_billing:sendBill', targetSrc, "society_"..PlayerData.job.name, lang.billLabel, billAmount)
	elseif config.framework == "qb" then
		TriggerServerEvent('tgiann-food-jobs:sendBillForQb', targetSrc, billAmount)
	end
end

RegisterNetEvent('tgiann-food-company:inventory')
AddEventHandler('tgiann-food-company:inventory', function(coord)
    if not canInteract() then return end
    local stashName = "foodstorage"..PlayerData.job.name
    if config.framework == "esx" then

    elseif config.framework == "qb" then
        TriggerEvent("inventory:client:SetCurrentStash", stashName)
        TriggerServerEvent("inventory:server:OpenInventory", "stash", stashName, {
            maxweight = 20000,
            slots = 15,
        })
    end
end)

RegisterNetEvent('tgiann-food-company:boss')
AddEventHandler('tgiann-food-company:boss', function(data)
    if PlayerData.job.boss or PlayerData.job.isboss or (PlayerData.job.grade_name and PlayerData.job.grade_name == "boss") then
        if data.job ~= PlayerData.job.name then return end
        if config.tgiannServer then
            TriggerEvent('esx_society:openBossMenu', PlayerData.job.name, function(data, menu)
                menu.close()
            end, { wash = false })
        else
            if config.framework == "esx" then
                TriggerEvent('esx_society:openBossMenu', data.job, function(data2, menu2)
                end, {wash = false})
            elseif config.framework == "qb" then
                TriggerEvent("qb-bossmenu:client:OpenMenu")
            end
        end
    end
end)

local isEatingOrDrinking = false
RegisterNetEvent('tgiann-food-jobs:eatOrDrink')
AddEventHandler('tgiann-food-jobs:eatOrDrink', function(itemData, consumableData)
	if not isEatingOrDrinking then
		tgiCore.cbFunction("tgiann-food-jobs:removeItem", function(result)
			if result then
                isEatingOrDrinking = true
				if consumableData.type == "food" then
                    if not consumableData.animation then
                        consumableData.animation = {
                            animDictionary = "mp_player_inteat@burger",
                            animationName = "mp_player_int_eat_burger",
                        }
                    end
                    if not consumableData.propOptions then
                        consumableData.propOptions = {
                            Prop = 'prop_cs_burger_01',
                            PropBone = 18905,
                            PropPlacement = {
                                0.13,
                                0.05,
                                0.02,
                                -50.0,
                                16.0,
                                60.0
                            }
                        }
                    end
				elseif consumableData.type == "drink" then
					if not consumableData.animation then
                        consumableData.animation = {
                            animDictionary = "mp_player_intdrink",
                            animationName = "loop_bottle",
                        }
                    end
                    if not consumableData.propOptions then
                        consumableData.propOptions = {
                            Prop = "vw_prop_casino_water_bottle_01a",
                            PropBone = 60309,
                            PropPlacement = {
                                0.0080,
                                0.0,
                                -0.0500,
                                0.0,
                                0.0,
                                -40.0000
                            },
                        }
                    end
				end

                local playerValue = 0
                if config.tgiannServer then -- This code for my server
                    playerValue = exports["tgiann-hud"]:getStatusValue(consumableData.type == "food" and "hunger" or "water") / 100
                else -- U can edit here
                    if config.framework == "esx" then
                        if consumableData.type == "food" then
                            local waitCb = true
                            TriggerServerEvent("esx_status:getStatus", "hunger", function(value)
                                waitCb = false
                                playerValue = value
                            end)
                            while waitCb do Wait(10) end
                        elseif consumableData.type == "drink" then
                            local waitCb = true
                            TriggerServerEvent("esx_status:getStatus", "thirst", function(value)
                                waitCb = false
                                playerValue = value
                            end)
                            while waitCb do Wait(10) end
                        end
                    elseif config.framework == "qb" then
                        if consumableData.type == "food" then
                            playerValue = tgiCore.core.Functions.GetPlayerData().metadata["hunger"]
                        elseif consumableData.type == "drink" then
                            playerValue = tgiCore.core.Functions.GetPlayerData().metadata["thirst"]
                        end
                    end
                end

                tgiCore.Progressbar("tigann-food-job-eat-or-drink", consumableData.progressbarLabel, consumableData.time, false, true, {
                    disableMovement = false,
                    disableCarMovement = false,
                    disableMouse = false,
                    disableCombat = true,
                }, {
                    animDict = consumableData.animation.animDictionary,
                    anim = consumableData.animation.animationName,
                    flags = 49,
                }, {
                    model = consumableData.propOptions.Prop,
                    bone = consumableData.propOptions.PropBone,
                    coords = { x = consumableData.propOptions.PropPlacement[1] or 0.0, y = consumableData.propOptions.PropPlacement[2] or 0.0, z = consumableData.propOptions.PropPlacement[3] or 0.0 },
                    rotation = { x = consumableData.propOptions.PropPlacement[4] or 0.0, y = consumableData.propOptions.PropPlacement[5] or 0.0, z = consumableData.propOptions.PropPlacement[6] or 0.0 },
                }, consumableData.propOptions.SecondProp and {
                    model = consumableData.propOptions.SecondProp,
                    bone = consumableData.propOptions.SecondPropBone,
                    coords = { x = consumableData.propOptions.SecondPropPlacement[1] or 0.0, y = consumableData.propOptions.SecondPropPlacement[2] or 0.0, z = consumableData.propOptions.SecondPropPlacement[3] or 0.0 },
                    rotation = { x = consumableData.propOptions.SecondPropPlacement[4] or 0.0, y = consumableData.propOptions.SecondPropPlacement[5] or 0.0, z = consumableData.propOptions.SecondPropPlacement[6] or 0.0 },
                } or {}, function() -- Done
                    isEatingOrDrinking = false
                end, function() -- Cancel
                    isEatingOrDrinking = false
                end)

                local whileTime = 1000
				local minAddStatusValue = consumableData.addValue / (consumableData.time / whileTime)
				while isEatingOrDrinking do
					Wait(whileTime)
					if isDead or not isEatingOrDrinking then break end
                    playerValue = playerValue + minAddStatusValue 
                    local maxValue = (consumableData.type == "food" and config.maxHungerThirstValue.hunger) or (consumableData.type == "drink" and config.maxHungerThirstValue.thirst)
                    if playerValue > maxValue then 
                        playerValue = maxValue 
                        isEatingOrDrinking = false 
                    end
                    if config.tgiannServer then -- This code for my server
                        exports["tgiann-hud"]:setStatusValue(consumableData.type == "food" and "hunger" or "water", (playerValue * 100))
                    else -- U can edit here
                        if config.framework == "esx" then
                            if consumableData.type == "food" then
                                TriggerServerEvent("esx_status:set", "hunger", playerValue * 100) --For ESX Status
                            elseif consumableData.type == "drink" then
                                TriggerServerEvent("esx_status:set", "thirst", playerValue * 100) --For ESX Status
                            end
                        elseif config.framework == "qb" then
                            if consumableData.type == "food" then
                                TriggerServerEvent("consumables:server:addHunger", playerValue) --For QB
                            elseif consumableData.type == "drink" then
                                TriggerServerEvent("consumables:server:addThirst", playerValue) --For QB
                            end
                        end
                    end
				end
                if config.tgiannServer then exports["tgiann-hud"]:saveStatusData() end -- This code for my server
			end
		end, itemData.name, itemData.slot)
	end
end)

CreateThread(function()
    for i=1, #config.blips do
        local blip = AddBlipForCoord(config.blips[i].coord)
        SetBlipSprite(blip, config.blips[i].sprite)
        SetBlipDisplay(blip, 2)
        SetBlipScale(blip, 0.7)
        SetBlipColour(blip, 2)
        SetBlipAsShortRange(blip, true)
        BeginTextCommandSetBlipName("STRING")
        AddTextComponentString(config.blips[i].name)
        EndTextCommandSetBlipName(blip)
    end
end)

function createItemContent(items, ostime)
    local first = true
    local content = ""
    for i=1, #items do
        if config.tgiannServer then -- For My Server, Don't Edit
            local durubality = tgiCore.round(exports["tgiann-inventory"]:checDurability(items[i].info.durubality, exports["tgiann-inventory"]:invConfig().foodDurabilityTime, ostime))
            if durubality < 0 then durubality = "(Tarihi Geçmiş)" else durubality = "%"..durubality end
            if first then
                first = false
                content = items[i].label.." "..durubality
            else
                content = content..", "..items[i].label.." "..durubality
            end
        else -- U can edit here
            if first then
                first = false
                content = items[i].label
            else
                content = content..", "..items[i].label
            end
        end
    end
    return content
end

function skillBar(time)
    return tgiCore.skillCheck(time, true)
end

Last updated