UNPKG

rock-mod

Version:

Rock-Mod is a powerful framework designed for creating and managing mods for Grand Theft Auto (GTA) games.

24 lines (23 loc) 730 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AltVRPCManager = void 0; var alt = AltVServer; var Player = AltVServer.Player; class AltVRPCManager { register(rpcName, handler) { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore return alt.onRpc(rpcName, handler); } unregister(rpcName) { return alt.offRpc(rpcName); } emitClient(player, rpcName, ...args) { const mpPlayer = Player.getByID(player.id); if (!mpPlayer) { throw new Error(`Player with id ${player.id} not found`); } return mpPlayer.emitRpc(rpcName, ...args); } } exports.AltVRPCManager = AltVRPCManager;