T1GER Scripts Documentation
Tebex StoreDiscordYouTubeCFX Forum
  • T1GER Scripts Documentation
  • Quick Links
    • t1ger.net | Shop Now
    • Join Discord
  • Information
    • FiveM Asset Escrow
  • Resources
    • T1GER Mechanic
      • Installation
        • Job Account
          • Setup
          • API
      • Configuration
        • Shop
      • API
        • Exports
        • Events
      • Troubleshoot
    • T1GER Library
      • Installation
        • Inventory
        • Target
        • Garage
        • Society Account
        • Vehicle Properties
      • Configuration
    • T1GER Gang System
      • Installation
      • Gang Garages
      • Product Information
    • T1GER Tuning System
      • Installation
      • API
        • Client
        • Server
      • Troubleshoot
        • Common Issues
        • Error Codes
      • Guides
        • Commands
        • Shops
        • Markers
        • Mod Stations
        • Pricing
        • Mod Orders
        • Vehicle Mods
        • Engine Swaps
        • Nitrous
    • T1GER ATM Robbery
      • Installation
      • API
        • Client
        • Server
      • Troubleshoot
        • Common Issues
        • Error Codes
      • Guides
        • Hacking Minigame
        • Dispatch
    • T1GER Dealerships
  • Free Resources
    • T1GER Keys
    • T1GER Garage
    • T1GER Bank Robbery
    • T1GER Tow Trucker
Powered by GitBook
On this page
  • Get Shop ID
  • Add Account Money
  • Remove Account Money
  • Usage - Example #1
  • Usage - Example #2
  1. Resources
  2. T1GER Mechanic System

Shop Account

Instructions on using mechanic shop account in other resources

The resource offers a custom account system that is standalone and not dependent on frameworks.

Get Shop ID

You can get the player's mechanic shop id with this export:

local src = source
local shopID = exports['t1ger_mechanicsystem']:GetPlayerMechId(src)
-- src(INT): player server id

Add Account Money

Requires: Mechanic Shop ID (use exports to get the ID based on player's server id or player's job name)

exports['t1ger_mechanicsystem']:PlusMechanicAccount(shopId, amount)
-- shopId(INT): mechanic shop id
-- amount(INT): amount of money to add to the account

Remove Account Money

Requires: Mechanic Shop ID (use exports to get the ID based on player's server id or player's job name)

exports['t1ger_mechanicsystem']:MinusMechanicAccount(shopId, amount)
-- shopId(INT): mechanic shop id
-- amount(INT): amount of money to add to the account

Usage - Example #1

Here's an example to easily add/remove money from a mechanic shop:

local src = source -- player server id
local amount = 5000 -- how much should be added/removed? 

-- export to get the shop id based on player server id:
local shopId = exports['t1ger_mechanicsystem']:GetPlayerMechId(src)

-- add money:
exports['t1ger_mechanicsystem']:PlusMechanicAccount(shopId, amount)

-- remove oney:
exports['t1ger_mechanicsystem']:MinusMechanicAccount(shopId, amount)

Usage - Example #2

Here's an alternative example using TriggerEvent (similar to esx_addonaccount)

local playerJob = 't1mechanic' -- add function/export to get the player's job here. 
local amount = 5000 -- how much should be added/removed? 

TriggerEvent('mechanicsystem:server:getPlayerMechanicShop', playerJob, function(mechanicShop)
    -- remove money:
    if mechanicShop.account >= amount then
        exports['t1ger_mechanicsystem']:MinusMechanicAccount(mechanicShop.id, amount)
    else
        print("not enough money")
    end
    
    -- add money:
    exports['t1ger_mechanicsystem']:PlusMechanicAccount(mechanicShop.id, amount)
end)

Last updated 1 year ago