diff --git a/[esx]/esx_notify/Notify.lua b/[esx]/esx_notify/Notify.lua new file mode 100644 index 00000000..8a54aca6 --- /dev/null +++ b/[esx]/esx_notify/Notify.lua @@ -0,0 +1,11 @@ +local function Notify(type, length, message) + SendNuiMessage(json.encode({ + type = type or "info", + length = length or 3000, + message = message or "ESX-Notify" + })) +end + +exports('Notify', Notify) +RegisterNetEvent("Notify", Notify) + diff --git a/[esx]/esx_notify/fxmanifest.lua b/[esx]/esx_notify/fxmanifest.lua new file mode 100644 index 00000000..16d7c135 --- /dev/null +++ b/[esx]/esx_notify/fxmanifest.lua @@ -0,0 +1,23 @@ +fx_version 'adamant' +game 'gta5' +author 'ESX-Framework' +description 'ESX Notification' + +shared_scripts { + '@es_extended/imports.lua', +} + +client_scripts { 'Notify.lua' } + +ui_page 'nui/index.html' + +files { + 'nui/index.html', + 'nui/js/*.js', + 'nui/css/*.css', + 'nui/img/*.png', +} + +exports { + 'Notify' +} \ No newline at end of file diff --git a/[esx]/esx_notify/nui/css/style.css b/[esx]/esx_notify/nui/css/style.css new file mode 100644 index 00000000..4b24467e --- /dev/null +++ b/[esx]/esx_notify/nui/css/style.css @@ -0,0 +1,14 @@ +:root { + --color: white; + --bgColor: #212121; +} + +* { + padding: 0; + margin: 0; +} + +body { + color: var(--color); + font-family: sans-serif; +} \ No newline at end of file diff --git a/[esx]/esx_notify/nui/index.html b/[esx]/esx_notify/nui/index.html new file mode 100644 index 00000000..e2064fe2 --- /dev/null +++ b/[esx]/esx_notify/nui/index.html @@ -0,0 +1,118 @@ + + + + + + + + + +
+
+ +

+
+
+
+
+ +

+
+
+
+
+ +

+
+
+ + + + \ No newline at end of file diff --git a/[esx]/esx_notify/nui/js/script.js b/[esx]/esx_notify/nui/js/script.js new file mode 100644 index 00000000..40afbe62 --- /dev/null +++ b/[esx]/esx_notify/nui/js/script.js @@ -0,0 +1,29 @@ +const w = window +const doc = document + +$(function () { + w.addEventListener('message', function(e) { + $(".text").text(e.data.message) + if (e.data.type === "info") { + console.log("info") + doc.getElementById("notifyInfo").style.display = "block"; + Timeout() + } else if (e.data.type === "error") { + console.log("error") + doc.getElementById("notifyError").style.display = "block"; + Timeout() + } else if (e.data.type === "success") { + console.log("succeeeess") + doc.getElementById("notifySuccess").style.display = "block"; + Timeout() + } + + function Timeout() { + setTimeout(function () { + doc.getElementById("notifyInfo").style.display = "none"; + doc.getElementById("notifyError").style.display = "none"; + doc.getElementById("notifySuccess").style.display = "none"; + }, e.data.length) + } + }) +}) \ No newline at end of file