Client module (alt-client)FunctionsemitRpcemitRpc CallableemitRpc<K>(rpcName: K, ...args: Parameters<ICustomClientServerRpc[K]>): Promise<ReturnType<shared.ICustomClientServerRpc[K]>>emitRpc<K>(rpcName: Exclude<K, never>, ...args: any[]): Promise<any>Calls a server sided RPC with the specified arguments.Example alt.on("consoleCommand", async (cmd) => { if (cmd !== "rpc") return; try { const result = await alt.emitRpc("testRpc"); alt.log("Rpc result:", ...result); } catch (err) { alt.logError(`Failed to call rpc: ${err}`); }});Remarks Exceptions will be thrown when there was an error on server-side.Type parametersK: never
Calls a server sided RPC with the specified arguments.
Example
Remarks
Exceptions will be thrown when there was an error on server-side.