Skip to content

Commit

Permalink
Merge pull request #858 from bitpredator/dev
Browse files Browse the repository at this point in the history
bitpredator patch
bitpredator authored Oct 20, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents ca65cdd + a5746e3 commit 4d09551
Showing 47 changed files with 5,651 additions and 1,356 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ name: Feature request
about: Suggest an idea for this project
title: 'Feature request'
labels: ''
assignees: 'bitpredator'
assignees: ''

---

3 changes: 2 additions & 1 deletion server-data/inventory.cfg
Original file line number Diff line number Diff line change
@@ -64,7 +64,8 @@ set inventory:dumpsterloot [
["fags", 1, 3],
["trash_can", 1, 3],
["trash_chips", 1, 3],
["plastic_bag", 1, 3]
["plastic_bag", 1, 3],
["halloween", 1, 3]

]

Original file line number Diff line number Diff line change
@@ -64,7 +64,7 @@ function OpenMobileAmbulanceActionsMenu()
ESX.ShowNotification(TranslateCap("no_players"))
else
if element2.value == "revive" then
revivePlayer(closestPlayer)
RevivePlayer(closestPlayer)
elseif element2.value == "small" then
ESX.TriggerServerCallback("bpt_ambulancejob:getItemAmount", function(quantity)
if quantity > 0 then
12 changes: 0 additions & 12 deletions server-data/resources/[bpt_addons]/bpt_loadscreen/css/style.css
Original file line number Diff line number Diff line change
@@ -284,18 +284,6 @@ div#circleG>.circleG:nth-child(even) {
margin-left: 60%;
}

.songname {
color: rgb(255, 255, 255);
font-size: 12px;
font-family: 'Montserrat', sans-serif;
text-shadow: -1px -1px 1px rgba(255, 255, 255, .1), 1px 1px 1px rgba(0, 0, 0, .5);
background-color: rgba(0, 0, 0, 0.5);
border-radius: 0px 30px 30px 0px;
align-items: center;
overflow: hidden;
white-space: nowrap;
}

.load {
position: absolute;
right: 0;
13 changes: 2 additions & 11 deletions server-data/resources/[bpt_addons]/bpt_loadscreen/index.html
Original file line number Diff line number Diff line change
@@ -51,23 +51,14 @@
<div class="stroke"></div>
<div class="stroke"></div>
<div class="stroke"></div>
</div>

<div class="songname">
<div class="slide-right">
<p id="songname">Akacia - Electric [NCS Release]</p>
</div>
</div>
</div>

<div class="video-background video-container noselect">
<iframe width="150%" height="150%" src="https://www.youtube.com/embed/nlf60PvnbA4?controls=0&amp;showinfo=0&amp;rel=0&amp;autoplay=1&amp;loop=1&amp;mute=1" frameborder="0"></iframe>
<iframe width="150%" height="150%" src="https://www.youtube.com/embed/Hl4UNMl05a4?controls=0&amp;showinfo=0&amp;rel=0&amp;autoplay=1&amp;loop=1&amp;mute=1" frameborder="0"></iframe>
</div>

<!-- Song that I used is NCS song Akacia - Electric [NCS Release]
original link for song:https://ncs.io/akaciaelectric
song is changable in a folder song -->
<audio id="loading" src="song/song2.mp3" autoplay="true" hidden="true" loop="true"></audio>
<audio id="loading" src="song/halloween1.mp3" autoplay="true" hidden="true" loop="true"></audio>
<div class="background">
<div class="img-center">
</div>
34 changes: 10 additions & 24 deletions server-data/resources/[bpt_addons]/bpt_loadscreen/script/main.js
Original file line number Diff line number Diff line change
@@ -8,16 +8,10 @@ function getRandomSongNumber() {
// Function for setting a random song
function setNewSong() {
if (random == 1) {
document.getElementById('loading').src = 'song/song1.mp3';
songname.innerHTML = 'Asketa & Natan Chaim - More [NCS Release]';
document.getElementById('loading').src = 'song/halloween1.mp3';
}
else if (random == 2) {
document.getElementById('loading').src = 'song/song2.mp3';
songname.innerHTML = 'Akacia - Electric [NCS Release]';
}
else if (random == 3) {
document.getElementById('loading').src = 'song/song3.mp3';
songname.innerHTML = 'Wiguez & Vizzen - Running Wild [NCS Release]';
document.getElementById('loading').src = 'song/halloween2.mp3';
}

}
@@ -49,45 +43,37 @@ window.addEventListener('keyup', function(e) {
// Function for lower or higher up sound in background, its working function in script but its not noted in text//

const mutetext = document.getElementById('text');
// eslint-disable-next-line no-var
var songname = document.getElementById('songname');

window.addEventListener('keyup', function(event) {
// eslint-disable-next-line no-inline-comments
if (event.which == 37) { // ArrowLEFT
if (document.getElementById('loading').src.endsWith('song2.mp3')) {
document.getElementById('loading').src = 'song/song1.mp3';
songname.innerHTML = 'Asketa & Natan Chaim - More [NCS Release]';
if (document.getElementById('loading').src.endsWith('halloween2.mp3')) {
document.getElementById('loading').src = 'song/halloween1.mp3';

}
else if (document.getElementById('loading').src.endsWith('song1.mp3')) {
else if (document.getElementById('loading').src.endsWith('halloween1.mp3')) {
document.getElementById('loading').src = 'song/song3.mp3';
songname.innerHTML = 'Wiguez & Vizzen Ft. Maestro Chives - Running Wild (EH!DE Remix) [NCS Release]';

}
else if (document.getElementById('loading').src.endsWith('song3.mp3')) {
document.getElementById('loading').src = 'song/song2.mp3';
songname.innerHTML = 'Akacia - Electric [NCS Release]';
document.getElementById('loading').src = 'song/halloween2.mp3';
}
document.getElementById('loading').play();
mutetext.innerHTML = 'MUTE';
}

// eslint-disable-next-line no-inline-comments
if (event.which == 39) { // ArrowRIGHT
if (document.getElementById('loading').src.endsWith('song2.mp3')) {
if (document.getElementById('loading').src.endsWith('halloween2.mp3')) {
document.getElementById('loading').src = 'song/song3.mp3';
songname.innerHTML = 'Wiguez & Vizzen Ft. Maestro Chives - Running Wild (EH!DE Remix) [NCS Release]';

}
else if (document.getElementById('loading').src.endsWith('song3.mp3')) {
document.getElementById('loading').src = 'song/song1.mp3';
songname.innerHTML = 'Asketa & Natan Chaim - More [NCS Release]';
document.getElementById('loading').src = 'song/halloween1.mp3';

}
else if (document.getElementById('loading').src.endsWith('song1.mp3')) {
document.getElementById('loading').src = 'song/song2.mp3';
songname.innerHTML = 'Akacia - Electric [NCS Release]';
else if (document.getElementById('loading').src.endsWith('halloween1.mp3')) {
document.getElementById('loading').src = 'song/halloween2.mp3';

}
document.getElementById('loading').play();
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion server-data/resources/[bpt_addons]/bpt_status/LICENSE
Original file line number Diff line number Diff line change
@@ -652,7 +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:

<program> Copyright (C) 2024 bitpredator
bpt_status Copyright (C) 2024 bitpredator
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.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
function CreateStatus(name, default, color, visible, tickCallback)
local self = {}
local self = {}

self.val = default
self.name = name
self.default = default
self.color = color
self.visible = visible
self.val = default
self.name = name
self.default = default
self.color = color
self.visible = visible
self.tickCallback = tickCallback

function self._set(k, v)
80 changes: 42 additions & 38 deletions server-data/resources/[bpt_addons]/bpt_status/client/main.lua
Original file line number Diff line number Diff line change
@@ -6,25 +6,25 @@ function GetStatusData(minimal)
for i = 1, #Status, 1 do
if minimal then
table.insert(status, {
name = Status[i].name,
val = Status[i].val,
percent = (Status[i].val / Config.StatusMax) * 100
name = Status[i].name,
val = Status[i].val,
percent = (Status[i].val / Config.StatusMax) * 100,
})
else
table.insert(status, {
name = Status[i].name,
val = Status[i].val,
color = Status[i].color,
name = Status[i].name,
val = Status[i].val,
color = Status[i].color,
visible = Status[i].visible(Status[i]),
percent = (Status[i].val / Config.StatusMax) * 100
percent = (Status[i].val / Config.StatusMax) * 100,
})
end
end

return status
end

AddEventHandler('bpt_status:registerStatus', function(name, default, color, visible, tickCallback)
AddEventHandler("bpt_status:registerStatus", function(name, default, color, visible, tickCallback)
local status = CreateStatus(name, default, color, visible, tickCallback)

for i = 1, #OriginalStatus, 1 do
@@ -36,7 +36,7 @@ AddEventHandler('bpt_status:registerStatus', function(name, default, color, visi
table.insert(Status, status)
end)

AddEventHandler('bpt_status:unregisterStatus', function(name)
AddEventHandler("bpt_status:unregisterStatus", function(name)
for k, v in ipairs(Status) do
if v.name == name then
table.remove(Status, k)
@@ -45,25 +45,27 @@ AddEventHandler('bpt_status:unregisterStatus', function(name)
end
end)

RegisterNetEvent('esx:onPlayerLogout')
AddEventHandler('esx:onPlayerLogout', function()
RegisterNetEvent("esx:onPlayerLogout")
AddEventHandler("esx:onPlayerLogout", function()
ESX.PlayerLoaded = false
Status = {}
if Config.Display then
SendNUIMessage({
update = true,
status = Status
status = Status,
})
end
end)

RegisterNetEvent('bpt_status:load')
AddEventHandler('bpt_status:load', function(status)
RegisterNetEvent("bpt_status:load")
AddEventHandler("bpt_status:load", function(status)
OriginalStatus = status
ESX.PlayerLoaded = true
TriggerEvent('bpt_status:loaded')
TriggerEvent("bpt_status:loaded")

if Config.Display then TriggerEvent('bpt_status:setDisplay', 0.5) end
if Config.Display then
TriggerEvent("bpt_status:setDisplay", 0.5)
end

CreateThread(function()
local data = {}
@@ -73,7 +75,7 @@ AddEventHandler('bpt_status:load', function(status)
table.insert(data, {
name = Status[i].name,
val = Status[i].val,
percent = (Status[i].val / Config.StatusMax) * 100
percent = (Status[i].val / Config.StatusMax) * 100,
})
end

@@ -85,19 +87,19 @@ AddEventHandler('bpt_status:load', function(status)
end
SendNUIMessage({
update = true,
status = fullData
status = fullData,
})
end

TriggerEvent('bpt_status:onTick', data)
TriggerEvent("bpt_status:onTick", data)
table.wipe(data)
Wait(Config.TickTime)
end
end)
end)

RegisterNetEvent('bpt_status:set')
AddEventHandler('bpt_status:set', function(name, val)
RegisterNetEvent("bpt_status:set")
AddEventHandler("bpt_status:set", function(name, val)
for i = 1, #Status, 1 do
if Status[i].name == name then
Status[i].set(val)
@@ -107,13 +109,13 @@ AddEventHandler('bpt_status:set', function(name, val)
if Config.Display then
SendNUIMessage({
update = true,
status = GetStatusData()
status = GetStatusData(),
})
end
end)

RegisterNetEvent('bpt_status:add')
AddEventHandler('bpt_status:add', function(name, val)
RegisterNetEvent("bpt_status:add")
AddEventHandler("bpt_status:add", function(name, val)
for i = 1, #Status, 1 do
if Status[i].name == name then
Status[i].add(val)
@@ -123,13 +125,13 @@ AddEventHandler('bpt_status:add', function(name, val)
if Config.Display then
SendNUIMessage({
update = true,
status = GetStatusData()
status = GetStatusData(),
})
end
end)

RegisterNetEvent('bpt_status:remove')
AddEventHandler('bpt_status:remove', function(name, val)
RegisterNetEvent("bpt_status:remove")
AddEventHandler("bpt_status:remove", function(name, val)
for i = 1, #Status, 1 do
if Status[i].name == name then
Status[i].remove(val)
@@ -139,12 +141,12 @@ AddEventHandler('bpt_status:remove', function(name, val)
if Config.Display then
SendNUIMessage({
update = true,
status = GetStatusData()
status = GetStatusData(),
})
end
end)

AddEventHandler('bpt_status:getStatus', function(name, cb)
AddEventHandler("bpt_status:getStatus", function(name, cb)
for i = 1, #Status, 1 do
if Status[i].name == name then
cb(Status[i])
@@ -153,33 +155,33 @@ AddEventHandler('bpt_status:getStatus', function(name, cb)
end
end)

AddEventHandler('bpt_status:getAllStatus', function(cb)
AddEventHandler("bpt_status:getAllStatus", function(cb)
cb(Status)
end)

AddEventHandler('bpt_status:setDisplay', function(val)
AddEventHandler("bpt_status:setDisplay", function(val)
SendNUIMessage({
setDisplay = true,
display = val
display = val,
})
end)

-- Pause menu disable hud display
if Config.Display then
AddEventHandler('esx:pauseMenuActive', function(state)
AddEventHandler("esx:pauseMenuActive", function(state)
if state then
isPaused = true
TriggerEvent('bpt_status:setDisplay', 0.0)
TriggerEvent("bpt_status:setDisplay", 0.0)
return
end
isPaused = false
TriggerEvent('bpt_status:setDisplay', 0.5)
TriggerEvent("bpt_status:setDisplay", 0.5)
end)

-- Loading screen off event
AddEventHandler('esx:loadingScreenOff', function()
AddEventHandler("esx:loadingScreenOff", function()
if not isPaused then
TriggerEvent('bpt_status:setDisplay', 0.3)
TriggerEvent("bpt_status:setDisplay", 0.3)
end
end)
end
@@ -188,6 +190,8 @@ end
CreateThread(function()
while true do
Wait(Config.UpdateInterval)
if ESX.PlayerLoaded then TriggerServerEvent('bpt_status:update', GetStatusData(true)) end
if ESX.PlayerLoaded then
TriggerServerEvent("bpt_status:update", GetStatusData(true))
end
end
end)
8 changes: 4 additions & 4 deletions server-data/resources/[bpt_addons]/bpt_status/config.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Config = {}
Config = {}

Config.StatusMax = 1000000
Config.TickTime = 1000
Config.StatusMax = 1000000
Config.TickTime = 1000
Config.UpdateInterval = 30000
Config.Display = false -- Enable the bpt_status bars (disable if you are using another HUD)
Config.Display = false -- Enable the bpt_status bars (disable if you are using another HUD)
Loading

0 comments on commit 4d09551

Please sign in to comment.