Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
btwlouis committed Jul 27, 2020
0 parents commit df0d43e
Show file tree
Hide file tree
Showing 7 changed files with 133 additions and 0 deletions.
16 changes: 16 additions & 0 deletions __resource.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
resource_manifest_version '77731fab-63ca-442c-a67b-abc70f28dfa5'

ui_page 'html/ui.html'

client_script 'client.lua'

server_script 'server.lua'

files {
'html/style.css',
'html/app.js',
'html/ui.html',
}



11 changes: 11 additions & 0 deletions client.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
RegisterNetEvent('notifications')
AddEventHandler('notifications', function(color, title, message)
SendNUIMessage({
type = "custom",
color = color,
title = title,
message = message,
})

PlaySoundFrontend(-1, "ATM_WINDOW", "HUD_FRONTEND_DEFAULT_SOUNDSET", 1)
end)
18 changes: 18 additions & 0 deletions html/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
$(function () {
window.onload = (e) => {
window.addEventListener("message", (event) => {
var item = event.data;
if (item !== undefined && item.type === "custom") {
document.getElementById("notifications").innerHTML +=
'<div class="notification" style="border-left: 5px ' +
item.color +
' solid;"><div class="notification-title"><p id="notfication-title-content">' +
item.title +
'</p></div><div class="notification-message"><p id="notfication-message-content">' +
item.message +
"</p></div></div>";
$(".notification").delay(5000).fadeOut("slow");
}
});
};
});
2 changes: 2 additions & 0 deletions html/jquery-3.5.0.min.js

Large diffs are not rendered by default.

45 changes: 45 additions & 0 deletions html/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
* {
padding: 0;
margin: 0;
font-family: "Poppins", sans-serif;
}

html,
body {
padding: 0;
margin: 0;
background: transparent;
}

.notification {
margin-bottom: 1vh;
position: absolute;
top: 2vh;
left: 2vh;
background-color: rgb(53, 53, 53, 0.8);
max-width: 22vh;
min-width: 22vh;
min-height: 6vh;
max-height: 6vh;
word-wrap: break-word;
padding: 0.8vh;
border-left: 5px #00d5ff solid;

-webkit-box-shadow: 11px 10px 58px -22px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 11px 10px 58px -22px rgba(0, 0, 0, 0.75);
box-shadow: 11px 10px 58px -22px rgba(0, 0, 0, 0.75);
}

.notification-title {
text-transform: uppercase;
padding: 5px 0 0 10px;
}

.notification-message {
padding-left: 10px;
font-size: 1.4vh;
}

p {
color: #ffffff;
}
27 changes: 27 additions & 0 deletions html/ui.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet">
<link rel="stylesheet" href="style.css">

<script src="nui://game/ui/jquery.js" type="text/javascript"></script>
</head>

<body>

<div id="notifications">

</div>

<script>
$(".notification").hide();
</script>

<script src="app.js"></script>
</body>

</html>
14 changes: 14 additions & 0 deletions server.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
ESX = nil

TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)

RegisterCommand("announce", function(source, args)
local argString = table.concat(args, " ")
if argString ~= nil then
TriggerClientEvent('notificationsn', -1, "#eb4034", "ANKÜNDIGUNG", argString)
end
end, true)

RegisterCommand("id", function(source, args)
TriggerClientEvent('notifications', source, "#eb4034", "ANKÜNDIGUNG", "Deine ID ist: " .. source)
end, false)

0 comments on commit df0d43e

Please sign in to comment.