diff --git a/__resource.lua b/__resource.lua new file mode 100644 index 00000000..3774ff9e --- /dev/null +++ b/__resource.lua @@ -0,0 +1,23 @@ +resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' + +description 'ESX Menu Default' + +client_scripts { + 'client/main.lua' +} + +ui_page { + 'html/ui.html' +} + +files { + 'html/ui.html', + 'html/css/app.css', + 'html/js/mustache.min.js', + 'html/js/app.js', + 'html/fonts/pdown.ttf', + 'html/fonts/bankgothic.ttf', + 'html/img/cursor.png', + 'html/img/keys/enter.png', + 'html/img/keys/return.png', +} \ No newline at end of file diff --git a/client/main.lua b/client/main.lua new file mode 100644 index 00000000..20a99718 --- /dev/null +++ b/client/main.lua @@ -0,0 +1,77 @@ +ESX = nil + +Citizen.CreateThread(function() + + while ESX == nil do + TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) + Citizen.Wait(0) + end + + local MenuType = 'list' + local OpenedMenus = {} + + local openMenu = function(namespace, name, data) + + OpenedMenus[namespace .. '_' .. name] = true + + SendNUIMessage({ + action = 'openMenu', + namespace = namespace, + name = name, + data = data, + }) + + ESX.SetTimeout(200, function() + SetNuiFocus(true, true) + end) + + end + + local closeMenu = function(namespace, name) + + OpenedMenus[namespace .. '_' .. name] = nil + local OpenedMenuCount = 0 + + SendNUIMessage({ + action = 'closeMenu', + namespace = namespace, + name = name, + data = data, + }) + + for k,v in pairs(OpenedMenus) do + if v == true then + OpenedMenuCount = OpenedMenuCount + 1 + end + end + + if OpenedMenuCount == 0 then + SetNuiFocus(false) + end + + end + + ESX.UI.Menu.RegisterType(MenuType, openMenu, closeMenu) + + RegisterNUICallback('menu_submit', function(data, cb) + local menu = ESX.UI.Menu.GetOpened(MenuType, data._namespace, data._name) + + if menu.submit ~= nil then + menu.submit(data, menu) + end + + cb('OK') + end) + + RegisterNUICallback('menu_cancel', function(data, cb) + + local menu = ESX.UI.Menu.GetOpened(MenuType, data._namespace, data._name) + + if menu.cancel ~= nil then + menu.cancel(data, menu) + end + + cb('OK') + end) + +end) \ No newline at end of file diff --git a/config.lua b/config.lua new file mode 100644 index 00000000..81e8ddf6 --- /dev/null +++ b/config.lua @@ -0,0 +1,74 @@ +Config = {} + +Config.accounts = {'bank', 'black_money'} +Config.accountLabels = {'Banque', 'Argent Sale'} +Config.PaycheckInterval = 7 * 60000 +Config.ShowDotAbovePlayer = false +Config.RemoveInventoryItemDelay = 5 * 60000 + +Config.Weapons = { + + {name = 'WEAPON_UNARMED'}, + {name = 'WEAPON_ANIMAL'}, + {name = 'WEAPON_COUGAR'}, + {name = 'WEAPON_KNIFE'}, + {name = 'WEAPON_NIGHTSTICK'}, + {name = 'WEAPON_HAMMER'}, + {name = 'WEAPON_BAT'}, + {name = 'WEAPON_GOLFCLUB'}, + {name = 'WEAPON_CROWBAR'}, + {name = 'WEAPON_PISTOL'}, + {name = 'WEAPON_COMBATPISTOL'}, + {name = 'WEAPON_APPISTOL'}, + {name = 'WEAPON_PISTOL50'}, + {name = 'WEAPON_MICROSMG'}, + {name = 'WEAPON_SMG'}, + {name = 'WEAPON_ASSAULTSMG'}, + {name = 'WEAPON_ASSAULTRIFLE'}, + {name = 'WEAPON_CARBINERIFLE'}, + {name = 'WEAPON_ADVANCEDRIFLE'}, + {name = 'WEAPON_MG'}, + {name = 'WEAPON_COMBATMG'}, + {name = 'WEAPON_PUMPSHOTGUN'}, + {name = 'WEAPON_SAWNOFFSHOTGUN'}, + {name = 'WEAPON_ASSAULTSHOTGUN'}, + {name = 'WEAPON_BULLPUPSHOTGUN'}, + {name = 'WEAPON_STUNGUN'}, + {name = 'WEAPON_SNIPERRIFLE'}, + {name = 'WEAPON_HEAVYSNIPER'}, + {name = 'WEAPON_REMOTESNIPER'}, + {name = 'WEAPON_GRENADELAUNCHER'}, + {name = 'WEAPON_GRENADELAUNCHER_SMOKE'}, + {name = 'WEAPON_RPG'}, + {name = 'WEAPON_PASSENGER_ROCKET'}, + {name = 'WEAPON_AIRSTRIKE_ROCKET'}, + {name = 'WEAPON_STINGER'}, + {name = 'WEAPON_MINIGUN'}, + {name = 'WEAPON_GRENADE'}, + {name = 'WEAPON_STICKYBOMB'}, + {name = 'WEAPON_SMOKEGRENADE'}, + {name = 'WEAPON_BZGAS'}, + {name = 'WEAPON_MOLOTOV'}, + {name = 'WEAPON_FIREEXTINGUISHER'}, + {name = 'WEAPON_PETROLCAN'}, + {name = 'WEAPON_DIGISCANNER'}, + {name = 'WEAPON_BRIEFCASE'}, + {name = 'WEAPON_BRIEFCASE_02'}, + {name = 'WEAPON_BALL'}, + {name = 'WEAPON_FLARE'}, + {name = 'WEAPON_VEHICLE_ROCKET'}, + {name = 'WEAPON_BARBED_WIRE'}, + {name = 'WEAPON_DROWNING'}, + {name = 'WEAPON_DROWNING_IN_VEHICLE'}, + {name = 'WEAPON_BLEEDING'}, + {name = 'WEAPON_ELECTRIC_FENCE'}, + {name = 'WEAPON_EXPLOSION'}, + {name = 'WEAPON_FALL'}, + {name = 'WEAPON_EXHAUSTION'}, + {name = 'WEAPON_HIT_BY_WATER_CANNON'}, + {name = 'WEAPON_RAMMED_BY_CAR'}, + {name = 'WEAPON_RUN_OVER_BY_CAR'}, + {name = 'WEAPON_HELI_CRASH'}, + {name = 'WEAPON_FIRE'} + +} \ No newline at end of file diff --git a/html/css/app.css b/html/css/app.css new file mode 100644 index 00000000..603a3e09 --- /dev/null +++ b/html/css/app.css @@ -0,0 +1,52 @@ +@font-face { + font-family: bankgothic; + src: url('../fonts/bankgothic.ttf'); +} + +@font-face { + font-family: pcdown; + src: url('../fonts/pdown.ttf'); +} + +.menu { + font-family: bankgothic; + position : absolute; + left : 50%; + top : 50%; + transform : translate(-50%, -50%); + box-shadow : 0px 0px 50px 0px #000; + overflow-y : auto; + max-height : 90%; +} + +.menu button { + font-family: bankgothic; +} + +.menu > table { + border : 1px transparent; + border-spacing : 0; + min-width : 400px; + background-color: #FFF; +} + +.menu > table > thead { + background-color: #506be6; + text-align : center; + height : 40px; + line-height : 40px; + color : #fff; +} + +.menu td { + text-align: center; + padding : 8px; +} + +.menu tbody tr:nth-child(even) { + background: #CCC +} + +.menu tbody tr:nth-child(odd) { + background: #FFF +} diff --git a/html/fonts/bankgothic.ttf b/html/fonts/bankgothic.ttf new file mode 100644 index 00000000..f3d8049b Binary files /dev/null and b/html/fonts/bankgothic.ttf differ diff --git a/html/fonts/pdown.ttf b/html/fonts/pdown.ttf new file mode 100644 index 00000000..69c76cf3 Binary files /dev/null and b/html/fonts/pdown.ttf differ diff --git a/html/img/accounts/bank.png b/html/img/accounts/bank.png new file mode 100644 index 00000000..eb36dc8e Binary files /dev/null and b/html/img/accounts/bank.png differ diff --git a/html/img/accounts/black_money.png b/html/img/accounts/black_money.png new file mode 100644 index 00000000..a42f6aa5 Binary files /dev/null and b/html/img/accounts/black_money.png differ diff --git a/html/img/cursor.png b/html/img/cursor.png new file mode 100644 index 00000000..39536f95 Binary files /dev/null and b/html/img/cursor.png differ diff --git a/html/img/keys/enter.png b/html/img/keys/enter.png new file mode 100644 index 00000000..3eb9a1f6 Binary files /dev/null and b/html/img/keys/enter.png differ diff --git a/html/img/keys/return.png b/html/img/keys/return.png new file mode 100644 index 00000000..a3ca125a Binary files /dev/null and b/html/img/keys/return.png differ diff --git a/html/js/app.js b/html/js/app.js new file mode 100644 index 00000000..f0e6faaf --- /dev/null +++ b/html/js/app.js @@ -0,0 +1,196 @@ +(function(){ + + let MenuTpl = + '
' + ; + + window.ESX_MENU = {}; + ESX_MENU.ResourceName = 'esx_menu_list'; + ESX_MENU.opened = {}; + ESX_MENU.focus = []; + ESX_MENU.data = {} + + ESX_MENU.open = function(namespace, name, data){ + + if(typeof ESX_MENU.opened[namespace] == 'undefined') + ESX_MENU.opened[namespace] = {}; + + if(typeof ESX_MENU.opened[namespace][name] != 'undefined') + ESX_MENU.close(namespace, name); + + data._namespace = namespace; + data._name = name; + + ESX_MENU.opened[namespace][name] = data; + + ESX_MENU.focus.push({ + namespace: namespace, + name : name + }); + + ESX_MENU.render(); + } + + ESX_MENU.close = function(namespace, name){ + + delete ESX_MENU.opened[namespace][name]; + + for(let i=0; i