diff --git a/client/index.d.ts b/client/index.d.ts index 3567083a..f6a0aa30 100644 --- a/client/index.d.ts +++ b/client/index.d.ts @@ -2602,20 +2602,30 @@ declare module "alt-client" { export function emitRpc(rpcName: Exclude, ...args: any[]): Promise; /** - * Subscribes to a client event with the specified listener. + * Subscribes to a server -> client RPC with the specified listener. * @param rpcName Name of the RPC - * @param listener Listener that should be added. + * @param listener Listener to be assigned to this RPC name (there can only be one listener for each RPC name). + * + * * @example + * ```js + * alt.onRpc("testRpc", (...args) => { + * alt.log(`server called testRpc`, args); * - * @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 server to throw an exception which has to be caught. + * // 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 server will receive. When returning multiple values, use an array. Returning an Error object will cause the promise on the server to throw an exception which has to be caught. * */ - export function onRpc(rpcName: K, listener: (...args: Parameters) => Promise> | ReturnType): void; + export function onRpc(rpcName: K, listener: (...args: Parameters) => Promise> | ReturnType): void; export function onRpc(rpcName: Exclude, listener: (...args: any[]) => Promise | any): void; /** * * @param rpcName Name of the RPC - * @param listener Listener that should be added. + * @param listener Listener that should be removed (if not passed current listener will be removed). * */ export function offRpc(rpcName: K, listener?: (...args: Parameters) => Promise> | ReturnType): void; @@ -3927,6 +3937,11 @@ declare module "alt-client" { */ public static getByScriptID(scriptID: number): Ped | null; + /** + * Gets the ped with the given remote id + */ + public static getByRemoteID(id: number): Ped | null; + public static readonly all: readonly Ped[]; public static readonly streamedIn: readonly Ped[]; diff --git a/docs/articles/events/index.md b/docs/articles/events/index.md index b3ac5389..717ea0c1 100644 --- a/docs/articles/events/index.md +++ b/docs/articles/events/index.md @@ -52,7 +52,7 @@ alt.on('playerConnect', player => { The client may only emit data to the server-side with `emitServer` or `emitServerRaw`. `emitServerRaw` is used for big data and is faster than `emitServer` and `emitServerRaw` only works, if the server is using javascript. -The server-side `onServer` event handlers will automatically receive the player that sent the event as the first argument. +The server-side `onClient` event handlers will automatically receive the player that sent the event as the first argument. # [Client-side](#tab/tab2-0) ```js diff --git a/docs/articles/setup.md b/docs/articles/setup.md index 87ff5b57..ef594ea2 100644 --- a/docs/articles/setup.md +++ b/docs/articles/setup.md @@ -9,6 +9,7 @@ This article will explain how to setup an alt:V server with the JS module. - Basic knowledge of command prompts - VC Redist Latest Version installed - Windows 10+ or Linux (For running the server) +- On Linux you need the package libatomic1 `apt-get install libatomic1` ## Summary diff --git a/server/index.d.ts b/server/index.d.ts index 1df02b58..7111ff6c 100644 --- a/server/index.d.ts +++ b/server/index.d.ts @@ -3000,9 +3000,9 @@ declare module "alt-server" { export function emitAllClientsUnreliable(eventName: Exclude, ...args: any[]): void; /** - * Subscribes to a client event with the specified listener. + * Subscribes to a client -> server RPC with the specified listener. * @param rpcName Name of the RPC - * @param listener Listener that should be added. + * @param listener Listener to be assigned to this RPC name (there can only be one listener for each RPC name). * * @example * ```js @@ -3013,6 +3013,7 @@ declare module "alt-server" { * 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. * */ @@ -3022,7 +3023,7 @@ declare module "alt-server" { /** * * @param rpcName Name of the RPC - * @param listener Listener that should be added. + * @param listener Listener that should be removed (if not passed current listener will be removed). * */ export function offRpc(rpcName: string, listener: (player: Player, ...args: Parameters) => Promise> | ReturnType): void; diff --git a/server/package.json b/server/package.json index 41636d4f..3415dac2 100644 --- a/server/package.json +++ b/server/package.json @@ -1,6 +1,6 @@ { "name": "@altv/types-server", - "version": "16.0.7", + "version": "16.0.8", "description": "This package contains types definitions for alt:V server-side module.", "types": "index.d.ts", "files": [