TXOS - FiveM Scripts Documentation
STOREDISCORD
  • TXOS Documentation
  • DEPENDENCY
    • TXOS Lib
      • Dependencies
      • Installation
      • Configuration
      • Open methods
      • Framework customization
  • Resources
    • TXOS Armory
      • Dependencies
      • Installation
      • Configuration
      • Open methods
      • Exports / Events
    • TXOS Badge
      • Dependencies
      • Installation
      • Configuration
      • Open methods
      • Exports / Events
    • TXOS Jewel
      • Dependencies
      • Installation
      • Configuration
      • Open methods
      • Exports / Events
    • TXOS Trucking
      • Dependencies
      • Installation
      • Configuration
      • Open methods
      • Exports / Events
    • TXOS Esc
      • Dependencies
      • Installation
      • Configuration
      • Open methods
      • Exports / Events
Powered by GitBook
On this page
  1. Resources
  2. TXOS Jewel

Open methods

We have some open methods on the client and server of jewel. These allow you can change the item reward calculations, and do different checks before a robbery and more.

OpenMethods = {}

-- If you want to make some checks before the robbery starts, you can do it here
function OpenMethods.canStartRobbery()
    return true
end

-- If you want to make some checks before a police presses the keypad, you can do it here
function OpenMethods.canPressKeypad()
    return true
end

-- If you want to make some checks before someone steals a painting, you can do it here
function OpenMethods.canStealPainting()
    return true
end

-- If you want to make some checks before someone smashes a tray, you can do it here
function OpenMethods.canSmashTray()
    return true
end

function OpenMethods.drawMarker() -- Draw the marker for the trucker menu (Only if UseTarget is false)
    local r, g, b, a = table.unpack(Config.Options.MarkerOptions.DrawMarkerColor)
    DrawMarker(27, vector3(Config.Options.ShopMiddle.x, Config.Options.ShopMiddle.y, Config.Options.ShopMiddle.z - 0.95), vector3(0.0, 0.0, 0.0), vector3(0.0, 0.0, 0.0), vector3(1.0, 1.0, 1.0), r, g, b, a, false, false, 2, false, false, false)
end
OpenMethods = {}

-- Must return a table with the items and amount as key value pairs
-- Ex: {["item"] = 1, ["item2"] = 2}
-- Defaults to give a specific item with a random amount, but if you want to give multiple items you can modify it here.
function OpenMethods.calculateItemReward()
    local retVal = {}

    local randomItem = Config.Items[math.random(#Config.Items)]
    retVal[randomItem] = math.random(Config.Options.RobItemAmount.Min, Config.Options.RobItemAmount.Max)

    return retVal
end

-- Must return a table with the items and amount as key value pairs
-- Ex: {["item"] = 1, ["item2"] = 2}
-- Defaults to give a 1 of the paintings randomly, but if you want to give multiple items you can modify it here or give a specific painting always you can do it here
function OpenMethods.calculatePaintingReward(painting_index) -- painting_index is the index of the painting that was cut [1,2,3,4]
    local retVal = {}

    local randomPainting = Config.Paintings[math.random(#Config.Paintings)]
    retVal[randomPainting] = 1

    return retVal
end


function OpenMethods.showPoliceAlarm(police_players) -- police_players is a table with all the police player sources
    for k, v in pairs(police_players) do
        TriggerClientEvent('txos_vangelico:NotifyCops', v)
    end
end

function OpenMethods.antiAbuse(source) -- source is the player source
    DropPlayer(source, "[TXOS] Anti-Abuse")
end

PreviousConfigurationNextExports / Events

Last updated 5 months ago