Overextended Documentation

website·Indexed 33 days ago

https://overextended.dev

Documentation for a suite of high-quality, open-source FiveM resources, including Ox Core (a modern framework), Ox Inventory (slot-based inventory with item metadata), OxMySQL (a performant MySQL/MariaDB replacement), Ox Target, Ox Fuel, Ox Doorlock, and the ox_lib utility library.

Tokens
61.9K
Snippets
452
Records
521
Agent score
68%

What's inside Overextended

  1. Overview of the Radial Menu

    The Radial Menu provides a circular interface for user actions. By default, the global menu is accessed using the z key and only appears when at least one item has been added. Developers can manage the global menu using lib.addRadialItem and lib.removeRadialItem, or create complex nested structures by registering sub-menus with lib.registerRadial.
  2. Overview of Fivemanage for FiveM servers

    Fivemanage is an all-in-one SaaS platform designed for FiveM community management and administration. It provides fast and reliable content delivery for image, video, and audio files, as well as logging systems to track player and server activity. The platform integrates with FiveM servers via native support through ox_lib and oxmysql, or by using the official FiveM SDK. It offers a tiered pricing model including a free plan for initial setup and paid plans for increased storage and advanced features.
  3. Overview of ox_lib Zones

    Zones provide a high-performance spatial check system to define 3D areas (spheres, boxes, or polygons) and evaluate if a position is inside or outside that region. They utilize a spatial grid to optimize performance.

    Important Constraints:

    • Server-side: Server-side zones do not support player trigger events; onEnter, onExit, and inside handlers are unavailable.
    • Language Compatibility: Lua and JavaScript APIs are not compatible. TypeScript definitions in the npm package are the authoritative reference for JS.
  4. Implement custom logic using ox_lib Hooks

    Hooks in ox_lib enable resources to add custom logic to existing actions without modifying the original source code. They operate as a pipeline of callbacks (hook events) that trigger when a specific action occurs. Each hook in the pipeline has the ability to inspect the provided data and can reject the action to prevent it from proceeding. Additionally, post-hook events can be used after the pipeline completes to perform tasks like logging or cleanup without altering the final outcome of the action.
  5. Query Registered Zones using Utility Functions

    Use these global utility functions to retrieve information about all active zones or zones relative to the player.
    -- Lua
    lib.zones.getAllZones()        -- Returns all registered zones (CZone[])
    lib.zones.getCurrentZones()    -- Returns zones player is currently inside (CZone[])
    lib.zones.getNearbyZones()     -- Returns zones near the player (CZone[])
    // TypeScript
    import { Zone } from "@overextended/ox_lib";
    
    Zone.getAll();                  // Returns Set<Zone>
    Zone.getCurrent();              // Returns Set<Zone>
    Zone.getNearby(point);          // Returns Set<Zone>. point is optional Vector2|Vector3
  6. Query and retrieve registered points

    ox_lib provides several utility functions to retrieve information about points currently registered in the resource:
    -- Get all points created in the resource
    local allPoints = lib.points.getAllPoints()
    
    -- Get an array of all points currently in range of the player
    local nearbyPoints = lib.points.getNearbyPoints()
    
    -- Get the single closest point to the player (returns CPoint or nil)
    local closestPoint = lib.points.getClosestPoint()
  7. Access registered groups via ox_core global states

    ox_core automatically manages global state bags for groups. These are read-only and should not be edited manually. Use the groups state to get a list of all registered group names, and group.<name> to retrieve detailed information about a specific group, including its label, grades, type, and associated account roles.
    // Example of data returned by group.<name>
    {
      name: string,
      label: string,
      grades: string[],
      type: string,
      hasAccount: boolean,
      accountRoles: string[],
      principal: string
    }
  8. Build and customize the Ox Lib UI

    To modify UI elements, you must use the source code. Do not attempt to de-bundle or un-minify release files. Use Bun within the web directory to manage the build process.

    • bun start: Starts a development server with hot reloads for browser testing.
    • bun start:game: Writes changes to disk for in-game testing (requires resource restart).
    cd ox_lib/web
    bun i
    bun run build
    # For browser dev: bun start
    # For game dev: bun start:game
  9. Create and manage a DUI instance using ox_lib

    The Dui class provides a centralized way to create a DUI instance. It allows developers to specify the initial URL, dimensions, and debug mode, and provides methods to update the URL, send data messages to the DUI, and destroy the instance.
    import { Dui, cache } from "@overextended/ox_lib/client";
    
    // Initialize a new DUI
    const dui = new Dui({
      url: `nui://${cache.resource}/web/index.html`,
      width: 1920,
      height: 1080,
      debug: true,
    });
    
    // Change the URL of the DUI
    dui.setUrl("https://google.com");
    
    // Send a message/data object to the DUI
    dui.sendMessage({
      action: "display",
      value: true,
    });
    
    // Destroy the DUI instance
    dui.remove();