From aa3c9213105fd6adcd0a869add8a6e663f2f294f Mon Sep 17 00:00:00 2001 From: rex2630 Date: Sat, 4 Jan 2020 18:49:39 +0100 Subject: [PATCH] Minor cleanup (#28) * Minor cleanup * I forgot these * NEW ESX Support --- client/main.lua | 18 ++---------------- server/main.lua | 8 ++++---- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/client/main.lua b/client/main.lua index b557b415..395ee2f2 100644 --- a/client/main.lua +++ b/client/main.lua @@ -1,19 +1,5 @@ -local Keys = { - ["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57, - ["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177, - ["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18, - ["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182, - ["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81, - ["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70, - ["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178, - ["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173, - ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118 -} - -- internal variables -local hasAlreadyEnteredMarker = false -local isInATMMarker = false -local menuIsShowed = false +local hasAlreadyEnteredMarker, isInATMMarker, menuIsShowed = false, false, false ESX = nil Citizen.CreateThread(function() @@ -110,7 +96,7 @@ Citizen.CreateThread(function() ESX.ShowHelpNotification(_U('press_e_atm')) - if IsControlJustReleased(0, Keys['E']) and IsPedOnFoot(PlayerPedId()) then + if IsControlJustReleased(0, 38) and IsPedOnFoot(PlayerPedId()) then menuIsShowed = true ESX.TriggerServerCallback('esx:getPlayerData', function(data) SendNUIMessage({ diff --git a/server/main.lua b/server/main.lua index 1fa90643..c1700a8f 100644 --- a/server/main.lua +++ b/server/main.lua @@ -11,11 +11,11 @@ AddEventHandler('esx_atm:deposit', function(amount) amount = ESX.Math.Round(amount) if amount == nil or amount <= 0 or amount > xPlayer.getMoney() then - TriggerClientEvent('esx:showNotification', _source, _U('invalid_amount')) + xPlayer.showNotification(_U('invalid_amount')) else xPlayer.removeMoney(amount) xPlayer.addAccountMoney('bank', amount) - TriggerClientEvent('esx:showNotification', _source, _U('deposit_money', amount)) + xPlayer.showNotification(_U('deposit_money', amount)) end end) @@ -30,10 +30,10 @@ AddEventHandler('esx_atm:withdraw', function(amount) amount = ESX.Math.Round(amount) if amount == nil or amount <= 0 or amount > accountMoney then - TriggerClientEvent('esx:showNotification', _source, _U('invalid_amount')) + xPlayer.showNotification(_U('invalid_amount')) else xPlayer.removeAccountMoney('bank', amount) xPlayer.addMoney(amount) - TriggerClientEvent('esx:showNotification', _source, _U('withdraw_money', amount)) + xPlayer.showNotification(_U('withdraw_money', amount)) end end)