diff --git a/__resource.lua b/__resource.lua index 081c5dfc..8d41f890 100644 --- a/__resource.lua +++ b/__resource.lua @@ -18,4 +18,6 @@ files { 'html/fonts/pdown.ttf', 'html/fonts/bankgothic.ttf' -} \ No newline at end of file +} + +dependency 'es_extended' \ No newline at end of file diff --git a/client/main.lua b/client/main.lua index b419cd73..e220444a 100644 --- a/client/main.lua +++ b/client/main.lua @@ -23,7 +23,7 @@ Citizen.CreateThread(function() action = 'openMenu', namespace = namespace, name = name, - data = data, + data = data }) local timeoutId = ESX.SetTimeout(200, function() @@ -41,7 +41,7 @@ Citizen.CreateThread(function() action = 'closeMenu', namespace = namespace, name = name, - data = data, + data = data }) for k,v in pairs(OpenedMenus) do @@ -68,7 +68,7 @@ Citizen.CreateThread(function() if tonumber(data.value) ~= nil then -- Round float values - data.value = round(tonumber(data.value)) + data.value = ESX.Math.Round(tonumber(data.value)) -- Check for negative value if tonumber(data.value) <= 0 then @@ -128,11 +128,9 @@ Citizen.CreateThread(function() DisableControlAction(0, 15, true) -- WeaponWheelPrev DisableControlAction(0, 16, true) -- SelectNextWeapon DisableControlAction(0, 17, true) -- SelectPrevWeapon + else + Citizen.Wait(500) end end end) - - function round(x) - return x>=0 and math.floor(x+0.5) or math.ceil(x-0.5) - end end) \ No newline at end of file diff --git a/html/css/app.css b/html/css/app.css index e50e4d31..459d3c37 100644 --- a/html/css/app.css +++ b/html/css/app.css @@ -1,81 +1,74 @@ @font-face { - font-family: bankgothic; - src: url('../fonts/bankgothic.ttf'); + font-family: bankgothic; + src: url('../fonts/bankgothic.ttf'); } @font-face { - font-family: pcdown; - src: url('../fonts/pdown.ttf'); + font-family: pcdown; + src: url('../fonts/pdown.ttf'); } #controls { - font-family : pcdown; - font-size : 3em; - color : #FFF; - position : absolute; - bottom : 40; - right : 40; - - text-shadow: - -1px -1px 0 #000, - 1px -1px 0 #000, - -1px 1px 0 #000, - 1px 1px 0 #000 - ; + font-family: pcdown; + font-size: 3em; + color: #FFF; + position: absolute; + bottom: 40; + right: 40; + text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000; } .controls { - display: none; + display: none; } .dialog { - - font-family : bankgothic; - background-color: #fff; - color : #fff; - box-shadow : 0px 0px 50px 0px #000; - position : absolute; - overflow : hidden; - top : 50%; - left : 50%; - width : 600px; - height : 104px; - transform : translate(-50%, -50%); + font-family: bankgothic; + background-color: #fff; + color: #fff; + box-shadow: 0px 0px 50px 0px #000; + position: absolute; + overflow: hidden; + top: 50%; + left: 50%; + width: 600px; + height: 104px; + transform: translate(-50%, -50%); } .dialog.big { - height: 200px; + height: 200px; } .dialog .head { - background-color: #506be6; - text-align : center; - height : 40px; + background-color: #506be6; + text-align: center; + height: 40px; } .dialog .head span:before { - content: ""; - display: inline-block; - height: 100%; - vertical-align: middle; + content: ""; + display: inline-block; + height: 100%; + vertical-align: middle; } .dialog input[type="text"] { - width : 100%; - height: 32px; + width: 100%; + height: 32px; } .dialog textarea { - width : 100%; - height: 128px; + width: 100%; + height: 128px; } .dialog button[name="submit"] { - width : 75%; - height: 32px; + width: 75%; + height: 32px; } .dialog button[name="cancel"] { - width : 25%; - height: 32px; + width: 25%; + height: 32px; } \ No newline at end of file diff --git a/html/js/app.js b/html/js/app.js index 8d136b59..4988e11f 100644 --- a/html/js/app.js +++ b/html/js/app.js @@ -1,4 +1,4 @@ -(function(){ +(function () { let MenuTpl = '
' + '' ; @@ -17,33 +17,38 @@ ESX_MENU.focus = []; ESX_MENU.pos = {}; - ESX_MENU.open = function(namespace, name, data) { + ESX_MENU.open = function (namespace, name, data) { - if(typeof ESX_MENU.opened[namespace] == 'undefined') + if (typeof ESX_MENU.opened[namespace] == 'undefined') { ESX_MENU.opened[namespace] = {}; + } - if(typeof ESX_MENU.opened[namespace][name] != 'undefined') + if (typeof ESX_MENU.opened[namespace][name] != 'undefined') { ESX_MENU.close(namespace, name); + } - if(typeof ESX_MENU.pos[namespace] == 'undefined') + if (typeof ESX_MENU.pos[namespace] == 'undefined') { ESX_MENU.pos[namespace] = {}; + } - if(typeof data.type == 'undefined') + if (typeof data.type == 'undefined') { data.type = 'default'; + } - if(typeof data.align == 'undefined') + if (typeof data.align == 'undefined') { data.align = 'top-left'; + } - data._index = ESX_MENU.focus.length; + data._index = ESX_MENU.focus.length; data._namespace = namespace; - data._name = name; + data._name = name; ESX_MENU.opened[namespace][name] = data; - ESX_MENU.pos [namespace][name] = 0; + ESX_MENU.pos[namespace][name] = 0; ESX_MENU.focus.push({ namespace: namespace, - name : name + name: name }); document.onkeyup = function (key) { @@ -55,73 +60,74 @@ }; ESX_MENU.render(); - } - ESX_MENU.close = function(namespace, name) { - + }; + + ESX_MENU.close = function (namespace, name) { + delete ESX_MENU.opened[namespace][name]; - for(let i=0; i