AV Scripts
StoreDiscord
  • Documentation
  • Guides
    • Dealerships
      • Installation
      • Admin Panel
        • All Vehicles
        • Dealerships
        • Auctions
      • Dealership Panel
        • Overview
        • Auctions
        • Employees
        • Orders
        • Payments
        • Showroom
        • Warehouse
        • Pre Owned
        • Settings
      • Buy/Sell Vehicles
      • Catalogue
      • Exports
      • FAQ
    • House Robbery
      • Installation
      • Add Shells
      • Dispatch
      • Exports
      • Weather
      • Minigames
      • Notifications
      • New Houses
      • Object Types
      • Sell Items
    • Illegal Runs
      • Installation
      • Customization
      • Ox Inventory
      • QB Inventory
    • Multicharacter
      • Installation
      • Character Slots
      • Clothes
      • Scenes
        • Previews
      • Exports
      • Weather
    • Paleto Heist
      • Buy here
    • Refund System
      • Installation
        • Inventories
    • Tuning Script
      • Installation
      • Events and Controls
      • Exports
      • Price Multiplier
    • Vehicleshop
      • Installation
      • Admin Panel
      • Addon Vehicles
      • Functions
        • Fuel
        • Keys
        • VIP
        • Weather
      • Garages
      • HUD
      • Society
    • Weather Script
      • Installation
      • Breath Condensation
      • Fog
      • Real Time Sync
      • Exports
    • VIP Script
      • Installation
      • Exports
      • Categories
      • Admin
      • Tebex
      • Free Tokens
  • LAPTOP PACK V3
    • Laptop v3
      • Installation
        • Inventory
        • Cosmo
        • Permissions
        • QBCore
        • Custom Framework/Inventory
        • Phone
        • Translate
      • Browser
      • Terminal
      • Documents
      • APPs Config
      • Exports
    • Boosting
      • Create Profile
      • APP
      • Contracts
      • Dispatch
      • Lockpick Export
      • VIN Export
    • Business
      • Installation
        • Inventories
          • Origen Inventory
            • ESX
            • QBCore
          • OX Inventory
          • QB/PS/LJ Inventory
          • Quasar Inventory
            • ESX
            • QBCore
          • Codem Inventory
          • Tgiann Inventory
        • ESX
      • Admin Panel
        • Create Zones
        • Edit Zones
      • Config
        • Animations
        • Blips
        • Buttons
        • Crafting
        • Effects
        • Events
          • Items
          • Zones
        • Logs
          • Custom Logs
        • Permissions
      • Exports
      • Banking Scripts
      • Multijobs
    • Cameras
      • Installation
        • Vehicle Cameras
      • Place Camera
      • Job Cameras
    • Drugs
      • Installation
      • Admin Panel
      • APP
      • Tables
      • Labs
        • PC
        • Raids
      • Alert Cops
      • Shells
      • Exports
    • Gangs
      • Installation
      • Admin Panel
        • Gangs
        • Whitelist
      • Properties
      • Register Gang
      • APP
        • Members
        • Settings
        • Missions
        • Blackmarket
        • Properties
      • Graffitis
      • Missions
      • Gang NPC
      • Shells
      • Exports
      • Labs
    • Groups
      • Events
      • Exports
    • Music
      • Installation
      • Music Labels
      • APP
        • Search Music
        • Playlists
        • Headphones
      • CDs
    • Racing
      • Installation
        • Permissions
        • Discord Logs
        • Addon Vehicles
      • Admin Panel
      • Categories
      • Events
      • Exports
      • Personal Settings
      • The Underground
    • Custom APPs
    • Discord Support
Powered by GitBook
On this page
  1. LAPTOP PACK V3
  2. Business
  3. Config
  4. Logs

Custom Logs

Last updated 11 months ago

This guide is for custom logs that can be triggered from external scripts, please be aware that medium knowledge is required for this, if you don't have idea of what are you doing or have 0 experience in coding please hire a dev, I don't provide any assistance for this other than this guide.

  • Add the custom log in config/_config.lua inside the Config.Logs table, there's an example there, let's gonna use it:

value: needs to be an unique string value, you can't have multiple logs with the same value.

label: this is how the business boss will se it in his settings tab.

description: a short description so the boss can know what this does.

jobs: set this to false if you want all jobs can access it or set a table with jobs like the image above.

  • Go to server/editable/logs.lua and add a new function inside functions table:

Important: Every index key needs to match your log value and the function to trigger needs to be unique, for this example the function is named customLogs.

  • Go to the end of the file and create the new function, this function will receive 4 parameters:

webhook: This is the webhook the business boss added to receive this type of notifications.

source: Is the player who's triggering the log and is optional, is included just in case you need it for X reason.

job: The job you want to receive the notification. data: Is a table with all extra data that you want to send/receive in your log function.

  • For this example we are gonna simulate that we are triggering the export from av_tuning, when someone already paid for the modifications, so we are gonna add the export in the server file and function where we want to send the log, in this case for av_tuning we are adding it in server/framework/_framework.lua > ProcessPayment:

  • As you can see in the screenshot we are using the following code:

local data = {
    title = shop, -- the title for the webhook, we are using the shop name
    employeeName = exports['av_laptop']:getName(src), -- I want to get the employee name
    employeeIdentifier = exports['av_laptop']:getIdentifier(src), -- employee identifier
    customerIdentifier = exports['av_laptop']:getIdentifier(customer), -- customer identifier just in case
    total = total, -- the total paid for the modifications
    -- I could add more data here but for my example this is enough, u can add as many info as u want
}
-- Now we trigger the export 
-- exports['av_business']:sendLog(logName, source, jobName, data)
exports['av_business']:sendLog("custom_log", src, job.name, data)
  • The export needs the following args:

logName: The log value from Config.Logs table

source: The player source that is triggering the log or u can set nil if you want

jobName: The job to send the log

data: A table with all the data u want to send to your log function

  • Now back in av_business/server/editable/logs.lua we are gonna edit our custom function and format the description table using the info sent from our export, for me it will look like this:

  • As you can see we are using the content of data to create the fields that I want, Employee Name, Employee Identifier, Customer Identifier and Total, depending on your data content create the needed fields.

  • Now your log is ready to be used, the business owner needs to add his webhook in the Settings tab of the Business app to start receiving its notifications.

  • This is the webhook notification after the customer pays for the modifications

  • Important: If you feel like I'm missing something or a step isn't well explained DON'T OPEN A TICKET, use the support channel. Please only use the Discord ticket system for bug reports.

custom_log is the one we are using for this guide
We need to know the data structure first, this isn't defined yet...
Remember this is just an example...
I changed the label and description