From 085fb778f1a28dfa16deeaed44f0efab7dd2e42a Mon Sep 17 00:00:00 2001 From: Christopher Date: Tue, 12 Jan 2021 22:01:24 +0100 Subject: [PATCH] feat(calling/client|nui): new command and changed event name --- .../apps/contacts/components/List/ContactList.tsx | 2 +- resources/client/cl_call.ts | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/phone/src/apps/contacts/components/List/ContactList.tsx b/phone/src/apps/contacts/components/List/ContactList.tsx index 3fc0d80..422865b 100644 --- a/phone/src/apps/contacts/components/List/ContactList.tsx +++ b/phone/src/apps/contacts/components/List/ContactList.tsx @@ -51,7 +51,7 @@ export const ContactList = () => { }; const startCall = (number) => { console.log(number); - Nui.send('phone:startCall', { + Nui.send('phone:beginCall', { number, }); }; diff --git a/resources/client/cl_call.ts b/resources/client/cl_call.ts index 7a79533..c3db846 100644 --- a/resources/client/cl_call.ts +++ b/resources/client/cl_call.ts @@ -3,6 +3,20 @@ 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)