Files
new-phone-who-dis/resources/client/cl_call.ts
T
2021-01-12 23:12:00 -05:00

38 lines
927 B
TypeScript

import { ESX } from './client';
import events from '../utils/events';
const exp = (global as any).exports;
RegisterCommand(
'call',
(source: number, args: string[], raw: any) => {
emitNet(events.PHONE_BEGIN_CALL, args[0]);
},
false
);
setImmediate(() => {
emit('chat:addSuggestion', '/call', 'Call a player', [
{
name: 'Phone Number',
help: 'The phone number to call',
},
]);
});
RegisterNuiCallbackType(events.PHONE_BEGIN_CALL);
on(`__cfx_nui:${events.PHONE_BEGIN_CALL}`, (data: any) => {
emitNet(events.PHONE_BEGIN_CALL, data.number);
});
onNet(events.PHONE_START_CALL, (target: string, phoneNumber: string) => {
console.log(`You are talking to ${target} who has the number ${phoneNumber}`);
// Temporary for testing
exp['mumble-voip'].SetCallChannel(1);
});
onNet(events.PHONE_CALL_WAS_ENDED, () => {
console.log('Call ended');
exp['mumble-voip'].SetCallChannel(0);
});