From b0b8a687e8dc68ca97839b98c7103d2b34c4965a Mon Sep 17 00:00:00 2001 From: chip Date: Fri, 6 Nov 2020 12:55:11 +0100 Subject: [PATCH] new nui callbacks for each app --- resources/client/cl_main.ts | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/resources/client/cl_main.ts b/resources/client/cl_main.ts index a787742..dfe2942 100644 --- a/resources/client/cl_main.ts +++ b/resources/client/cl_main.ts @@ -235,11 +235,6 @@ async function Phone() { isPhoneOpen = true; await phoneOpenAnim(); // Animation starts before the phone is open emitNet('phone:getCredentials') - emitNet(events.CONTACTS_GET_CONTACTS); - emitNet(events.SELLOUT_FETCH_LISTING); - emitNet(events.BANK_FETCH_TRANSACTIONS); - emitNet(events.BANK_GET_CREDENTIALS); - emitNet(events.NOTE_FETCH_ALL_NOTES); console.log("Sellout fetched from client side")// Gets the credentials. Will eventually most likely only get the phone number and name, idk. SetCursorLocation(0.90, 0.922) //Experimental let res = GetActiveScreenResolution() @@ -275,11 +270,6 @@ async function Phone() { isPhoneOpen = true; await phoneOpenAnim(); // Animation starts before the phone is open emitNet('phone:getCredentials') - emitNet(events.CONTACTS_GET_CONTACTS); - emitNet(events.SELLOUT_FETCH_LISTING); - emitNet(events.BANK_FETCH_TRANSACTIONS); - emitNet(events.BANK_GET_CREDENTIALS); - emitNet(events.NOTE_FETCH_ALL_NOTES); console.log("Sellout fetched from client side") SetCursorLocation(0.936, 0.922) //Experimental let res = GetActiveScreenResolution() @@ -308,6 +298,30 @@ async function Phone() { } } +// DO NOT CHANGE THIS EITHER, PLEASE - CHIP + +// contacts app +RegisterNuiCallbackType(events.OPEN_APP_CONTACTS); +on(`__cfx_nui:${events.OPEN_APP_CONTACTS}`, () => { + emitNet(events.CONTACTS_GET_CONTACTS); +}) + +RegisterNuiCallbackType(events.OPEN_APP_LISTINGS); +on(`__cfx_nui:${events.OPEN_APP_LISTINGS}`, () => { + emitNet(events.SELLOUT_FETCH_LISTING); +}) + +RegisterNuiCallbackType(events.OPEN_APP_NOTES); +on(`__cfx_nui:${events.OPEN_APP_NOTES}`, () => { + emitNet(events.NOTE_FETCH_ALL_NOTES); +}) + +RegisterNuiCallbackType(events.OPEN_APP_BANK); +on(`__cfx_nui:${events.OPEN_APP_BANK}`, () => { + emitNet(events.BANK_FETCH_TRANSACTIONS); + emitNet(events.BANK_GET_CREDENTIALS); +}) + RegisterCommand( "phone", () => {