HRScripts Documentation
  • HRScripts Documentation
  • Resources
    • 📚HRLib
      • Classes
        • HRLibConfig
        • HRLibClientFPlayer
        • HRLibServerFPlayer
        • HRLibClientIPlayer
        • HRLibServerIPlayer
        • HRLibCloseIPlayer
        • HRLibCloseFPlayer
        • HRLibBlipOptions
        • HRLibBlipForCoordOptions
        • HRLibBlipForEntityOptions
        • HRLibBlipForAreaOptions
        • HRLibBlipForPickupOptions
        • HRLibInputDialogueTextOptions
        • HRLibVehicleProperties
      • Modules
        • Bridge
          • Shared
          • Client
          • Server
        • Callbacks
          • Shared
          • Client
          • Server
        • Closest
          • Client
        • Controls Disable
          • Client
        • CreateBlip
          • Client
        • DiscordMsg
          • Server
        • DoesIdExist
          • Shared
        • FPlayer
          • Shared
          • Client
          • Server
        • GetPedsInVehicle
          • Client
        • GetPedWeapons
          • Client
        • GetPlayers
          • Client
        • GetVehicleDoorStatus
          • Client
        • GetVehicleFromPlate
          • Client
        • Interface
          • Client
          • Server
        • IPlayer
          • Client
          • Server
        • PlayerIdentifiers
          • Server
        • RadomValueWithNoRepetition
          • Shared
        • RegCommand
          • Client
          • Server
        • Resource
          • Shared
          • Server
        • SpawnVehicle
          • Shared
        • Streaming
          • Client
        • string
          • Shared
        • table
          • Shared
        • ToVector
          • Shared
        • TrackingEntities
          • Client
            • Functions
            • Events
        • Values
          • Shared
          • Client
        • VehicleProperties
          • Client
          • Server
        • SetDefaultPedVariation
          • Shared
    • HRGarages
      • Classes
        • HRGaragesConfig
        • HRGaragesVehicleInfo
        • HRGaragesClientFunctions
      • Exports
        • Server
    • 📦HRStorages
      • Exports
        • Client
        • Server
      • Callbacks
      • Commands
    • 🧹HRComserv
    • 🥷HRHostage
    • HRAdminMenu
      • Events
      • Exports
        • Client
        • Server
      • State Bags
    • ☑️HRWhitelist
    • HRExtraCommands
    • 🚦HRRealisticTraffic
    • 🗣️HRNPCDialogue
      • Classes
Powered by GitBook
On this page
  • require
  • OnStart
  • OnStop
  • OnStarting
  1. Resources
  2. HRLib
  3. Modules
  4. Resource

Shared

These functions are only available in the import method!

require

Function to return value from a json or lua (but triggered as lua code) files

function HRLib.require(path: string): any? result

Parameters description

  • path - the file's path (format example: '@HRTest/config.lua' or '@HRTest/settings.json')

Return description

  • result - contains the result of the file (if lua, returns what the executed file as code returns, otherwise the file should be as a value like table or string or etc.)

This function replaces the global require so you can use it properly but it is with the same path format.

The client files that you require must be registered as files in the specified script's fxmanifest.lua. Example: file 'config.lua' or file 'settings.json'

OnStart

Function to register a callback function into the event onResourceStart's handler with option to filter the resource that starts and triggers the cb function when the resource is started

function HRLib.OnStart(resName: string|'any', cb: fun(resName: string))

Parameters description

  • resName - the resource name, if 'any' it won't filter

  • cb - the callback function which parameters provide the resource name (it's useful if you use 'any' as your resName option)

OnStop

Function to register a callback function into the event onResourceStop's handler with option to filter the resource that stops and triggers the cb function when the resource stops

function HRLib.OnStop(resName: string|'any', cb: fun(resName: string))

Parameters description

  • resName - the resource name, if 'any' it won't filter

  • cb - the callback function which parameters provide the resource name (it's useful if you use 'any' as your resName option)

OnStarting

Function to register a callback function into the event onResourceStarting's handler with option to filter the resource that is starting and triggers the cb function when the command to start the resource is entered (it means this is triggered while the resource is starting)

function HRLib.OnStop(resName: string|'any', cb: fun(resName: string))

Parameters description

  • resName - the resource name, if 'any' it won't filter

  • cb - the callback function which parameters provide the resource name (it's useful if you use 'any' as your resName option)

PreviousResourceNextServer

Last updated 1 month ago

📚