chore: Reorganise directories; include a sample server.cfg
|
Before Width: | Height: | Size: 1015 B After Width: | Height: | Size: 1015 B |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 662 B After Width: | Height: | Size: 662 B |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
@@ -631,11 +631,7 @@ to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<<<<<<< HEAD
|
||||
fxserver-es_extended
|
||||
=======
|
||||
fxserver-esx_menu_default
|
||||
>>>>>>> esx_menu_default/master
|
||||
Copyright (C) 2015 Jérémie N'gadi
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -656,11 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<<<<<<< HEAD
|
||||
fxserver-es_extended Copyright (C) 2015 Jérémie N'gadi
|
||||
=======
|
||||
fxserver-esx_menu_default Copyright (C) 2015 Jérémie N'gadi
|
||||
>>>>>>> esx_menu_default/master
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
@@ -0,0 +1,2 @@
|
||||
# esx_menu_default
|
||||
ESX Menu Default
|
||||
@@ -0,0 +1,101 @@
|
||||
ESX = nil
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
while ESX == nil do
|
||||
Citizen.Wait(5)
|
||||
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
|
||||
end
|
||||
|
||||
local GUI, MenuType = {}, 'default'
|
||||
GUI.Time = 0
|
||||
|
||||
local openMenu = function(namespace, name, data)
|
||||
SendNUIMessage({
|
||||
action = 'openMenu',
|
||||
namespace = namespace,
|
||||
name = name,
|
||||
data = data
|
||||
})
|
||||
end
|
||||
|
||||
local closeMenu = function(namespace, name)
|
||||
SendNUIMessage({
|
||||
action = 'closeMenu',
|
||||
namespace = namespace,
|
||||
name = name,
|
||||
data = data
|
||||
})
|
||||
end
|
||||
|
||||
ESX.UI.Menu.RegisterType(MenuType, openMenu, closeMenu)
|
||||
|
||||
AddEventHandler('esx_menu_default:message:menu_submit', function(data)
|
||||
local menu = ESX.UI.Menu.GetOpened(MenuType, data._namespace, data._name)
|
||||
|
||||
if menu.submit ~= nil then
|
||||
menu.submit(data, menu)
|
||||
end
|
||||
end)
|
||||
|
||||
AddEventHandler('esx_menu_default:message:menu_cancel', function(data)
|
||||
local menu = ESX.UI.Menu.GetOpened(MenuType, data._namespace, data._name)
|
||||
|
||||
if menu.cancel ~= nil then
|
||||
menu.cancel(data, menu)
|
||||
end
|
||||
end)
|
||||
|
||||
AddEventHandler('esx_menu_default:message:menu_change', function(data)
|
||||
local menu = ESX.UI.Menu.GetOpened(MenuType, data._namespace, data._name)
|
||||
|
||||
for i=1, #data.elements, 1 do
|
||||
menu.setElement(i, 'value', data.elements[i].value)
|
||||
|
||||
if data.elements[i].selected then
|
||||
menu.setElement(i, 'selected', true)
|
||||
else
|
||||
menu.setElement(i, 'selected', false)
|
||||
end
|
||||
end
|
||||
|
||||
if menu.change ~= nil then
|
||||
menu.change(data, menu)
|
||||
end
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(15)
|
||||
|
||||
if IsControlPressed(0, 18) and IsInputDisabled(0) and (GetGameTimer() - GUI.Time) > 150 then
|
||||
SendNUIMessage({action = 'controlPressed', control = 'ENTER'})
|
||||
GUI.Time = GetGameTimer()
|
||||
end
|
||||
|
||||
if IsControlPressed(0, 177) and IsInputDisabled(0) and (GetGameTimer() - GUI.Time) > 150 then
|
||||
SendNUIMessage({action = 'controlPressed', control = 'BACKSPACE'})
|
||||
GUI.Time = GetGameTimer()
|
||||
end
|
||||
|
||||
if IsControlPressed(0, 27) and IsInputDisabled(0) and (GetGameTimer() - GUI.Time) > 200 then
|
||||
SendNUIMessage({action = 'controlPressed', control = 'TOP'})
|
||||
GUI.Time = GetGameTimer()
|
||||
end
|
||||
|
||||
if IsControlPressed(0, 173) and IsInputDisabled(0) and (GetGameTimer() - GUI.Time) > 200 then
|
||||
SendNUIMessage({action = 'controlPressed', control = 'DOWN'})
|
||||
GUI.Time = GetGameTimer()
|
||||
end
|
||||
|
||||
if IsControlPressed(0, 174) and IsInputDisabled(0) and (GetGameTimer() - GUI.Time) > 150 then
|
||||
SendNUIMessage({action = 'controlPressed', control = 'LEFT'})
|
||||
GUI.Time = GetGameTimer()
|
||||
end
|
||||
|
||||
if IsControlPressed(0, 175) and IsInputDisabled(0) and (GetGameTimer() - GUI.Time) > 150 then
|
||||
SendNUIMessage({action = 'controlPressed', control = 'RIGHT'})
|
||||
GUI.Time = GetGameTimer()
|
||||
end
|
||||
end
|
||||
end)
|
||||
end)
|
||||
@@ -0,0 +1,27 @@
|
||||
fx_version 'adamant'
|
||||
|
||||
game 'gta5'
|
||||
|
||||
description 'ESX Menu Default'
|
||||
|
||||
version '1.0.4'
|
||||
|
||||
client_scripts {
|
||||
'@es_extended/client/wrapper.lua',
|
||||
'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'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
'es_extended'
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
@font-face {
|
||||
font-family: bankgothic;
|
||||
src: url('../fonts/bankgothic.ttf');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: pcdown;
|
||||
src: url('../fonts/pdown.ttf');
|
||||
}
|
||||
|
||||
.menu {
|
||||
font-family: 'PT Sans Narrow', sans-serif;
|
||||
font-size: 22px;
|
||||
min-width: 400px;
|
||||
color: #fff;
|
||||
box-shadow: 0px 0px 50px 0px #000;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.menu.align-left {
|
||||
left: 40;
|
||||
top: 50%;
|
||||
transform: translate(0, -50%);
|
||||
}
|
||||
|
||||
.menu.align-top-left {
|
||||
left: 40;
|
||||
top: 40;
|
||||
}
|
||||
|
||||
.menu.align-top {
|
||||
left: 50%;
|
||||
top: 40;
|
||||
transform: translate(-50%, 0);
|
||||
}
|
||||
|
||||
.menu.align-top-right {
|
||||
right: 10;
|
||||
top: 40;
|
||||
}
|
||||
|
||||
.menu.align-right {
|
||||
right: 40;
|
||||
top: 50%;
|
||||
transform: translate(0, -50%);
|
||||
}
|
||||
|
||||
.menu.align-bottom-right {
|
||||
right: 40;
|
||||
bottom: 40;
|
||||
}
|
||||
|
||||
.menu.align-bottom {
|
||||
left: 50%;
|
||||
bottom: 40;
|
||||
transform: translate(-50%, 0);
|
||||
}
|
||||
|
||||
.menu.align-bottom-left {
|
||||
left: 40;
|
||||
bottom: 40;
|
||||
}
|
||||
|
||||
.menu.align-center {
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
.menu .head {
|
||||
background-color: #4682B4;
|
||||
text-align: center;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
.menu .menu-items {
|
||||
max-height: 600px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.menu .menu-items .menu-item {
|
||||
height: 40px;
|
||||
display: block;
|
||||
background-color: rgba(40, 40, 40, 1);
|
||||
line-height: 32px;
|
||||
color: #ffffff;
|
||||
padding: 2px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.menu .menu-items .menu-item.selected {
|
||||
background-color: rgba(20, 20, 20, 1);
|
||||
border-top: 2px solid #e76767;
|
||||
border-bottom: 2px solid #e76767;
|
||||
}
|
||||
@@ -1,114 +1,3 @@
|
||||
<<<<<<< HEAD
|
||||
(() => {
|
||||
|
||||
ESX = {};
|
||||
ESX.HUDElements = [];
|
||||
|
||||
ESX.setHUDDisplay = function (opacity) {
|
||||
$('#hud').css('opacity', opacity);
|
||||
};
|
||||
|
||||
ESX.insertHUDElement = function (name, index, priority, html, data) {
|
||||
ESX.HUDElements.push({
|
||||
name: name,
|
||||
index: index,
|
||||
priority: priority,
|
||||
html: html,
|
||||
data: data
|
||||
});
|
||||
|
||||
ESX.HUDElements.sort((a, b) => {
|
||||
return a.index - b.index || b.priority - a.priority;
|
||||
});
|
||||
};
|
||||
|
||||
ESX.updateHUDElement = function (name, data) {
|
||||
for (let i = 0; i < ESX.HUDElements.length; i++) {
|
||||
if (ESX.HUDElements[i].name == name) {
|
||||
ESX.HUDElements[i].data = data;
|
||||
}
|
||||
}
|
||||
|
||||
ESX.refreshHUD();
|
||||
};
|
||||
|
||||
ESX.deleteHUDElement = function (name) {
|
||||
for (let i = 0; i < ESX.HUDElements.length; i++) {
|
||||
if (ESX.HUDElements[i].name == name) {
|
||||
ESX.HUDElements.splice(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
ESX.refreshHUD();
|
||||
};
|
||||
|
||||
ESX.resetHUDElements = function () {
|
||||
ESX.HUDElements = [];
|
||||
ESX.refreshHUD();
|
||||
};
|
||||
|
||||
ESX.refreshHUD = function () {
|
||||
$('#hud').html('');
|
||||
|
||||
for (let i = 0; i < ESX.HUDElements.length; i++) {
|
||||
let html = Mustache.render(ESX.HUDElements[i].html, ESX.HUDElements[i].data);
|
||||
$('#hud').append(html);
|
||||
}
|
||||
};
|
||||
|
||||
ESX.inventoryNotification = function (add, label, count) {
|
||||
let notif = '';
|
||||
|
||||
if (add) {
|
||||
notif += '+';
|
||||
} else {
|
||||
notif += '-';
|
||||
}
|
||||
|
||||
if (count) {
|
||||
notif += count + ' ' + label;
|
||||
} else {
|
||||
notif += ' ' + label;
|
||||
}
|
||||
|
||||
let elem = $('<div>' + notif + '</div>');
|
||||
$('#inventory_notifications').append(elem);
|
||||
|
||||
$(elem).delay(3000).fadeOut(1000, function () {
|
||||
elem.remove();
|
||||
});
|
||||
};
|
||||
|
||||
window.onData = (data) => {
|
||||
switch (data.action) {
|
||||
case 'setHUDDisplay': {
|
||||
ESX.setHUDDisplay(data.opacity);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'insertHUDElement': {
|
||||
ESX.insertHUDElement(data.name, data.index, data.priority, data.html, data.data);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'updateHUDElement': {
|
||||
ESX.updateHUDElement(data.name, data.data);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'deleteHUDElement': {
|
||||
ESX.deleteHUDElement(data.name);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'resetHUDElements': {
|
||||
ESX.resetHUDElements();
|
||||
break;
|
||||
}
|
||||
|
||||
case 'inventoryNotification': {
|
||||
ESX.inventoryNotification(data.add, data.item, data.count);
|
||||
=======
|
||||
(function(){
|
||||
let MenuTpl =
|
||||
'<div id="menu_{{_namespace}}_{{_name}}" class="menu{{#align}} align-{{align}}{{/align}}">' +
|
||||
@@ -444,16 +333,11 @@
|
||||
}
|
||||
|
||||
break;
|
||||
>>>>>>> esx_menu_default/master
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
<<<<<<< HEAD
|
||||
window.onload = function (e) {
|
||||
=======
|
||||
window.onload = function(e){
|
||||
>>>>>>> esx_menu_default/master
|
||||
window.addEventListener('message', (event) => {
|
||||
onData(event.data);
|
||||
});
|
||||
@@ -1,19 +1,4 @@
|
||||
<html>
|
||||
<<<<<<< HEAD
|
||||
<head>
|
||||
<link rel="stylesheet" href="css/app.css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="hud"></div>
|
||||
<div id="inventory_notifications"></div>
|
||||
|
||||
<script src="nui://game/ui/jquery.js" type="text/javascript"></script>
|
||||
<script src="js/mustache.min.js"></script>
|
||||
<script src="js/app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
=======
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
@@ -32,4 +17,3 @@
|
||||
</body>
|
||||
|
||||
</html>
|
||||
>>>>>>> esx_menu_default/master
|
||||