From 1bc9e5ede663a7bbe6537360c74b0fd15bae2878 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sat, 9 Jun 2018 11:59:54 +0200 Subject: [PATCH] Fixed buggy UI black screen Co-Authored-By: benjaminbra --- README.md | 28 ++++++++++++++++++++-------- __resource.lua | 14 +++++++++----- client/main.lua | 14 ++++---------- html/cursor.png | Bin 272 -> 0 bytes html/index.html | 1 - html/script.js | 27 --------------------------- html/style.css | 7 ------- 7 files changed, 33 insertions(+), 58 deletions(-) delete mode 100644 html/cursor.png diff --git a/README.md b/README.md index 5910aa92..0f8f41f5 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,37 @@ # esx_identity -[REQUIREMENTS] - +## Requirements * Dependencies For Full Functionality * [esx_skin](https://github.com/ESX-Org/esx_skin) * [esx_policejob](https://github.com/ESX-Org/esx_policejob) * [esx_society](https://github.com/ESX-Org/esx_society) -[INSTALLATION] +## Download & Installation -1) Install To resources/[esx]/esx_identity -`<< MUST BE INSTALLED HERE` -2) Import esx_identity.sql in your database +### Using [fvm](https://github.com/qlaffont/fvm-installer) +``` +fvm install --save --folder=esx esx-org/esx_identity +``` -3) Add this in your server.cfg : +### Using Git +``` +cd resources +git clone https://github.com/ESX-Org/esx_identity [esx]/esx_identity +``` + +### Manually +- Download https://github.com/ESX-Org/esx_identity/archive/master.zip +- Put it in the `[esx]` directory + +## Installation +- Import `esx_identity.sql` in your database +- Add this to your `server.cfg`: ``` start esx_identity ``` -4) If you are using esx_policejob or esx_society, you need to enable the following in the files config.lua: +- If you are using esx_policejob or esx_society, you need to enable the following in the scripts' `config.lua`: ```Config.EnableESXIdentity = true``` ### Commands diff --git a/__resource.lua b/__resource.lua index 5e0be4f0..07f5c207 100644 --- a/__resource.lua +++ b/__resource.lua @@ -2,9 +2,7 @@ resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' description 'ESX Identity' -version '1.0.3' - -client_script 'client/main.lua' +version '1.1.0' server_scripts { '@mysql-async/lib/MySQL.lua', @@ -12,11 +10,17 @@ server_scripts { 'server/main.lua' } +client_scripts { + '@es_extended/locale.lua', + 'client/main.lua' +} + ui_page 'html/index.html' files { 'html/index.html', 'html/script.js', - 'html/style.css', - 'html/cursor.png' + 'html/style.css' } + +dependency 'es_extended' \ No newline at end of file diff --git a/client/main.lua b/client/main.lua index 30f8ad0a..f8864a28 100644 --- a/client/main.lua +++ b/client/main.lua @@ -11,13 +11,13 @@ Citizen.CreateThread(function() end end) -function EnableGui(enable) - SetNuiFocus(enable) - guiEnabled = enable +function EnableGui(state) + SetNuiFocus(state, state) + guiEnabled = state SendNUIMessage({ type = "enableui", - enable = enable + enable = state }) end @@ -105,12 +105,6 @@ Citizen.CreateThread(function() DisableControlAction(0, 143, true) -- disable melee DisableControlAction(0, 75, true) -- disable exit vehicle DisableControlAction(27, 75, true) -- disable exit vehicle - - if IsDisabledControlJustReleased(0, 142) then -- MeleeAttackAlternate - SendNUIMessage({ - type = "click" - }) - end end Citizen.Wait(10) end diff --git a/html/cursor.png b/html/cursor.png deleted file mode 100644 index 39536f953d701b36a90dc56084bafd988371a2fb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 272 zcmeAS@N?(olHy`uVBq!ia0vp^q9Dw{1|(OCFP#RYSkfJR9T^xl_H+M9WCij$3p^r= z85sBufiR<}hF1enP_o1|q9iy!t)x7$D3zfgF*C13FE6!3!9>qM&(L5k7uNxxqFzrI z#}Etut!FreS`>I(0^ikVp5f1PInc0ibrsXWO3z8Ee_BE>W<&%Ean9H1Y|@_Ma)5tI zP3vrppG@U}o4EJ`H!a-_TKCSz%v`zHX&3lrYRgJzbSuAt9 z@6PvoS_%Jm+&BGp_A+yZ?Fo&SwU@JtJ?kA`YTb#E`^&mC!8qZZWp1Mjt5em&H79@$ OWAJqKb6Mw<&;$S!<6)ox diff --git a/html/index.html b/html/index.html index 1ccd4730..6fc5dfc7 100644 --- a/html/index.html +++ b/html/index.html @@ -5,7 +5,6 @@ -

Register

diff --git a/html/script.js b/html/script.js index 0359d753..32140b19 100644 --- a/html/script.js +++ b/html/script.js @@ -1,37 +1,10 @@ -var documentWidth = document.documentElement.clientWidth; -var documentHeight = document.documentElement.clientHeight; - -var cursor = document.getElementById("cursor"); -var cursorX = documentWidth / 2; -var cursorY = documentHeight / 2; - -function UpdateCursorPos() { - cursor.style.left = cursorX; - cursor.style.top = cursorY; -} - -function Click(x, y) { - var element = $(document.elementFromPoint(x, y)); - element.focus().click(); -} - $(function() { window.addEventListener('message', function(event) { if (event.data.type == "enableui") { - cursor.style.display = event.data.enable ? "block" : "none"; document.body.style.display = event.data.enable ? "block" : "none"; - } else if (event.data.type == "click") { - // Avoid clicking the cursor itself, click 1px to the top/left; - Click(cursorX - 1, cursorY - 1); } }); - $(document).mousemove(function(event) { - cursorX = event.pageX; - cursorY = event.pageY; - UpdateCursorPos(); - }); - document.onkeyup = function (data) { if (data.which == 27) { // Escape key $.post('http://esx_identity/escape', JSON.stringify({})); diff --git a/html/style.css b/html/style.css index b2efe3db..79a6b347 100644 --- a/html/style.css +++ b/html/style.css @@ -1,10 +1,3 @@ -#cursor { - position: absolute; - z-index: 999999; - display: none; -} - -/* Required */ body { font-family: sans-serif; overflow: hidden;