@gta5urban/types-server 2.2.1 → 2.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.d.ts +55 -3
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -1342,7 +1342,6 @@ declare interface IServerEvents {
1342
1342
  vehicleHornToggle: (vehicle: VehicleMp, toggle: boolean) => void;
1343
1343
  vehicleSirenToggle: (vehicle: VehicleMp, toggle: boolean) => void;
1344
1344
  }
1345
-
1346
1345
  declare class EventMp {
1347
1346
  // @ts-ignore
1348
1347
  constructor<K extends keyof IServerEvents>(eventName: K, callback: IServerEvents[K]);
@@ -1943,13 +1942,64 @@ declare interface CommandsMpArgs<K extends keyof CommandsMpArgType = keyof Comma
1943
1942
  rest?: boolean;
1944
1943
  }
1945
1944
 
1945
+ declare interface CommandsMpInternal<T extends CommandsMpArgs[] = CommandsMpArgs[]> extends CommandsMpOptions<T> {
1946
+ lastUse: Map<number, number>;
1947
+ }
1948
+
1946
1949
  declare interface CommandsMp {
1947
1950
  add: <T extends CommandsMpArgs[]>(command: CommandsMpOptions<T>) => void;
1948
1951
  execute: (player: PlayerMp, raw: string) => void;
1949
- commands: Map<string, CommandsMpOptions & { lastUse: Map<number, number> }>;
1952
+ commands: Map<string, CommandsMpInternal>;
1950
1953
  getCommands: (player: PlayerMp) => CommandsMpInterface[];
1951
1954
  }
1952
1955
 
1956
+ declare namespace rpc {
1957
+ export function register(name: string, cb: ProcedureListener): () => void;
1958
+ export function unregister(name: string): void;
1959
+
1960
+ export function call<T = any>(name: string, args?: any, options?: CallOptions): Promise<T>;
1961
+ export function callServer<T = any>(name: string, args?: any, options?: CallOptions): Promise<T>;
1962
+ export function callClient<T = any>(player: Player, name: string, args?: any, options?: CallOptions): Promise<T>;
1963
+ export function callClient<T = any>(name: string, args?: any, options?: CallOptions): Promise<T>;
1964
+ export function callBrowsers<T = any>(player: Player, name: string, args?: any, options?: CallOptions): Promise<T>;
1965
+ export function callBrowsers<T = any>(name: string, args?: any, options?: CallOptions): Promise<T>;
1966
+ export function callBrowser<T = any>(browser: Browser, name: string, args?: any, options?: CallOptions): Promise<T>;
1967
+
1968
+ export function on(name: string, cb: ProcedureListener): () => void;
1969
+ export function off(name: string, cb: ProcedureListener): void;
1970
+
1971
+ export function trigger(name: string, args?: any): void;
1972
+ export function triggerServer(name: string, args?: any): void;
1973
+ export function triggerClient(player: Player, name: string, args?: any): void;
1974
+ export function triggerClient(name: string, args?: any): void;
1975
+ export function triggerBrowsers(player: Player, name: string, args?: any): void;
1976
+ export function triggerBrowsers(name: string, args?: any): void;
1977
+ export function triggerBrowser(browser: Browser, name: string, args?: any): void;
1978
+
1979
+ export interface Player {
1980
+ call: (eventName: string, args?: any[]) => void;
1981
+ [property: string]: any;
1982
+ }
1983
+
1984
+ export interface Browser {
1985
+ execute: (code: string) => void;
1986
+ [property: string]: any;
1987
+ }
1988
+
1989
+ export interface ProcedureListenerInfo {
1990
+ environment: string;
1991
+ id?: string;
1992
+ player?: Player;
1993
+ }
1994
+
1995
+ export interface CallOptions {
1996
+ timeout?: number;
1997
+ noRet?: boolean;
1998
+ }
1999
+
2000
+ export type ProcedureListener = (args: any, info: ProcedureListenerInfo) => any;
2001
+ }
2002
+
1953
2003
 
1954
2004
  declare interface Mp {
1955
2005
  Player: typeof PlayerMp;
@@ -1996,9 +2046,11 @@ declare interface Mp {
1996
2046
  /**
1997
2047
  * custom command entities
1998
2048
  */
1999
-
2049
+
2000
2050
  commands: CommandsMp;
2001
2051
 
2052
+ rpc: typeof rpc;
2053
+
2002
2054
  }
2003
2055
 
2004
2056
  declare const mp: Mp;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gta5urban/types-server",
3
- "version": "2.2.1",
3
+ "version": "2.2.3",
4
4
  "description": "Types definitions for RAGE:MP server-side module",
5
5
  "main": "index.d.ts",
6
6
  "files": [