From 52992b7d10c2b2698a4c3e63a24029378ed90ffd Mon Sep 17 00:00:00 2001 From: Taso Date: Tue, 2 Mar 2021 13:54:32 -0500 Subject: [PATCH] chore(client): Removed unused variables --- resources/client/cl_main.ts | 3 -- resources/client/functions.ts | 56 +++++++++++++++++++++++------------ 2 files changed, 37 insertions(+), 22 deletions(-) diff --git a/resources/client/cl_main.ts b/resources/client/cl_main.ts index 6d0a023..111b3d2 100644 --- a/resources/client/cl_main.ts +++ b/resources/client/cl_main.ts @@ -2,10 +2,7 @@ import config from '../utils/config'; import events from '../utils/events'; import { phoneCloseAnim, phoneOpenAnim, removePhoneProp } from './functions'; -let prop = 0; let isPhoneOpen = false; -let propCreated = false; -let phoneModel = 'prop_amb_phone'; // Refered to in newphoneProp function. Requires custom phone being streamed. RegisterKeyMapping('phone', 'Open Phone', 'keyboard', 'f1'); diff --git a/resources/client/functions.ts b/resources/client/functions.ts index c4024e9..71e8769 100644 --- a/resources/client/functions.ts +++ b/resources/client/functions.ts @@ -1,9 +1,8 @@ import { Delay } from '../utils/fivem'; let prop = 0; -let isPhoneOpen = false; let propCreated = false; -const phoneModel = 'prop_amb_phone' +const phoneModel = 'prop_amb_phone'; /* * * * * * * * * * * * * * @@ -79,11 +78,11 @@ export async function loadAnimDict(dict: any) { await Delay(100); } } - + const handleOpenVehicleAnim = async (playerPed: number): Promise => { const dict = 'anim@cellphone@in_car@ps'; - SetCurrentPedWeapon(playerPed, 0xA2719263, true) + SetCurrentPedWeapon(playerPed, 0xa2719263, true); ClearPedTasks(playerPed); await loadAnimDict(dict); TaskPlayAnim( @@ -99,15 +98,15 @@ const handleOpenVehicleAnim = async (playerPed: number): Promise => { false, false ); - await Delay(300); - await newPhoneProp(); + await Delay(300); + await newPhoneProp(); }; const handleOpenNormalAnim = async (playerPed: number): Promise => { //While not in a vehicle it will use this dict. const dict = 'cellphone@'; - - SetCurrentPedWeapon(playerPed, 0xA2719263, true) + + SetCurrentPedWeapon(playerPed, 0xa2719263, true); ClearPedTasks(playerPed); await loadAnimDict(dict); TaskPlayAnim( @@ -123,8 +122,8 @@ const handleOpenNormalAnim = async (playerPed: number): Promise => { false, false ); - await Delay(300); - await newPhoneProp(); + await Delay(300); + await newPhoneProp(); }; const handleCloseVehicleAnim = async (playerPed: number): Promise => { @@ -139,12 +138,12 @@ const handleCloseNormalAnim = async (playerPed: number): Promise => { const DICT = 'cellphone@'; const ANIM = 'cellphone_text_out'; StopAnimTask(playerPed, DICT, 'cellphone_text_in', 1.0); - await Delay(100); - await loadAnimDict(DICT); + await Delay(100); + await loadAnimDict(DICT); TaskPlayAnim(playerPed, DICT, ANIM, 7.0, -1, -1, 50, 0, false, false, false); - await Delay(200); + await Delay(200); StopAnimTask(playerPed, DICT, ANIM, 1.0); - removePhoneProp(); + removePhoneProp(); }; const handleCallStartVehicleAnim = async (playerPed: number): Promise => { @@ -167,17 +166,36 @@ const handleCallEndVehicleAnim = async (playerPed: number): Promise => { const handleCallStartNormalAnim = async (playerPed: number): Promise => { const DICT = 'cellphone@'; const ANIM = 'cellphone_call_listen_base'; - await loadAnimDict(DICT); + await loadAnimDict(DICT); TaskPlayAnim(playerPed, DICT, ANIM, 3.0, 3.0, -1, 49, 0, false, false, false); }; const handleCallEndNormalAnim = async (playerPed: number): Promise => { const DICT = 'cellphone@'; const ANIM = 'cellphone_call_to_text'; - - if (IsEntityPlayingAnim(playerPed, 'cellphone@', 'cellphone_call_listen_base', 49)) { - await loadAnimDict(DICT); - TaskPlayAnim(playerPed, DICT, ANIM, 2.5, 8.0, -1, 50, 0, false, false, false); + + if ( + IsEntityPlayingAnim( + playerPed, + 'cellphone@', + 'cellphone_call_listen_base', + 49 + ) + ) { + await loadAnimDict(DICT); + TaskPlayAnim( + playerPed, + DICT, + ANIM, + 2.5, + 8.0, + -1, + 50, + 0, + false, + false, + false + ); } };