mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
Merge branch 'master' into feat/sellout-app
This commit is contained in:
46 files changed
+4495
-587
No files matched your search
@@ -1,15 +1,14 @@
|
||||
import { ESX } from '../client/client';
|
||||
import events from '../utils/events';
|
||||
|
||||
import { ESX } from "../client/client";
|
||||
import events from "../utils/events";
|
||||
|
||||
onNet(events.CONTACTS_SEND_CONTACTS, (contacts: any) => {
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: 'CONTACTS',
|
||||
method: 'setContacts',
|
||||
data: contacts
|
||||
app: "CONTACTS",
|
||||
method: "setContacts",
|
||||
data: contacts,
|
||||
})
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
RegisterNuiCallbackType(events.CONTACTS_ADD_CONTACT);
|
||||
@@ -18,7 +17,7 @@ on(`__cfx_nui:${events.CONTACTS_ADD_CONTACT}`, (data: any) => {
|
||||
const number = data.number;
|
||||
const avatar = data.avatar;
|
||||
emitNet(events.CONTACTS_ADD_CONTACT, number, display, avatar);
|
||||
|
||||
|
||||
setTimeout(() => {
|
||||
emitNet(events.CONTACTS_GET_CONTACTS)
|
||||
}, 500)
|
||||
|
||||
+255
-168
@@ -1,128 +1,213 @@
|
||||
import { ESX } from "../client/client";
|
||||
import config from '../utils/config';
|
||||
import { Delay } from '../utils/fivem';
|
||||
import events from '../utils/events';
|
||||
import config from "../utils/config";
|
||||
import { Delay } from "../utils/fivem";
|
||||
import events from "../utils/events";
|
||||
|
||||
|
||||
RegisterCommand('phone:close', (source: any, args: string[], raw: any) => {
|
||||
phoneCloseAnim()
|
||||
SetNuiFocus(false, false)
|
||||
RegisterCommand(
|
||||
"phone:close",
|
||||
(source: any, args: string[], raw: any) => {
|
||||
phoneCloseAnim();
|
||||
SetNuiFocus(false, false);
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: "PHONE",
|
||||
method: "setVisibility",
|
||||
data: false
|
||||
data: false,
|
||||
})
|
||||
)
|
||||
}, false);
|
||||
);
|
||||
},
|
||||
false
|
||||
);
|
||||
|
||||
let prop = 0
|
||||
let isPhoneOpen = false
|
||||
let propCreated = false
|
||||
let phoneModel = "prop_amb_phone" // Refered to in newphoneProp function. Requires custom phone being streamed.
|
||||
let prop = 0;
|
||||
let isPhoneOpen = false;
|
||||
let propCreated = false;
|
||||
let phoneModel = "prop_amb_phone"; // Refered to in newphoneProp function. Requires custom phone being streamed.
|
||||
|
||||
const newPhoneProp = async () => { //Function for creating the phone prop
|
||||
deletePhone() //deletes the already existing prop before creating another.
|
||||
if (!propCreated) {
|
||||
RequestModel(phoneModel)
|
||||
while (!HasModelLoaded(phoneModel)) {
|
||||
await Delay(1)
|
||||
console.log("MODEL HASNT LOADED")
|
||||
}
|
||||
|
||||
const playerPed = PlayerPedId()
|
||||
const [x, y, z] = GetEntityCoords(playerPed, true);
|
||||
prop = CreateObject(GetHashKey(phoneModel), x, y, z + 0.2, true, true, true)
|
||||
//prop = CreateObject(GetHashKey(phoneModel), 1.0, 1.0, 1.0, 1, 1, 0)
|
||||
const boneIndex = GetPedBoneIndex(playerPed, 28422)
|
||||
AttachEntityToEntity(prop, playerPed, boneIndex, 0.0, 0.0, 0.0, 0.0, 0.0, -.0, true, true, false, true, 1.0, true); //-- Attaches the phone to the player.
|
||||
propCreated = true
|
||||
console.log("prop created")
|
||||
const newPhoneProp = async () => {
|
||||
//Function for creating the phone prop
|
||||
deletePhone(); //deletes the already existing prop before creating another.
|
||||
if (!propCreated) {
|
||||
RequestModel(phoneModel);
|
||||
while (!HasModelLoaded(phoneModel)) {
|
||||
await Delay(1);
|
||||
console.log("MODEL HASNT LOADED");
|
||||
}
|
||||
else if (propCreated) {
|
||||
console.log("prop already created")
|
||||
}
|
||||
}
|
||||
|
||||
function deletePhone() { //-- Triggered in newphoneProp function. Only way to destory the prop correctly.
|
||||
if (prop != 0) {
|
||||
const playerPed = PlayerPedId();
|
||||
const [x, y, z] = GetEntityCoords(playerPed, true);
|
||||
prop = CreateObject(
|
||||
GetHashKey(phoneModel),
|
||||
x,
|
||||
y,
|
||||
z + 0.2,
|
||||
true,
|
||||
true,
|
||||
true
|
||||
);
|
||||
//prop = CreateObject(GetHashKey(phoneModel), 1.0, 1.0, 1.0, 1, 1, 0)
|
||||
const boneIndex = GetPedBoneIndex(playerPed, 28422);
|
||||
AttachEntityToEntity(
|
||||
prop,
|
||||
playerPed,
|
||||
boneIndex,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
-0.0,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
1.0,
|
||||
true
|
||||
); //-- Attaches the phone to the player.
|
||||
propCreated = true;
|
||||
console.log("prop created");
|
||||
} else if (propCreated) {
|
||||
console.log("prop already created");
|
||||
}
|
||||
};
|
||||
|
||||
function deletePhone() {
|
||||
//-- Triggered in newphoneProp function. Only way to destory the prop correctly.
|
||||
if (prop != 0) {
|
||||
//Citizen.invokeNative(0xAE3CBE5BF394C9C9 , Citizen.pointerValueIntInitialized(prop))
|
||||
DeleteEntity(prop);
|
||||
prop = 0
|
||||
propCreated = false
|
||||
console.log("prop destroyed")
|
||||
prop = 0;
|
||||
propCreated = false;
|
||||
console.log("prop destroyed");
|
||||
}
|
||||
}
|
||||
|
||||
async function loadAnimDict(dict: any) { //-- Loads the animation dict. Used in the anim functions.
|
||||
while (!HasAnimDictLoaded(dict)) {
|
||||
RequestAnimDict(dict)
|
||||
await Delay(100)
|
||||
async function loadAnimDict(dict: any) {
|
||||
//-- Loads the animation dict. Used in the anim functions.
|
||||
while (!HasAnimDictLoaded(dict)) {
|
||||
RequestAnimDict(dict);
|
||||
await Delay(100);
|
||||
}
|
||||
}
|
||||
|
||||
async function phoneOpenAnim() { //Phone Open Animation
|
||||
console.log("phoneOpenAnim") //Left for testing purposes.
|
||||
const flag = 50 //https://runtime.fivem.net/doc/natives/?_0xEA47FE3719165B94
|
||||
deletePhone() //Deleting before creating a new phone where itll be deleted again.
|
||||
if (IsPedInAnyVehicle(GetPlayerPed(-1), true)) { //-- true refers to at get in.
|
||||
const dict = 'anim@cellphone@in_car@ps'
|
||||
async function phoneOpenAnim() {
|
||||
//Phone Open Animation
|
||||
console.log("phoneOpenAnim"); //Left for testing purposes.
|
||||
const flag = 50; //https://runtime.fivem.net/doc/natives/?_0xEA47FE3719165B94
|
||||
deletePhone(); //Deleting before creating a new phone where itll be deleted again.
|
||||
if (IsPedInAnyVehicle(GetPlayerPed(-1), true)) {
|
||||
//-- true refers to at get in.
|
||||
const dict = "anim@cellphone@in_car@ps";
|
||||
|
||||
ClearPedTasks(GetPlayerPed(-1))
|
||||
await loadAnimDict(dict)
|
||||
TaskPlayAnim(GetPlayerPed(-1), dict, 'cellphone_text_in', 8.0, -1, -1, flag, 0, false, false, false)
|
||||
await Delay(300) //Gives time for animation starts before creating the phone
|
||||
await newPhoneProp() //Creates the phone and attaches it.
|
||||
}
|
||||
else { //While not in a vehicle it will use this dict.
|
||||
const dict = 'cellphone@'
|
||||
ClearPedTasks(GetPlayerPed(-1));
|
||||
await loadAnimDict(dict);
|
||||
TaskPlayAnim(
|
||||
GetPlayerPed(-1),
|
||||
dict,
|
||||
"cellphone_text_in",
|
||||
8.0,
|
||||
-1,
|
||||
-1,
|
||||
flag,
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
);
|
||||
await Delay(300); //Gives time for animation starts before creating the phone
|
||||
await newPhoneProp(); //Creates the phone and attaches it.
|
||||
} else {
|
||||
//While not in a vehicle it will use this dict.
|
||||
const dict = "cellphone@";
|
||||
|
||||
ClearPedTasks(GetPlayerPed(-1))
|
||||
await loadAnimDict(dict)
|
||||
TaskPlayAnim(GetPlayerPed(-1), dict, 'cellphone_text_in', 8.0, -1, -1, flag, 0, false, false, false)
|
||||
await Delay(300) //Gives time for animation starts before creating the phone
|
||||
await newPhoneProp() //Creates the phone and attaches it.
|
||||
}
|
||||
ClearPedTasks(GetPlayerPed(-1));
|
||||
await loadAnimDict(dict);
|
||||
TaskPlayAnim(
|
||||
GetPlayerPed(-1),
|
||||
dict,
|
||||
"cellphone_text_in",
|
||||
8.0,
|
||||
-1,
|
||||
-1,
|
||||
flag,
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
);
|
||||
await Delay(300); //Gives time for animation starts before creating the phone
|
||||
await newPhoneProp(); //Creates the phone and attaches it.
|
||||
}
|
||||
}
|
||||
|
||||
async function phoneCloseAnim() { //Phone Close Animation
|
||||
console.log("phoneCloseAnim") //Left for testing purposes.
|
||||
const flag = 50 //https://runtime.fivem.net/doc/natives/?_0xEA47FE3719165B94
|
||||
const anim = 'cellphone_text_out'
|
||||
if (IsPedInAnyVehicle(GetPlayerPed(-1), true)) { //true refers to at get in.
|
||||
const dict = 'anim@cellphone@in_car@ps'
|
||||
|
||||
StopAnimTask(GetPlayerPed(-1), dict, 'cellphone_text_in', 1.0) //Stop the pull out animation
|
||||
deletePhone() //Deletes the prop early incase they get out of the vehicle.
|
||||
await Delay(250) //lets it get to a certain point
|
||||
loadAnimDict(dict) //loads the new animation
|
||||
TaskPlayAnim(GetPlayerPed(-1), dict, anim, 8.0, -1, -1, flag, 0, false, false, false) //puts phone into pocket
|
||||
await Delay(200) //waits until the phone is in the pocket
|
||||
StopAnimTask(GetPlayerPed(-1), dict, anim, 1.0) //clears the animation
|
||||
}
|
||||
else { //While not in a vehicle it will use this dict.
|
||||
const dict = 'cellphone@'
|
||||
async function phoneCloseAnim() {
|
||||
//Phone Close Animation
|
||||
console.log("phoneCloseAnim"); //Left for testing purposes.
|
||||
const flag = 50; //https://runtime.fivem.net/doc/natives/?_0xEA47FE3719165B94
|
||||
const anim = "cellphone_text_out";
|
||||
if (IsPedInAnyVehicle(GetPlayerPed(-1), true)) {
|
||||
//true refers to at get in.
|
||||
const dict = "anim@cellphone@in_car@ps";
|
||||
|
||||
StopAnimTask(GetPlayerPed(-1), dict, 'cellphone_text_in', 1.0) //Stop the pull out animation
|
||||
await Delay(100) //lets it get to a certain point
|
||||
loadAnimDict(dict) //loads the new animation
|
||||
TaskPlayAnim(GetPlayerPed(-1), dict, anim, 8.0, -1, -1, flag, 0, false, false, false) //puts phone into pocket
|
||||
await Delay(200) //waits until the phone is in the pocket
|
||||
StopAnimTask(GetPlayerPed(-1), dict, anim, 1.0) //clears the animation
|
||||
deletePhone() //Deletes the prop.
|
||||
}
|
||||
StopAnimTask(GetPlayerPed(-1), dict, "cellphone_text_in", 1.0); //Stop the pull out animation
|
||||
deletePhone(); //Deletes the prop early incase they get out of the vehicle.
|
||||
await Delay(250); //lets it get to a certain point
|
||||
loadAnimDict(dict); //loads the new animation
|
||||
TaskPlayAnim(
|
||||
GetPlayerPed(-1),
|
||||
dict,
|
||||
anim,
|
||||
8.0,
|
||||
-1,
|
||||
-1,
|
||||
flag,
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
); //puts phone into pocket
|
||||
await Delay(200); //waits until the phone is in the pocket
|
||||
StopAnimTask(GetPlayerPed(-1), dict, anim, 1.0); //clears the animation
|
||||
} else {
|
||||
//While not in a vehicle it will use this dict.
|
||||
const dict = "cellphone@";
|
||||
|
||||
StopAnimTask(GetPlayerPed(-1), dict, "cellphone_text_in", 1.0); //Stop the pull out animation
|
||||
await Delay(100); //lets it get to a certain point
|
||||
loadAnimDict(dict); //loads the new animation
|
||||
TaskPlayAnim(
|
||||
GetPlayerPed(-1),
|
||||
dict,
|
||||
anim,
|
||||
8.0,
|
||||
-1,
|
||||
-1,
|
||||
flag,
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
); //puts phone into pocket
|
||||
await Delay(200); //waits until the phone is in the pocket
|
||||
StopAnimTask(GetPlayerPed(-1), dict, anim, 1.0); //clears the animation
|
||||
deletePhone(); //Deletes the prop.
|
||||
}
|
||||
}
|
||||
|
||||
async function carryingPhone(cb: any) {
|
||||
if (ESX === null) return cb(0);
|
||||
ESX.TriggerServerCallback('phone:getItemAmount', (qtty: number) => {
|
||||
cb(qtty > 0);
|
||||
}, 'phone');
|
||||
ESX.TriggerServerCallback(
|
||||
"phone:getItemAmount",
|
||||
(qtty: number) => {
|
||||
cb(qtty > 0);
|
||||
},
|
||||
"phone"
|
||||
);
|
||||
}
|
||||
|
||||
function noPhone() {
|
||||
if (ESX === null) return;
|
||||
ESX.ShowNotification('Oi Mate, No El Telephono')
|
||||
if (ESX === null) return;
|
||||
ESX.ShowNotification("Oi Mate, No El Telephono");
|
||||
}
|
||||
|
||||
function sendPhoneConfig() {
|
||||
@@ -130,26 +215,25 @@ function sendPhoneConfig() {
|
||||
JSON.stringify({
|
||||
app: "PHONE",
|
||||
method: "phoneConfig",
|
||||
data: config
|
||||
data: config,
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
setTick(() => {
|
||||
if (IsControlJustPressed(1, config.KeyTogglePhone)) {
|
||||
Phone();
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
async function Phone() {
|
||||
if (config.PhoneAsItem) {
|
||||
console.log("CONFIG ON")
|
||||
console.log("CONFIG ON");
|
||||
carryingPhone(async (carryingPhone: any) => {
|
||||
if (carryingPhone) {
|
||||
if (!isPhoneOpen) {
|
||||
isPhoneOpen = true
|
||||
await phoneOpenAnim()
|
||||
isPhoneOpen = true;
|
||||
await phoneOpenAnim();
|
||||
emitNet(events.CONTACTS_GET_CONTACTS);
|
||||
emitNet(events.SELLOUT_FETCH_LISTING);
|
||||
emitNet('phone:getCredentials') // Gets the credentials. Will eventually most likely only get the phone number and name, idk.
|
||||
@@ -159,35 +243,33 @@ async function Phone() {
|
||||
JSON.stringify({
|
||||
app: "PHONE",
|
||||
method: "setVisibility",
|
||||
data: true
|
||||
data: true,
|
||||
})
|
||||
)
|
||||
sendPhoneConfig()
|
||||
SetNuiFocus(true, true)
|
||||
}
|
||||
else {
|
||||
isPhoneOpen = false
|
||||
await phoneCloseAnim()
|
||||
SendNuiMessage( //Hides phone
|
||||
);
|
||||
sendPhoneConfig();
|
||||
SetNuiFocus(true, true);
|
||||
} else {
|
||||
isPhoneOpen = false;
|
||||
await phoneCloseAnim();
|
||||
SendNuiMessage(
|
||||
//Hides phone
|
||||
JSON.stringify({
|
||||
app: "PHONE",
|
||||
method: "setVisibility",
|
||||
data: false
|
||||
data: false,
|
||||
})
|
||||
)
|
||||
SetNuiFocus(false, false)
|
||||
);
|
||||
SetNuiFocus(false, false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
noPhone();
|
||||
}
|
||||
})
|
||||
}
|
||||
else if (!config.PhoneAsItem) {
|
||||
console.log("CONFIG OFF")
|
||||
if (!isPhoneOpen) {
|
||||
isPhoneOpen = true
|
||||
await phoneOpenAnim()
|
||||
});
|
||||
} else if (!config.PhoneAsItem) {
|
||||
console.log("CONFIG OFF");
|
||||
if (!isPhoneOpen) {
|
||||
isPhoneOpen = true;
|
||||
await phoneOpenAnim();
|
||||
emitNet(events.CONTACTS_GET_CONTACTS);
|
||||
emitNet(events.SELLOUT_FETCH_LISTING);
|
||||
emitNet('phone:getCredentials')
|
||||
@@ -197,93 +279,98 @@ async function Phone() {
|
||||
JSON.stringify({
|
||||
app: "PHONE",
|
||||
method: "setVisibility",
|
||||
data: true
|
||||
data: true,
|
||||
})
|
||||
)
|
||||
sendPhoneConfig()
|
||||
SetNuiFocus(true, true)
|
||||
}
|
||||
else {
|
||||
isPhoneOpen = false
|
||||
await phoneCloseAnim()
|
||||
SendNuiMessage( //Hides phone
|
||||
);
|
||||
sendPhoneConfig();
|
||||
SetNuiFocus(true, true);
|
||||
} else {
|
||||
isPhoneOpen = false;
|
||||
await phoneCloseAnim();
|
||||
SendNuiMessage(
|
||||
//Hides phone
|
||||
JSON.stringify({
|
||||
app: "PHONE",
|
||||
method: "setVisibility",
|
||||
data: false
|
||||
data: false,
|
||||
})
|
||||
)
|
||||
SetNuiFocus(false, false)
|
||||
);
|
||||
SetNuiFocus(false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RegisterCommand(
|
||||
"phone",
|
||||
() => {
|
||||
//-- Toggles Phone
|
||||
Phone();
|
||||
},
|
||||
false
|
||||
);
|
||||
|
||||
RegisterCommand('phone', () => { //-- Toggles Phone
|
||||
Phone()
|
||||
}, false)
|
||||
|
||||
|
||||
RegisterNuiCallbackType('phone:close');
|
||||
RegisterNuiCallbackType("phone:close");
|
||||
on(`__cfx_nui:phone:close`, () => {
|
||||
Phone();
|
||||
}) // Called for when the phone is closed via the UI.
|
||||
}); // Called for when the phone is closed via the UI.
|
||||
|
||||
|
||||
AddEventHandler('onResourceStop', function(resource: string) {
|
||||
AddEventHandler("onResourceStop", function (resource: string) {
|
||||
if (resource === GetCurrentResourceName()) {
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: 'PHONE',
|
||||
method: 'setVisibility',
|
||||
data: false
|
||||
app: "PHONE",
|
||||
method: "setVisibility",
|
||||
data: false,
|
||||
})
|
||||
)
|
||||
SetNuiFocus(false, false)
|
||||
deletePhone() //Deletes the phone incase it was attached.
|
||||
ClearPedTasks(GetPlayerPed(-1)) //Leave here until launch as it'll fix any stuck animations.
|
||||
);
|
||||
SetNuiFocus(false, false);
|
||||
deletePhone(); //Deletes the phone incase it was attached.
|
||||
ClearPedTasks(GetPlayerPed(-1)); //Leave here until launch as it'll fix any stuck animations.
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
//
|
||||
//Phone Destory When Wet
|
||||
//
|
||||
function countPhone(cb: any) {
|
||||
if (ESX === null) return cb(0)
|
||||
ESX.TriggerServerCallback('phone:getItemAmount', (qtty: number) => {
|
||||
cb(qtty > 0);
|
||||
}, 'phone');
|
||||
if (ESX === null) return cb(0);
|
||||
ESX.TriggerServerCallback(
|
||||
"phone:getItemAmount",
|
||||
(qtty: number) => {
|
||||
cb(qtty > 0);
|
||||
},
|
||||
"phone"
|
||||
);
|
||||
}
|
||||
|
||||
let destroyedPhone = false
|
||||
|
||||
let destroyedPhone = false;
|
||||
|
||||
setTick(async () => {
|
||||
while (config.SwimDestroy) {
|
||||
await Delay(config.RunRate * 1000);
|
||||
if (IsPedSwimming(PlayerPedId())) {
|
||||
let chance = Math.floor((Math.random() * 100) + 1);
|
||||
let chance = Math.floor(Math.random() * 100 + 1);
|
||||
if (chance <= config.DestoryChance) {
|
||||
countPhone((countPhone: boolean) => {
|
||||
if (countPhone) {
|
||||
ESX.ShowNotification('Your phone is ruined from the water!')
|
||||
destroyedPhone = true
|
||||
ESX.ShowNotification("Your phone is ruined from the water!");
|
||||
destroyedPhone = true;
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
if (destroyedPhone) {
|
||||
await Delay(config.DestroyPhoneReCheck * 60000)
|
||||
await Delay(config.DestroyPhoneReCheck * 60000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
onNet('phone:sendCredentials', (number: string) => {
|
||||
onNet("phone:sendCredentials", (number: string) => {
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: "SIMCARD",
|
||||
method: "setNumber",
|
||||
data: number
|
||||
data: number,
|
||||
})
|
||||
)
|
||||
});
|
||||
);
|
||||
});
|
||||
@@ -1,87 +1,91 @@
|
||||
import events from '../utils/events';
|
||||
import { sendTwitterMessage } from '../utils/messages';
|
||||
import events from "../utils/events";
|
||||
import { sendTwitterMessage } from "../utils/messages";
|
||||
|
||||
/**
|
||||
* Twitter get or create profile
|
||||
*/
|
||||
RegisterNuiCallbackType(events.TWITTER_GET_OR_CREATE_PROFILE);
|
||||
on(`__cfx_nui:${events.TWITTER_GET_OR_CREATE_PROFILE}`, () => {
|
||||
emitNet(events.TWITTER_GET_OR_CREATE_PROFILE);
|
||||
emitNet(events.TWITTER_GET_OR_CREATE_PROFILE);
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_GET_OR_CREATE_PROFILE_SUCCESS, (profile: any) => {
|
||||
sendTwitterMessage(events.TWITTER_GET_OR_CREATE_PROFILE_SUCCESS, profile);
|
||||
sendTwitterMessage(events.TWITTER_GET_OR_CREATE_PROFILE_SUCCESS, profile);
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_GET_OR_CREATE_PROFILE_FAILURE, () => {
|
||||
sendTwitterMessage(events.TWITTER_GET_OR_CREATE_PROFILE_FAILURE);
|
||||
sendTwitterMessage(events.TWITTER_GET_OR_CREATE_PROFILE_FAILURE);
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Twitter update profile
|
||||
*/
|
||||
RegisterNuiCallbackType(events.TWITTER_UPDATE_PROFILE);
|
||||
on(`__cfx_nui:${events.TWITTER_UPDATE_PROFILE}`, (data: string) => {
|
||||
sendTwitterMessage(events.TWITTER_UPDATE_PROFILE_LOADING, true);
|
||||
emitNet(events.TWITTER_UPDATE_PROFILE, data);
|
||||
sendTwitterMessage(events.TWITTER_UPDATE_PROFILE_LOADING, true);
|
||||
emitNet(events.TWITTER_UPDATE_PROFILE, data);
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_UPDATE_PROFILE_RESULT, (result: boolean) => {
|
||||
sendTwitterMessage(events.TWITTER_UPDATE_PROFILE_RESULT, result);
|
||||
emitNet(events.TWITTER_GET_OR_CREATE_PROFILE);
|
||||
sendTwitterMessage(events.TWITTER_UPDATE_PROFILE_RESULT, result);
|
||||
emitNet(events.TWITTER_GET_OR_CREATE_PROFILE);
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Twitter fetch tweets
|
||||
*/
|
||||
RegisterNuiCallbackType(events.TWITTER_FETCH_TWEETS);
|
||||
on(`__cfx_nui:${events.TWITTER_FETCH_TWEETS}`, () => {
|
||||
emitNet(events.TWITTER_FETCH_TWEETS);
|
||||
emitNet(events.TWITTER_FETCH_TWEETS);
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_FETCH_TWEETS_SUCCESS, (tweets: any) => {
|
||||
sendTwitterMessage(events.TWITTER_FETCH_TWEETS_SUCCESS, tweets);
|
||||
sendTwitterMessage(events.TWITTER_FETCH_TWEETS_SUCCESS, tweets);
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_FETCH_TWEETS_FAILURE, () => {
|
||||
sendTwitterMessage(events.TWITTER_FETCH_TWEETS_FAILURE);
|
||||
sendTwitterMessage(events.TWITTER_FETCH_TWEETS_FAILURE);
|
||||
});
|
||||
|
||||
/**
|
||||
* Twitter fetch filtered tweets
|
||||
*/
|
||||
RegisterNuiCallbackType(events.TWITTER_FETCH_TWEETS_FILTERED);
|
||||
on(`__cfx_nui:${events.TWITTER_FETCH_TWEETS_FILTERED}`, (searchValue: string) => {
|
||||
on(
|
||||
`__cfx_nui:${events.TWITTER_FETCH_TWEETS_FILTERED}`,
|
||||
(searchValue: string) => {
|
||||
emitNet(events.TWITTER_FETCH_TWEETS_FILTERED, searchValue);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
onNet(events.TWITTER_FETCH_TWEETS_FILTERED_SUCCESS, (tweets: any) => {
|
||||
sendTwitterMessage(events.TWITTER_FETCH_TWEETS_FILTERED_SUCCESS, tweets);
|
||||
sendTwitterMessage(events.TWITTER_FETCH_TWEETS_FILTERED_SUCCESS, tweets);
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_FETCH_TWEETS_FILTERED_FAILURE, () => {
|
||||
sendTwitterMessage(events.TWITTER_FETCH_TWEETS_FILTERED_FAILURE);
|
||||
sendTwitterMessage(events.TWITTER_FETCH_TWEETS_FILTERED_FAILURE);
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Twitter create tweet
|
||||
*/
|
||||
RegisterNuiCallbackType(events.TWITTER_CREATE_TWEET);
|
||||
on(`__cfx_nui:${events.TWITTER_CREATE_TWEET}`, (data: string) => {
|
||||
sendTwitterMessage(events.TWITTER_CREATE_TWEET_LOADING, true);
|
||||
emitNet(events.TWITTER_CREATE_TWEET, data);
|
||||
sendTwitterMessage(events.TWITTER_CREATE_TWEET_LOADING, true);
|
||||
emitNet(events.TWITTER_CREATE_TWEET, data);
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_CREATE_TWEET_RESULT, (result: boolean) => {
|
||||
sendTwitterMessage(events.TWITTER_CREATE_TWEET_RESULT, result);
|
||||
emitNet(events.TWITTER_FETCH_TWEETS);
|
||||
sendTwitterMessage(events.TWITTER_CREATE_TWEET_RESULT, result);
|
||||
emitNet(events.TWITTER_FETCH_TWEETS);
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_CREATE_TWEET_FAILURE, () => {
|
||||
sendTwitterMessage(events.TWITTER_CREATE_TWEET_FAILURE);
|
||||
sendTwitterMessage(events.TWITTER_CREATE_TWEET_FAILURE);
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_CREATE_TWEET_BROADCAST, (tweet: any) => {
|
||||
sendTwitterMessage(events.TWITTER_CREATE_TWEET_BROADCAST, tweet);
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -89,5 +93,5 @@ onNet(events.TWITTER_CREATE_TWEET_FAILURE, () => {
|
||||
*/
|
||||
RegisterNuiCallbackType(events.TWITTER_TOGGLE_LIKE);
|
||||
on(`__cfx_nui:${events.TWITTER_TOGGLE_LIKE}`, (tweetId: number) => {
|
||||
emitNet(events.TWITTER_TOGGLE_LIKE, tweetId);
|
||||
});
|
||||
emitNet(events.TWITTER_TOGGLE_LIKE, tweetId);
|
||||
});
|
||||
@@ -8,6 +8,6 @@ export let ESX: ESXClient = null;
|
||||
|
||||
setTick(() => {
|
||||
while (ESX === null) {
|
||||
emit('esx:getSharedObject', (obj: ESXClient) => ESX = obj);
|
||||
emit("esx:getSharedObject", (obj: ESXClient) => (ESX = obj));
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -10,7 +10,7 @@
|
||||
"target": "es6",
|
||||
"allowJs": true,
|
||||
"lib": ["es2017"],
|
||||
"types": ["@citizenfx/client", "@types/node"],
|
||||
"types": ["@citizenfx/client", "@types/node", "jest"],
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"esModuleInterop": true
|
||||
|
||||
Reference in new issue
Block a user