Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "alt-server"

Index

Type aliases

DateTimeDay

DateTimeDay: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30

DateTimeHour

DateTimeHour: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23

DateTimeMinute

DateTimeMinute: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59

DateTimeMonth

DateTimeMonth: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11

DateTimeSecond

DateTimeSecond: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59

Variables

Const DefaultDimension

DefaultDimension: number

Const GlobalDimension

GlobalDimension: number

Const resourceName

resourceName: string

Resource name of the executing entity

Const rootDir

rootDir: string

Functions

clearEveryTick

  • clearEveryTick(id: number): void

clearInterval

  • clearInterval(id: number): void

clearNextTick

  • clearNextTick(id: number): void

clearTimeout

  • clearTimeout(id: number): void

deleteMeta

  • deleteMeta(key: string): void
  • Removes the specified key.

    Parameters

    • key: string

      The key of the value to remove.

    Returns void

deleteSyncedMeta

  • deleteSyncedMeta(key: string): void
  • Removes the specified key.

    Parameters

    • key: string

      The key of the value to remove.

    Returns void

emit

  • emit(eventName: string, ...args: any[]): void
  • Emits specified event across server resources.

    Parameters

    • eventName: string

      Name of the event.

    • Rest ...args: any[]

      Rest parameters for emit to send.

    Returns void

emitClient

  • emitClient(player: Player, eventName: string, ...args: any[]): void
  • emitClient(player: null, eventName: string, ...args: any[]): void
  • Emits specified event to specific client.

    Parameters

    • player: Player

      Event is sent to specific player.

    • eventName: string

      Name of the event.

    • Rest ...args: any[]

      Rest parameters for emit to send.

    Returns void

  • Emits specified event to specific client.

    Parameters

    • player: null

      Event is sent to every player.

    • eventName: string

      Name of the event.

    • Rest ...args: any[]

      Rest parameters for emit to send.

    Returns void

everyTick

  • everyTick(handler: () => void): number
  • Schedules execution of handler on every tick.

    Parameters

    • handler: () => void

      Handler that should be scheduled for execution.

        • (): void
        • Returns void

    Returns number

    A number representing the id value of the timer that is set. Use this value with the clearEveryTick function to cancel the timer.

getMeta

  • getMeta(key: string): any
  • Gets a value using the specified key.

    Parameters

    • key: string

      The key of the value to get.

    Returns any

    Dynamic value associated with the specified key.

getNetTime

  • getNetTime(): number

getResourceExports

  • getResourceExports(name: string): any

getResourceMain

  • getResourceMain(name: string): string

getResourcePath

  • getResourcePath(name: string): string

getSyncedMeta

  • getSyncedMeta(key: string): any
  • Gets a value using the specified key.

    Parameters

    • key: string

      The key of the value to get.

    Returns any

    Dynamic value associated with the specified key.

hasMeta

  • hasMeta(key: string): boolean
  • Determines whether contains the specified key.

    Parameters

    • key: string

      The key of the value to locate.

    Returns boolean

    True when element associated with the specified key is stored.

hasResource

  • hasResource(name: string): boolean

hasSyncedMeta

  • hasSyncedMeta(key: string): boolean
  • Determines whether contains the specified key.

    Parameters

    • key: string

      The key of the value to locate.

    Returns boolean

    Return is dependent on whether element associated with the specified key is stored.

hash

  • hash(str: string): number
  • Creates a hash using Jenkins one-at-a-time algorithm.

    Parameters

    • str: string

      A string, from which hash will be created.

    Returns number

log

  • log(...args: any[]): void

logError

  • logError(...args: any[]): void

logWarning

  • logWarning(...args: any[]): void

nextTick

  • nextTick(handler: () => void): number
  • Schedules execution of handler on next tick.

    Parameters

    • handler: () => void

      Handler that should be scheduled for execution.

        • (): void
        • Returns void

    Returns number

    A number representing the id value of the timer that is set. Use this value with the clearNextTick function to cancel the timer.

off

  • off(eventName: string, listener: (...args: any[]) => void): void
  • Unsubscribes from server event handler with specified listener.

    remarks

    Listener should be of the same reference as when event was subscribed.

    Parameters

    • eventName: string

      Name of the event.

    • listener: (...args: any[]) => void

      Listener that should be removed.

        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns void

offClient

  • offClient(eventName: string, listener: (...args: any[]) => void): void
  • Unsubscribes from client event handler with specified listener.

    remarks

    Listener should be of the same reference as when event was subscribed.

    Parameters

    • eventName: string

      Name of the event.

    • listener: (...args: any[]) => void

      Listener that should be removed.

        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns void

on

  • on<K>(eventName: K, listener: IServerEvent[K]): void
  • on<S>(event: Exclude<S, keyof IServerEvent>, listener: (...args: any[]) => boolean | void): void
  • Subscribes to server event handler with specified listener.

    Type parameters

    Parameters

    • eventName: K

      Name of the event.

    • listener: IServerEvent[K]

      Listener that should be added.

    Returns void

  • Subscribes to server event handler with specified listener.

    Type parameters

    • S: string

    Parameters

    • event: Exclude<S, keyof IServerEvent>
    • listener: (...args: any[]) => boolean | void

      Listener that should be added.

        • (...args: any[]): boolean | void
        • Parameters

          • Rest ...args: any[]

          Returns boolean | void

    Returns void

onClient

  • onClient(eventName: string, listener: (player: Player, ...args: any[]) => void): void
  • Subscribes to client event handler with specified listener.

    Parameters

    • eventName: string

      Name of the event.

    • listener: (player: Player, ...args: any[]) => void

      Listener that should be added.

        • (player: Player, ...args: any[]): void
        • Parameters

          • player: Player
          • Rest ...args: any[]

          Returns void

    Returns void

restartResource

  • restartResource(name: string): void

setInterval

  • setInterval(handler: () => void, miliseconds: number): number
  • Schedules execution of handler in specified intervals.

    Parameters

    • handler: () => void

      Handler that should be scheduled for execution.

        • (): void
        • Returns void

    • miliseconds: number

      The time, in milliseconds, between execution of specified handler.

    Returns number

    A number representing the id value of the timer that is set. Use this value with the clearInterval function to cancel the timer.

setMeta

  • setMeta(key: string, value: any): void
  • Stores the given value with the specified key.

    remarks

    The given value will be shared locally to all resources.

    Parameters

    • key: string

      The key of the value to store.

    • value: any

    Returns void

setSyncedMeta

  • setSyncedMeta(key: string, value: any): void
  • Stores the given value with the specified key.

    remarks

    The given value will be shared with all client resources.

    Parameters

    • key: string

      The key of the value to store.

    • value: any

    Returns void

setTimeout

  • setTimeout(handler: () => void, miliseconds: number): number
  • Schedules execution of handler once after the expiration of interval.

    Parameters

    • handler: () => void

      Handler that should be scheduled for execution.

        • (): void
        • Returns void

    • miliseconds: number

      The time, in milliseconds, before execution of specified handler.

    Returns number

    A number representing the id value of the timer that is set. Use this value with the clearTimeout function to cancel the timer.

startResource

  • startResource(name: string): void

stopResource

  • stopResource(name: string): void