diff --git a/client/index.d.ts b/client/index.d.ts index 92b680aa..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; diff --git a/server/index.d.ts b/server/index.d.ts index 81d40017..caf89530 100644 --- a/server/index.d.ts +++ b/server/index.d.ts @@ -3004,9 +3004,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 @@ -3017,6 +3017,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. * */ @@ -3026,7 +3027,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;