mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
inital ts commit
This commit is contained in:
1 parent
6bb534231b
commit
22c36f0920
2 files changed
+49
No files matched your search
@@ -0,0 +1,15 @@
|
|||||||
|
import { ESX } from './client';
|
||||||
|
import events from '../utils/events';
|
||||||
|
|
||||||
|
const exp = (global as any).exports;
|
||||||
|
|
||||||
|
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, id: any) => {
|
||||||
|
console.log(`You are talking to ${target} who as the number ${phoneNumber}`);
|
||||||
|
exp["mumble-voip"].SetCallChannel(id+1)
|
||||||
|
})
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import { ESX } from './server';
|
||||||
|
import events from '../utils/events';
|
||||||
|
import { getIdentifierByPhoneNumber, usePhoneNumber } from './functions';
|
||||||
|
|
||||||
|
|
||||||
|
function getSourceFromIdentifier(identifier: string, cb: Function) {
|
||||||
|
const xPlayers = ESX.GetPlayers();
|
||||||
|
|
||||||
|
for (let i = 0; i < xPlayers; i++) {
|
||||||
|
const xPlayer = ESX.GetPlayerFromId(xPlayers[i]);
|
||||||
|
if (xPlayer.getIdentifier() != null && xPlayer.getIdentifier() == identifier) {
|
||||||
|
cb(xPlayer.source)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cb(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
onNet(events.PHONE_BEGIN_CALL, async (phoneNumber: string) => {
|
||||||
|
const pSource = (global as any).source;
|
||||||
|
const xPlayer = ESX.GetPlayerFromId(pSource);
|
||||||
|
|
||||||
|
const _identifier = xPlayer.getIdentifier()
|
||||||
|
const callerName = xPlayer.getName()
|
||||||
|
const callerNumber = usePhoneNumber(_identifier);
|
||||||
|
|
||||||
|
const targetIdentifier = await getIdentifierByPhoneNumber(phoneNumber);
|
||||||
|
getSourceFromIdentifier(targetIdentifier, (target: any) => {
|
||||||
|
const xTarget = ESX.GetPlayerFromId(target);
|
||||||
|
const targetName = xTarget.getName()
|
||||||
|
emitNet(events.PHONE_START_CALL, target, callerName, callerNumber, pSource);
|
||||||
|
emitNet(events.PHONE_START_CALL, pSource, targetName, phoneNumber, target);
|
||||||
|
})
|
||||||
|
})
|
||||||
Reference in new issue
Block a user