mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
feat(calling/client|server): partical functions for calling
Should probably reuse data
This commit is contained in:
1 parent
c12b0ba126
commit
77c7cc303e
8 files changed
+133
-56
No files matched your search
+37
-22
@@ -3,35 +3,50 @@ 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) => {
|
||||
console.log('PHONE NUMBER YOU ARE TRYING TO CALL', data.number);
|
||||
emitNet(events.PHONE_BEGIN_CALL, data.number);
|
||||
});
|
||||
|
||||
onNet(events.PHONE_START_CALL, (target: string, phoneNumber: string) => {
|
||||
onNet(events.PHONE_START_CALL, (target: string, phoneNumber: string, isTransmitter: boolean, id: any) => {
|
||||
console.log(`You are talking to ${target} who has the number ${phoneNumber}`);
|
||||
// Temporary for testing
|
||||
exp["mumble-voip"].SetCallChannel(1);
|
||||
exp["mumble-voip"].SetCallChannel(id+1);
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: "CALL",
|
||||
method: "callModal",
|
||||
data: true
|
||||
})
|
||||
)
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: "CALL",
|
||||
method: "setCaller",
|
||||
data: {
|
||||
target: target,
|
||||
caller: phoneNumber,
|
||||
transmitter: isTransmitter,
|
||||
accepted: false
|
||||
}
|
||||
})
|
||||
)
|
||||
});
|
||||
|
||||
onNet(events.PHONE_CALL_WAS_ENDED, () => {
|
||||
|
||||
RegisterNuiCallbackType(events.PHONE_ACCEPT_CALL);
|
||||
on(`__cfx_nui:${events.PHONE_ACCEPT_CALL}`, (data: any) => {
|
||||
emitNet(events.PHONE_ACCEPT_CALL, data.phoneNumber)
|
||||
})
|
||||
|
||||
onNet('phone:callAccepted', (id: number) => {
|
||||
exp["mumble-voip"].SetRadioChannel(id);
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
/* onNet(events.PHONE_CALL_WAS_ENDED, () => {
|
||||
console.log("Call ended");
|
||||
exp["mumble-voip"].SetCallChannel(0);
|
||||
});
|
||||
}); */
|
||||
Reference in new issue
Block a user