Minor cleanup and added missing sql index

This commit is contained in:
ElPumpo
2019-05-31 23:09:40 +02:00
parent 06839cb101
commit 9f21efed2d
8 changed files with 180 additions and 183 deletions
+14 -33
View File
@@ -1,40 +1,21 @@
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
}
local GUI = {}
local PhoneData = { phoneNumber = 0, contacts = {} }
local CurrentAction = nil
local CurrentActionMsg = ''
local CurrentActionData = {}
local CurrentDispatchRequestId = -1
local PhoneNumberSources = {}
ESX = nil
GUI.PhoneIsShowed = false
GUI.MessagesIsShowed = false
GUI.AddContactIsShowed = false
local GUI, PhoneData, CurrentActionData, PhoneNumberSources, CurrentDispatchRequestId = {}, {phoneNumber = 0, contacts = {}}, {}, {}, -1
local CurrentAction, CurrentActionMsg
GUI.PhoneIsShowed = false
GUI.MessagesIsShowed = false
GUI.AddContactIsShowed = false
ESX = nil
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(0)
end
ESX.UI.Menu.RegisterType('phone', OpenPhone, ClosePhone)
end)
function OpenPhone()
local playerPed = PlayerPedId()
TriggerServerEvent('esx_phone:reload', PhoneData.phoneNumber)
SendNUIMessage({
@@ -188,7 +169,7 @@ AddEventHandler('esx_phone:onMessage', function(phoneNumber, message, position,
anonyme = anon,
job = job
}
ESX.SetTimeout(15000, function()
CurrentAction = nil
end)
@@ -222,7 +203,7 @@ RegisterNUICallback('send', function(data)
local playerPed = PlayerPedId()
local coords = GetEntityCoords(playerPed)
if tonumber(phoneNumber) ~= nil then
if tonumber(phoneNumber) then
phoneNumber = tonumber(phoneNumber)
end
@@ -231,7 +212,7 @@ RegisterNUICallback('send', function(data)
y = coords.y,
z = coords.z
})
SendNUIMessage({
showMessageEditor = false
})
@@ -269,7 +250,7 @@ Citizen.CreateThread(function()
else
-- open phone
-- todo: is player busy (handcuffed, etc)
if IsControlJustReleased(0, Keys['F1']) and IsInputDisabled(0) then
if IsControlJustReleased(0, 288) and IsInputDisabled(0) then
if not ESX.UI.Menu.IsOpen('phone', GetCurrentResourceName(), 'main') then
ESX.UI.Menu.CloseAll()
ESX.UI.Menu.Open('phone', GetCurrentResourceName(), 'main')
@@ -292,10 +273,10 @@ Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if CurrentAction ~= nil then
if CurrentAction then
ESX.ShowHelpNotification(CurrentActionMsg)
if IsControlJustReleased(0, Keys['E']) and IsInputDisabled(0) then
if IsControlJustReleased(0, 38) and IsInputDisabled(0) then
if CurrentAction == 'dispatch' then
TriggerServerEvent('esx_phone:stopDispatch', CurrentDispatchRequestId)
SetNewWaypoint(CurrentActionData.position.x, CurrentActionData.position.y)
@@ -307,4 +288,4 @@ Citizen.CreateThread(function()
Citizen.Wait(500)
end
end
end)
end)