DirkScripts Documentation
  • 👋Welcome
  • The Basics
    • ⬇️Installing Resources
  • Resources
    • 📚Dirk Lib
      • Getting Started
      • Cache
      • Modules
        • Await
        • Blip
        • Callback
        • Camera
        • File
        • Interact
        • Objects
        • Player
          • Client
          • Server
        • Groups
          • Client
          • Server
        • Print
        • Request
        • Table
        • Target
        • Zones
        • UI
          • Context
          • Untitled
    • 🔧Project Cars
      • Installation
      • Tools
      • Parts
      • Commands
    • 🤼Multicharacter
      • Installation
      • Configuration
      • Exports
      • F.A.Q
      • Commands
    • 💊Drug Labs v2
      • Installation
      • Tebex Integration
      • Creating Labs
  • 🛒Store
  • 🗣️Discord
  • 🖥️GitHub
Powered by GitBook
On this page
  • lib.callback.await
  • lib.callback.register
Export as PDF
  1. Resources
  2. Dirk Lib
  3. Modules

Callback

Use to easily communicate between both client and server

Shared - These functions can be used server and client however take note of the direction of callbacks and regration. Client & Server are able to callback between however you are unable to callback between clients.

lib.callback.await

the playerId is only present on the server side, it is not required for the client side.

Call and await for a response of a server callback

-- Client
lib.callback.await(event, ...)
-- Server
lib.callback.await(event, playerId, ...)
Parameter
Type
Required
Description

event

String

Server defined event name

playerId

Number

Server Only - source to send request to

cb

Function

Callback function, there must be at least one defined

lib.callback.register

Register a client callback, this can be used to easily request data from a client from the server

lib.callback.register(event, cb)
Parameter
Type
Required
Description

event

String

Event name to be called from the server

cb

Function

Callback function, should return values for the callback

PreviousBlipNextCamera

Last updated 10 months ago

📚