-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
253 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
local isNuiOpen = false | ||
|
||
RegisterNetEvent('lone:openUpdateNui') | ||
AddEventHandler('lone:openUpdateNui', function(updates) | ||
SetNuiFocus(true, true) | ||
SendNUIMessage({ | ||
type = 'loneopenNui', | ||
servername = Config.Servername, | ||
date = Config.date, | ||
updates = updates | ||
}) | ||
isNuiOpen = true | ||
end) | ||
TriggerEvent('chat:addSuggestion', '/updates', 'Shows the latest updates in the city') | ||
|
||
RegisterNUICallback('closeNui', function() | ||
SetNuiFocus(false, false) | ||
isNuiOpen = false | ||
end) | ||
|
||
RegisterCommand('closeupdates', function() | ||
if isNuiOpen then | ||
SetNuiFocus(false, false) | ||
isNuiOpen = false | ||
end | ||
end, false) | ||
|
||
RegisterNetEvent('receiveUpdateList') | ||
AddEventHandler('receiveUpdateList', function(updates) | ||
SendNUIMessage({ | ||
type = 'updateList', | ||
servername = Config.Servername, | ||
date = Config.date, | ||
updates = updates | ||
}) | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--Made by lone with ❤️ | ||
|
||
Config = { } | ||
|
||
Config.Servername = "Lone updates" | ||
|
||
Config.date = "5/12/2023" | ||
|
||
Config.updates = { | ||
"Update 1: Added new feature.", | ||
"Update 2: Fixed bugs.", | ||
"Update 3: Server optimized" | ||
-- Add more updates as needed | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
fx_version 'cerulean' | ||
game 'gta5' | ||
lua54 'yes' | ||
author 'lone' | ||
description 'Updates display made by Lone' | ||
version '1.0.0' | ||
|
||
|
||
shared_scripts { | ||
'config.lua', | ||
} | ||
|
||
client_scripts { | ||
'client/client.lua', | ||
} | ||
|
||
server_scripts { | ||
'server/server.lua' | ||
} | ||
|
||
ui_page 'ui/index.html' | ||
|
||
files { | ||
'ui/index.html', | ||
'ui/js/script.js', | ||
'ui/css/*', | ||
'ui/imgs/*', | ||
} | ||
|
||
escrow_ignore { | ||
'config.lua', | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
|
||
RegisterCommand('updates', function(source, args, rawCommand) | ||
local playerId = source | ||
TriggerClientEvent('lone:openUpdateNui', playerId, Config.updates) | ||
end, false) | ||
|
||
|
||
|
||
RegisterNetEvent('requestUpdateList') | ||
AddEventHandler('requestUpdateList', function() | ||
TriggerClientEvent('receiveUpdateList', source, Config.updates) | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* style.css */ | ||
|
||
body { | ||
margin: 0; | ||
padding: 0; | ||
font-family: Arial, sans-serif; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
height: 100vh; | ||
} | ||
|
||
#container { | ||
text-align: center; | ||
width: 30%; | ||
|
||
} | ||
|
||
@keyframes runningColorAnimation { | ||
0% { box-shadow: #ff0000 0 0 20px; } | ||
50% { box-shadow: rgb(255, 255, 255) 0 0 20px; } | ||
75% { box-shadow: rgb(255, 0, 0) 0 0 20px;} | ||
100% { box-shadow: #ffffff 0 0 20px; } | ||
} | ||
|
||
|
||
#updateNui { | ||
background-color: #fff; | ||
padding: 20px; | ||
border-radius: 10px; | ||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); | ||
z-index: 999; | ||
text-align: center; | ||
animation: runningColorAnimation 2s linear infinite; | ||
} | ||
|
||
|
||
|
||
#header { | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
} | ||
|
||
#serverLogo { | ||
width: 30px; | ||
height: 30px; | ||
border-radius: 50%; | ||
margin-right: 10px; | ||
} | ||
|
||
#serverName { | ||
font-size: 18px; | ||
font-weight: bold; | ||
margin-right: 10px; | ||
padding-left: 10px; | ||
} | ||
|
||
|
||
#closeButton { | ||
background-color: #dc3545; | ||
color: #fff; | ||
border: none; | ||
padding: 8px 12px; | ||
border-radius: 5px; | ||
cursor: pointer; | ||
} | ||
|
||
#updateList { | ||
margin-top: 20px; | ||
padding: 0; | ||
list-style: none; | ||
} | ||
|
||
#updateList li { | ||
background-color: #ddd; | ||
margin-bottom: 10px; | ||
padding: 10px; | ||
border-radius: 5px; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!-- index.html --> | ||
|
||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link rel="stylesheet" href="./css/index.css"> | ||
</head> | ||
<body> | ||
<div id="container"> | ||
<div id="updateNui" class="none"> | ||
<div id="header"> | ||
<img src="./imgs/server.gif" alt="Server Logo" id="serverLogo"> | ||
<div id="serverName">Server Name</div> | ||
<div id="date">Date</div> | ||
<button id="closeButton" onclick="closeNui()">Close</button> | ||
</div> | ||
<ul id="updateList"> | ||
<li>Test</li> | ||
</ul> | ||
</div> | ||
</div> | ||
|
||
<script src="./js/script.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// script.js | ||
|
||
var isNuiOpen = false; | ||
document.getElementById('updateNui').style.display = 'none'; | ||
|
||
function closeNui() { | ||
isNuiOpen = false; | ||
document.getElementById('updateNui').style.display = 'none'; | ||
fetch(`https://${GetParentResourceName()}/closeNui`, {}); | ||
} | ||
|
||
document.addEventListener('DOMContentLoaded', function () { | ||
window.addEventListener('message', function (event) { | ||
var data = event.data; | ||
|
||
if (data.type === 'loneopenNui') { | ||
updateNui(data); | ||
document.getElementById('updateNui').style.display = 'block'; | ||
|
||
} else if (data.type === 'updateList') { | ||
updateNui(data); | ||
} | ||
}); | ||
|
||
document.addEventListener('keydown', function (event) { | ||
|
||
if (event.key === 'Escape' && isNuiOpen) { | ||
closeNui(); | ||
} | ||
}); | ||
}); | ||
|
||
function updateNui(data) { | ||
updates = data.updates | ||
var updateList = document.getElementById('updateList'); | ||
var servername = document.getElementById('serverName'); | ||
var date = document.getElementById('date'); | ||
isNuiOpen = true | ||
|
||
servername.innerHTML = data.servername | ||
date.innerHTML = data.date | ||
updateList.innerHTML = ''; | ||
|
||
updates.forEach(function (update) { | ||
var listItem = document.createElement('li'); | ||
listItem.textContent = update; | ||
updateList.appendChild(listItem); | ||
}); | ||
} |