Common questions and problems

Here, I'll list some things that might cause confusion regarding the config or potential issues related to those doubts.

How do i Mage sure work vehicles are not taxed?

Typically, well-known garage systems store those vehicles in separate tables in the database, so this shouldn’t be an issue. However, just to be safe, we’ve added an open function in server/open.lua that allows you to create a custom function to handle this.

Here’s a simple example of what you can create, but please note, it will be your responsibility to implement it!

function IsVehicleJobOwned(plate)
    -- Get the vehicle model using the plate number
    local result = MySQL.scalar.await('SELECT model FROM owned_vehicles WHERE plate = ?', {plate})
    
    -- If the model includes "police", exclude the vehicle from taxes
    if result and string.match(result, "police") then
        return true -- The vehicle is job-owned, so exclude it from taxes
    end

    return false -- If it's not a job-owned vehicle, do not exclude it
end

Explanation:

  1. MySQL.scalar.await: Queries the database to retrieve the model of the vehicle using the plate.

  2. string.match: Checks if the model contains the word "police". If true, the vehicle will be considered job-owned and excluded from taxes.

  3. return true: If the vehicle meets the condition, it returns true to exclude it from taxes.

  4. return false: If the condition is not met, the vehicle won't be excluded from taxes.

Last updated