Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "alt-server"

module

alt-server

Index

References

Enumerations

Classes

Interfaces

Type aliases

Variables

Functions

References

AudioCategories

Re-exports AudioCategories

BaseObject

Re-exports BaseObject

BaseObjectType

Re-exports BaseObjectType

BlipColor

Re-exports BlipColor

BlipSprite

Re-exports BlipSprite

BlipType

Re-exports BlipType

BodyPart

Re-exports BodyPart

CheckpointType

Re-exports CheckpointType

ColShapeType

Re-exports ColShapeType

File

Re-exports File

FileEncoding

Re-exports FileEncoding

ICustomBaseObjectMeta

Re-exports ICustomBaseObjectMeta

ICustomBaseObjectSyncedMeta

Re-exports ICustomBaseObjectSyncedMeta

ICustomClientServerEvent

Re-exports ICustomClientServerEvent

ICustomClientServerRpc

Re-exports ICustomClientServerRpc

ICustomEntityStreamSyncedMeta

Re-exports ICustomEntityStreamSyncedMeta

ICustomEntitySyncedMeta

Re-exports ICustomEntitySyncedMeta

ICustomGlobalMeta

Re-exports ICustomGlobalMeta

ICustomGlobalSyncedMeta

Re-exports ICustomGlobalSyncedMeta

ICustomPedStreamSyncedMeta

Re-exports ICustomPedStreamSyncedMeta

ICustomPedSyncedMeta

Re-exports ICustomPedSyncedMeta

ICustomPlayerLocalMeta

Re-exports ICustomPlayerLocalMeta

ICustomPlayerStreamSyncedMeta

Re-exports ICustomPlayerStreamSyncedMeta

ICustomPlayerSyncedMeta

Re-exports ICustomPlayerSyncedMeta

ICustomServerClientEvent

Re-exports ICustomServerClientEvent

ICustomServerClientRpc

Re-exports ICustomServerClientRpc

ICustomVehicleStreamSyncedMeta

Re-exports ICustomVehicleStreamSyncedMeta

ICustomVehicleSyncedMeta

Re-exports ICustomVehicleSyncedMeta

ICustomVirtualEntityStreamSyncedMeta

Re-exports ICustomVirtualEntityStreamSyncedMeta

IInspectOptions

Re-exports IInspectOptions

IQuaternion

Re-exports IQuaternion

IResource

Re-exports IResource

IResourceConfig

Re-exports IResourceConfig

IVector2

Re-exports IVector2

IVector3

Re-exports IVector3

IWeapon

Re-exports IWeapon

KeyCode

Re-exports KeyCode

MarkerType

Re-exports MarkerType

ModelType

Re-exports ModelType

PedConfigFlag

Re-exports PedConfigFlag

Permission

Re-exports Permission

Quaternion

Re-exports Quaternion

RGBA

Re-exports RGBA

Resource

Re-exports Resource

Utils

Re-exports Utils

Vector2

Re-exports Vector2

Vector3

Re-exports Vector3

VehicleLockState

Re-exports VehicleLockState

VoiceConnectionState

Re-exports VoiceConnectionState

branch

Re-exports branch

clearEveryTick

Re-exports clearEveryTick

clearInterval

Re-exports clearInterval

clearNextTick

Re-exports clearNextTick

clearTimeout

Re-exports clearTimeout

debug

Re-exports debug

defaultDimension

Re-exports defaultDimension

deleteMeta

Re-exports deleteMeta

emit

Re-exports emit

emitRaw

Re-exports emitRaw

everyTick

Re-exports everyTick

getAllResources

Re-exports getAllResources

getEventListeners

Re-exports getEventListeners

getMeta

Re-exports getMeta

getMetaKeys

Re-exports getMetaKeys

getNetTime

Re-exports getNetTime

getSyncedMeta

Re-exports getSyncedMeta

getSyncedMetaKeys

Re-exports getSyncedMetaKeys

getVoiceConnectionState

Re-exports getVoiceConnectionState

globalDimension

Re-exports globalDimension

hasMeta

Re-exports hasMeta

hasResource

Re-exports hasResource

hasSyncedMeta

Re-exports hasSyncedMeta

hash

Re-exports hash

isClient

Re-exports isClient

isServer

Re-exports isServer

log

Re-exports log

logDebug

Re-exports logDebug

logError

Re-exports logError

logWarning

Re-exports logWarning

nextTick

Re-exports nextTick

off

Re-exports off

on

Re-exports on

once

Re-exports once

resourceName

Re-exports resourceName

sdkVersion

Re-exports sdkVersion

setInterval

Re-exports setInterval

setMeta

Re-exports setMeta

setTimeout

Re-exports setTimeout

stringToSHA256

Re-exports stringToSHA256

time

Re-exports time

timeEnd

Re-exports timeEnd

version

Re-exports version

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 rootDir

rootDir: string

The root directory of the server.

Functions

addClientConfigKey

  • addClientConfigKey(key: string): void
  • Adds an extra config key that will be passed from resource.toml to client

    Parameters

    • key: string

      the key to be added

    Returns void

deleteSyncedMeta

  • deleteSyncedMeta(key: string): void
  • deleteSyncedMeta<K>(key: K): void
  • Removes the specified key and the data connected to that specific key.

    Parameters

    • key: string

      The key of the value to remove.

    Returns void

  • Type parameters

    Parameters

    • key: K

    Returns void

emit

  • emit<K>(eventName: K, ...args: Parameters<ICustomEmitEvent[K]>): void
  • emit<K>(eventName: Exclude<K, keyof IServerEvent | keyof ICustomEmitEvent>, ...args: any[]): void
  • Emits specified event across resources.

    Type parameters

    Parameters

    • eventName: K

      Name of the event.

    • Rest ...args: Parameters<ICustomEmitEvent[K]>

      Rest parameters for emit to send.

    Returns void

  • Type parameters

    • K: string

    Parameters

    Returns void

emitAllClients

  • emitAllClients<K>(eventName: K, ...args: Parameters<ICustomServerClientEvent[K]>): void
  • emitAllClients<K>(eventName: Exclude<K, keyof ICustomServerClientEvent>, ...args: any[]): void
  • Emits specified event to all clients.

    Type parameters

    Parameters

    • eventName: K

      Name of the event.

    • Rest ...args: Parameters<ICustomServerClientEvent[K]>

      Rest parameters for emit to send.

    Returns void

  • Type parameters

    • K: string

    Parameters

    Returns void

emitAllClientsRaw

  • emitAllClientsRaw<K>(eventName: K, ...args: Parameters<ICustomServerClientEvent[K]>): void
  • emitAllClientsRaw<K>(eventName: Exclude<K, keyof ICustomServerClientEvent>, ...args: any[]): void
  • Emits specified event to all clients.

    Type parameters

    Parameters

    • eventName: K

      Name of the event.

    • Rest ...args: Parameters<ICustomServerClientEvent[K]>

      Rest parameters for emit to send.

    Returns void

  • Type parameters

    • K: string

    Parameters

    Returns void

emitAllClientsUnreliable

  • emitAllClientsUnreliable<K>(eventName: K, ...args: Parameters<ICustomServerClientEvent[K]>): void
  • emitAllClientsUnreliable<K>(eventName: Exclude<K, keyof ICustomServerClientEvent>, ...args: any[]): void
  • Emits specified event to all clients.

    remarks

    Unreliable event should be used when you don't need to be sure that event will be received by client.

    Type parameters

    Parameters

    • eventName: K

      Name of the event.

    • Rest ...args: Parameters<ICustomServerClientEvent[K]>

      Rest parameters for emit to send.

    Returns void

  • Type parameters

    • K: string

    Parameters

    Returns void

emitClient

  • Emits specified event to specific client.

    Type parameters

    Parameters

    • player: Player | Player[]

      Event is sent to specific player or players.

    • eventName: K

      Name of the event.

    • Rest ...args: Parameters<ICustomServerClientEvent[K]>

      Rest parameters for emit to send.

    Returns void

  • Type parameters

    • K: string

    Parameters

    Returns void

emitClientRaw

  • Emits specified event to specific client.

    Type parameters

    Parameters

    • player: Player | Player[]

      Event is sent to specific player or players.

    • eventName: K

      Name of the event.

    • Rest ...args: Parameters<ICustomServerClientEvent[K]>

      Rest parameters for emit to send.

    Returns void

  • Type parameters

    • K: string

    Parameters

    Returns void

emitClientUnreliable

  • emitClientUnreliable<K>(player: Player | Player[], eventName: K, ...args: Parameters<ICustomServerClientEvent[K]>): void
  • emitClientUnreliable<K>(player: Player | Player[], eventName: Exclude<K, keyof ICustomServerClientEvent>, ...args: any[]): void
  • Emits specified event to specific client.

    remarks

    Unreliable event should be used when you don't need to be sure that event will be received by client.

    Type parameters

    Parameters

    • player: Player | Player[]

      Event is sent to specific player or players.

    • eventName: K

      Name of the event.

    • Rest ...args: Parameters<ICustomServerClientEvent[K]>

      Rest parameters for emit to send.

    Returns void

  • Type parameters

    • K: string

    Parameters

    Returns void

emitRaw

  • emitRaw<K>(eventName: K, ...args: Parameters<ICustomEmitEvent[K]>): void
  • emitRaw<K>(eventName: Exclude<K, keyof IServerEvent | keyof ICustomEmitEvent>, ...args: any[]): void
  • Emits specified event across resources.

    remarks

    Works only from JS resource to JS resource

    Type parameters

    Parameters

    • eventName: K

      Name of the event.

    • Rest ...args: Parameters<ICustomEmitEvent[K]>

      Rest parameters for emit to send.

    Returns void

  • Type parameters

    • K: string

    Parameters

    Returns void

getAmmoHashForWeaponHash

  • getAmmoHashForWeaponHash(weaponModelHash: number): number
  • Parameters

    • weaponModelHash: number

    Returns number

getClosestEntities

  • Returns only the closest entities of the specified type (or types) at the specified position, in the given range, dimension and limit.

    example
    // Returns closest players and vehicles (from 0 to 2 entities inclusive, because limit is 2)
    // in a range equal to 3 and dimension equal to 0
    const playersAndVehicles = alt.getClosestEntities(
      alt.Vector3.zero, // position
      3.0, // range
      0, // dimension
      2, // limit
      alt.BaseObjectFilterType.Player | alt.BaseObjectFilterType.Vehicle,
    );
    
    // Same but only players
    const players = alt.getClosestEntities(
      alt.Vector3.zero, // position
      3.0, // range
      0, // dimension
      2, // limit
      alt.BaseObjectFilterType.Player,
    );
    
    remarks

    If two entities are closer than 1 unit to a position, it is not determined which one will be included. For example, if there is a vehicle at 0, 1.5, 0 and player at 0, 1.0, 0, then if we pass position as new alt.Vector3(0, 0, 0) and limit as 1 vehicle may be returned but the player will not.

    Parameters

    • position: IVector3
    • range: number

      Can be set to 0 to get entities in any range.

    • dimension: number

      Can be set to "alt-shared".globalDimension to get entities in any dimension.

    • limit: number

      How many entities to return if there are more entities in the specified range, dimension. (-1 to disable).

    • allowedTypes: BaseObjectFilterType

    Returns readonly Entity[]

getColShapeTickRate

  • getColShapeTickRate(): number
  • Returns number

getEntitiesInDimension

  • Returns all entities of the specified type (or types) in the specified dimension.

    example
    // Returns all players and vehicles in zero dimension
    const playersAndVehicles = alt.getEntitiesInDimension(
      0, // dimension
      alt.BaseObjectFilterType.Player | alt.BaseObjectFilterType.Vehicle,
    );
    
    // Returns only players in zero dimension
    const players = alt.getEntitiesInDimension(
      0, // dimension
      alt.BaseObjectFilterType.Player,
    );
    

    Parameters

    Returns readonly Entity[]

getEntitiesInRange

  • Returns all entities of the specified type (or types) at the specified position, in the given range and dimension.

    example
    // Returns all players and vehicles in a range equal to 3 and dimension equal to 0
    const playersAndVehicles = alt.getEntitiesInRange(
      alt.Vector3.zero, // position
      3.0, // range
      0, // dimension
      alt.BaseObjectFilterType.Player | alt.BaseObjectFilterType.Vehicle,
    );
    
    // Returns players in a range equal to 3 and dimension equal to 0
    const players = alt.getEntitiesInRange(
      alt.Vector3.zero, // position
      3.0, // range
      0, // dimension
      alt.BaseObjectFilterType.Player,
    );
    

    Parameters

    Returns readonly Entity[]

getLoadedVehicleModels

  • getLoadedVehicleModels(): number[]
  • Returns number[]

getMaxStreamingObjects

  • getMaxStreamingObjects(): number
  • Returns number

getMaxStreamingPeds

  • getMaxStreamingPeds(): number
  • Returns number

getMaxStreamingVehicles

  • getMaxStreamingVehicles(): number
  • Returns number

getMigrationDistance

  • getMigrationDistance(): number
  • Returns number

getMigrationThreadCount

  • getMigrationThreadCount(): number
  • Returns number

getMigrationTickRate

  • getMigrationTickRate(): number
  • Returns number

getPedModelInfoByHash

  • getPedModelInfoByHash(pedModelHash: number): IPedModel
  • Parameters

    • pedModelHash: number

    Returns IPedModel

getRemoteEventListeners

  • getRemoteEventListeners(eventName: string | null): readonly ((...args: any[]) => void)[]
  • Gets all the listeners that have been subscribed using onClient for the specified remote event.

    Parameters

    • eventName: string | null

      Name of the event or null for generic event.

    Returns readonly ((...args: any[]) => void)[]

    Array of listener functions for that event.

getServerConfig

getStreamerThreadCount

  • getStreamerThreadCount(): number
  • Returns number

getStreamingDistance

  • getStreamingDistance(): number
  • Returns number

getStreamingTickRate

  • getStreamingTickRate(): number
  • Returns number

getSyncReceiveThreadCount

  • getSyncReceiveThreadCount(): number
  • Returns number

getSyncSendThreadCount

  • getSyncSendThreadCount(): number
  • Returns number

getVehicleModelInfoByHash

  • Parameters

    • vehicleHash: number

    Returns IVehicleModel

getWeaponModelInfoByHash

  • getWeaponModelInfoByHash(weaponModelHash: number): IWeaponModel
  • Parameters

    • weaponModelHash: number

    Returns IWeaponModel

hasBenefit

  • hasBenefit(benefit: Benefit): boolean
  • Checks wheter or not the server has a specific benefit.

    Parameters

    • benefit: Benefit

      benefit to check

    Returns boolean

hashServerPassword

  • hashServerPassword(password: string): bigint
  • Hash a string with alt:V algorithm.

    Parameters

    • password: string

      The string you want to hash.

    Returns bigint

off

  • Unsubscribes from a event with the specified listener.

    remarks

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

    Type parameters

    Parameters

    Returns void

  • Type parameters

    • K: string

    Parameters

    • eventName: Exclude<K, keyof IServerEvent | keyof ICustomEmitEvent>
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns void

offClient

  • offClient<K>(eventName: K, listener: (player: Player, ...args: Parameters<ICustomClientServerEvent[K]>) => void): void
  • offClient<K>(eventName: Exclude<K, keyof ICustomClientServerEvent>, listener: (player: Player, ...args: any[]) => void): void
  • offClient(eventName: string, listener: (player: Player, ...args: any[]) => void): void
  • offClient(listener: (eventName: string, ...args: any[]) => void): void
  • Unsubscribes from a client event with the specified listener.

    remarks

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

    Type parameters

    Parameters

    • eventName: K

      Name of the event.

    • listener: (player: Player, ...args: Parameters<ICustomClientServerEvent[K]>) => void

      Listener that should be removed.

        • (player: Player, ...args: Parameters<ICustomClientServerEvent[K]>): void
        • Parameters

          • player: Player
          • Rest ...args: Parameters<ICustomClientServerEvent[K]>

          Returns void

    Returns void

  • Type parameters

    • K: string

    Parameters

    Returns void

  • Parameters

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

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

          Returns void

    Returns void

  • Unsubscribes from all user-created client events with the specified listener.

    remarks

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

    Parameters

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

      Listener that should be removed.

        • (eventName: string, ...args: any[]): void
        • Parameters

          • eventName: string
          • Rest ...args: any[]

          Returns void

    Returns void

offRpc

  • offRpc<K>(rpcName: string, listener: (player: Player, ...args: Parameters<ICustomClientServerRpc[K]>) => Promise<ReturnType<ICustomClientServerRpc[K]>> | ReturnType<ICustomClientServerRpc[K]>): void
  • offRpc<K>(rpcName: Exclude<K, keyof ICustomClientServerRpc>, listener?: (player: Player, ...args: any[]) => Promise<any> | any): void
  • Type parameters

    Parameters

    • rpcName: string

      Name of the RPC

    • listener: (player: Player, ...args: Parameters<ICustomClientServerRpc[K]>) => Promise<ReturnType<ICustomClientServerRpc[K]>> | ReturnType<ICustomClientServerRpc[K]>

      Listener that should be removed (if not passed current listener will be removed).

        • (player: Player, ...args: Parameters<ICustomClientServerRpc[K]>): Promise<ReturnType<ICustomClientServerRpc[K]>> | ReturnType<ICustomClientServerRpc[K]>
        • Parameters

          • player: Player
          • Rest ...args: Parameters<ICustomClientServerRpc[K]>

          Returns Promise<ReturnType<ICustomClientServerRpc[K]>> | ReturnType<ICustomClientServerRpc[K]>

    Returns void

  • Type parameters

    • K: string

    Parameters

    • rpcName: Exclude<K, keyof ICustomClientServerRpc>
    • Optional listener: (player: Player, ...args: any[]) => Promise<any> | any
        • (player: Player, ...args: any[]): Promise<any> | any
        • Parameters

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

          Returns Promise<any> | any

    Returns void

on

  • Subscribes to a server event with the specified listener.

    Type parameters

    Parameters

    Returns void

  • Type parameters

    • K: string

    Parameters

    • eventName: Exclude<K, keyof IServerEvent | keyof ICustomEmitEvent>
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns void

onClient

  • onClient<K>(eventName: K, listener: (player: Player, ...args: Parameters<ICustomClientServerEvent[K]>) => void): void
  • onClient<K>(eventName: Exclude<K, keyof ICustomClientServerEvent>, listener: (player: Player, ...args: any[]) => void): void
  • onClient(listener: (eventName: string, player: Player, ...args: any[]) => void): void
  • Subscribes to a client event with the specified listener.

    Type parameters

    Parameters

    • eventName: K

      Name of the event.

    • listener: (player: Player, ...args: Parameters<ICustomClientServerEvent[K]>) => void

      Listener that should be added.

        • (player: Player, ...args: Parameters<ICustomClientServerEvent[K]>): void
        • Parameters

          • player: Player
          • Rest ...args: Parameters<ICustomClientServerEvent[K]>

          Returns void

    Returns void

  • Type parameters

    • K: string

    Parameters

    Returns void

  • Subscribes to all client events with the specified listener.

    remarks

    Listener will be only called for user-created events.

    Parameters

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

      Listener that should be added.

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

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

          Returns void

    Returns void

onRpc

  • onRpc<K>(rpcName: K, listener: (player: Player, ...args: Parameters<ICustomClientServerRpc[K]>) => Promise<ReturnType<ICustomClientServerRpc[K]>> | ReturnType<ICustomClientServerRpc[K]>): void
  • onRpc<K>(rpcName: Exclude<K, keyof ICustomClientServerRpc>, listener: (player: Player, ...args: any[]) => Promise<any> | any): void
  • Subscribes to a client -> server RPC with the specified listener.

    example
    alt.onRpc("testRpc", (player, ...args) => {
        alt.log(`${player.name} called testRpc`, args);
    
       // throw new Error("I am an error! Notice me!");
       return [1, 2, [10, 13, 19], false, "hey there"];
    });
    
    remarks

    The return value of the listener function determines the response clients will receive. When returning multiple values, use an array. Returning an Error object will cause the promise on the client to throw an exception which has to be caught.

    Type parameters

    Parameters

    • rpcName: K

      Name of the RPC

    • listener: (player: Player, ...args: Parameters<ICustomClientServerRpc[K]>) => Promise<ReturnType<ICustomClientServerRpc[K]>> | ReturnType<ICustomClientServerRpc[K]>

      Listener to be assigned to this RPC name (there can only be one listener for each RPC name).

        • (player: Player, ...args: Parameters<ICustomClientServerRpc[K]>): Promise<ReturnType<ICustomClientServerRpc[K]>> | ReturnType<ICustomClientServerRpc[K]>
        • Parameters

          • player: Player
          • Rest ...args: Parameters<ICustomClientServerRpc[K]>

          Returns Promise<ReturnType<ICustomClientServerRpc[K]>> | ReturnType<ICustomClientServerRpc[K]>

    Returns void

  • Type parameters

    • K: string

    Parameters

    • rpcName: Exclude<K, keyof ICustomClientServerRpc>
    • listener: (player: Player, ...args: any[]) => Promise<any> | any
        • (player: Player, ...args: any[]): Promise<any> | any
        • Parameters

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

          Returns Promise<any> | any

    Returns void

once

  • Subscribes to a server event with the specified listener, which only triggers once.

    Type parameters

    Parameters

    Returns void

  • Type parameters

    • K: string

    Parameters

    • eventName: Exclude<K, keyof IServerEvent | keyof ICustomEmitEvent>
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns void

onceClient

  • onceClient<K>(eventName: K, listener: (player: Player, ...args: Parameters<ICustomClientServerEvent[K]>) => void): void
  • onceClient<K>(eventName: Exclude<K, keyof ICustomClientServerEvent>, listener: (player: Player, ...args: any[]) => void): void
  • onceClient(listener: (eventName: string, player: Player, ...args: any[]) => void): void
  • Subscribes to a client event with the specified listener, which only triggers once.

    Type parameters

    Parameters

    • eventName: K

      Name of the event.

    • listener: (player: Player, ...args: Parameters<ICustomClientServerEvent[K]>) => void

      Listener that should be added.

        • (player: Player, ...args: Parameters<ICustomClientServerEvent[K]>): void
        • Parameters

          • player: Player
          • Rest ...args: Parameters<ICustomClientServerEvent[K]>

          Returns void

    Returns void

  • Type parameters

    • K: string

    Parameters

    Returns void

  • Subscribes to all client events with the specified listener, which only triggers once.

    remarks

    Listener will be only called for user-created events.

    Parameters

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

      Listener that should be added.

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

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

          Returns void

    Returns void

restartResource

  • restartResource(name: string): void
  • Restarts the specified resource.

    Parameters

    • name: string

      Name of the resource.

    Returns void

setColShapeTickRate

  • setColShapeTickRate(count: number): void
  • Parameters

    • count: number

    Returns void

setMaxStreamingObjects

  • setMaxStreamingObjects(limit: number): void
  • Parameters

    • limit: number

    Returns void

setMaxStreamingPeds

  • setMaxStreamingPeds(limit: number): void
  • Parameters

    • limit: number

    Returns void

setMaxStreamingVehicles

  • setMaxStreamingVehicles(limit: number): void
  • Parameters

    • limit: number

    Returns void

setMigrationDistance

  • setMigrationDistance(count: number): void
  • Parameters

    • count: number

    Returns void

setMigrationThreadCount

  • setMigrationThreadCount(count: number): void
  • Parameters

    • count: number

    Returns void

setMigrationTickRate

  • setMigrationTickRate(count: number): void
  • Parameters

    • count: number

    Returns void

setPassword

  • setPassword(password: string): void
  • Change the server password at runtime.

    Parameters

    • password: string

      The new server password.

    Returns void

setStreamerThreadCount

  • setStreamerThreadCount(count: number): void
  • Parameters

    • count: number

    Returns void

setStreamingDistance

  • setStreamingDistance(distance: number): void
  • Parameters

    • distance: number

    Returns void

setStreamingTickRate

  • setStreamingTickRate(count: number): void
  • Parameters

    • count: number

    Returns void

setSyncReceiveThreadCount

  • setSyncReceiveThreadCount(count: number): void
  • Parameters

    • count: number

    Returns void

setSyncSendThreadCount

  • setSyncSendThreadCount(count: number): void
  • Parameters

    • count: number

    Returns void

setSyncedMeta

  • setSyncedMeta<K>(key: K, value: shared.InterfaceValueByKey<ICustomGlobalSyncedMeta, K>): void
  • setSyncedMeta<K>(key: K, value: ICustomGlobalSyncedMeta[K]): void
  • setSyncedMeta<V, K>(key: K, value: shared.InterfaceValueByKey<ICustomGlobalSyncedMeta, K, V>): void
  • Stores the given value with the specified key.

    remarks

    The given value will be shared with all client resources.

    Type parameters

    • K: string

    Parameters

    • key: K

      The key of the value to store.

    • value: shared.InterfaceValueByKey<ICustomGlobalSyncedMeta, K>

      The value to store.

    Returns void

  • Type parameters

    Parameters

    • key: K
    • value: ICustomGlobalSyncedMeta[K]

    Returns void

  • Type parameters

    • V: any

    • K: string = string

    Parameters

    Returns void

setVoiceExternal

  • setVoiceExternal(phost: string, port: number): void
  • Parameters

    • phost: string
    • port: number

    Returns void

setVoiceExternalPublic

  • setVoiceExternalPublic(host: string, port: number): void
  • Parameters

    • host: string
    • port: number

    Returns void

startResource

  • startResource(name: string): void
  • Starts the specified resource.

    Parameters

    • name: string

      Name of the resource.

    Returns void

stopResource

  • stopResource(name: string): void
  • Stops the specified resource.

    Parameters

    • name: string

      Name of the resource.

    Returns void

stopServer

  • stopServer(): void
  • Returns void

toggleWorldProfiler

  • toggleWorldProfiler(state: boolean): void
  • Parameters

    • state: boolean

    Returns void