Skip to content

Commit

Permalink
Merge pull request #774 from bitpredator/dev
Browse files Browse the repository at this point in the history
convert: esx_mechanicjob > bpt_mechanicjob
  • Loading branch information
bitpredator authored Aug 5, 2024
2 parents 5ff27bc + db8c1f1 commit e34cb77
Show file tree
Hide file tree
Showing 42 changed files with 456 additions and 553 deletions.
42 changes: 24 additions & 18 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 60
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- bug
- dependencies
- enhancement
# Label to use when marking an issue as stale
staleLabel: wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
name: 'Close stale issues and PRs'
on:
workflow_dispatch:
schedule:
- cron: '0 */2 * * *'

permissions:
issues: write
pull-requests: write

jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v9
with:
days-before-stale: 60
days-before-close: 7
stale-issue-message: 'This issue is now marked stale because it has been open over a year without activity. Remove the stale label or add a comment to reset the stale state.'
stale-issue-label: Stale
stale-pr-message: 'This pull request is now marked stale because it has been open over a year without activity. Remove the stale label or add a comment to reset the stale state.'
stale-pr-label: Stale
operations-per-run: 100
debug-only: true
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ CreateThread(function()
if open or #v.jobs == 0 then
openWorkbench(v)
else
SendTextMessage(TranslateCap("wrong_job"))
ESX.ShowNotification(TranslateCap("wrong_job"))
end
end
end
Expand Down Expand Up @@ -230,7 +230,7 @@ end)

RegisterNetEvent("bpt_crafting:sendMessage")
AddEventHandler("bpt_crafting:sendMessage", function(msg)
SendTextMessage(msg)
ESX.ShowNotification(msg)
end)

RegisterNUICallback("close", function()
Expand All @@ -243,8 +243,8 @@ RegisterNUICallback("craft", function(data)
TriggerServerEvent("bpt_crafting:craft", item, false)
end)

function SendTextMessage(msg)
exports["mythic_notify"]:SendAlert("inform", msg)
function ESX.ShowNotification(msg)
exports["mythic_notify"]:SendAlert("inform", msg)
end

function DrawText3D(x, y, z, text)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,8 @@ 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.

esx_holdup
Copyright (C) 2015-2022 Jérémie N'gadi
bpt_holdup
Copyright (C) 2024 bitpredator

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -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:

esx_holdup Copyright (C) 2015-2022 Jérémie N'gadi
bpt_holdup 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.
Expand Down
19 changes: 19 additions & 0 deletions server-data/resources/[bpt_addons]/bpt_holdup/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<h1 align='center'>bpt_holdup</a></h1>
<p align='center'><a href='https://discord.gg/ksGfNvDEfq'>Discord</a>

Copyright (C) 2022-2024 bitpredator

This program Is free software: you can redistribute it And/Or modify it under the terms Of the GNU General Public License As published by the Free Software Foundation, either version 3 Of the License, Or (at your option) any later version.

This program Is distributed In the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty Of MERCHANTABILITY Or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License For more details.

ATTENTION:
You are not authorized to change the name of the resource and the resources within it.

If you want to contribute you can open a pull request.

You are not authorized to sell this software (this is free project).

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,39 @@ function DrawTxt(x, y, width, height, scale, text, r, g, b, a, outline)
EndTextCommandDisplayText(x - width / 2, y - height / 2 + 0.005)
end

RegisterNetEvent("esx_holdup:currentlyRobbing")
AddEventHandler("esx_holdup:currentlyRobbing", function(currentStore)
RegisterNetEvent("bpt_holdup:currentlyRobbing")
AddEventHandler("bpt_holdup:currentlyRobbing", function(currentStore)
holdingUp, store = true, currentStore
end)

RegisterNetEvent("esx_holdup:killBlip")
AddEventHandler("esx_holdup:killBlip", function()
RegisterNetEvent("bpt_holdup:killBlip")
AddEventHandler("bpt_holdup:killBlip", function()
RemoveBlip(blipRobbery)
end)

RegisterNetEvent("esx_holdup:setBlip")
AddEventHandler("esx_holdup:setBlip", function(position)
RegisterNetEvent("bpt_holdup:setBlip")
AddEventHandler("bpt_holdup:setBlip", function(position)
blipRobbery = AddBlipForCoord(position)
SetBlipSprite(blipRobbery, 161)
SetBlipScale(blipRobbery, 2.0)
SetBlipColour(blipRobbery, 3)
PulseBlip(blipRobbery)
end)

RegisterNetEvent("esx_holdup:tooFar")
AddEventHandler("esx_holdup:tooFar", function()
RegisterNetEvent("bpt_holdup:tooFar")
AddEventHandler("bpt_holdup:tooFar", function()
store = ""
ESX.ShowNotification(_U("robbery_cancelled"))
ESX.ShowNotification(TranslateCap("robbery_cancelled"))
end)

RegisterNetEvent("esx_holdup:robberyComplete")
AddEventHandler("esx_holdup:robberyComplete", function(award)
RegisterNetEvent("bpt_holdup:robberyComplete")
AddEventHandler("bpt_holdup:robberyComplete", function(award)
holdingUp, store = false, ""
ESX.ShowNotification(_U("robbery_complete", award))
ESX.ShowNotification(TranslateCap("robbery_complete", award))
end)

RegisterNetEvent("esx_holdup:startTimer")
AddEventHandler("esx_holdup:startTimer", function()
RegisterNetEvent("bpt_holdup:startTimer")
AddEventHandler("bpt_holdup:startTimer", function()
local timer = Stores[store].secondsRemaining
CreateThread(function()
while timer > 0 and holdingUp do
Expand All @@ -61,19 +61,19 @@ AddEventHandler("esx_holdup:startTimer", function()
CreateThread(function()
while holdingUp do
Wait(0)
DrawTxt(0.66, 1.44, 1.0, 1.0, 0.4, _U("robbery_timer", timer), 255, 255, 255, 255)
DrawTxt(0.66, 1.44, 1.0, 1.0, 0.4, TranslateCap("robbery_timer", timer), 255, 255, 255, 255)
end
end)
end)

CreateThread(function()
for k, v in pairs(Stores) do
for _, v in pairs(Stores) do
local blip = AddBlipForCoord(v.position)
SetBlipSprite(blip, 156)
SetBlipScale(blip, 0.8)
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentSubstringPlayerName(_U("shop_robbery"))
AddTextComponentSubstringPlayerName(TranslateCap("shop_robbery"))
EndTextCommandSetBlipName(blip)
end
end)
Expand All @@ -89,12 +89,12 @@ CreateThread(function()
letSleep = false
DrawMarker(Config.Marker.Type, v.position, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.Marker.x, Config.Marker.y, Config.Marker.z, Config.Marker.r, Config.Marker.g, Config.Marker.b, Config.Marker.a, false, false, 2, false, false, false, false)
if distance < 2.0 then
ESX.ShowHelpNotification(_U("press_to_rob", v.nameOfStore))
ESX.ShowHelpNotification(TranslateCap("press_to_rob", v.nameOfStore))
if IsControlJustReleased(0, 38) then
if IsPedArmed(PlayerPedId(), 4) then
TriggerServerEvent("esx_holdup:robberyStarted", k)
TriggerServerEvent("bpt_holdup:robberyStarted", k)
else
ESX.ShowNotification(_U("no_threat"))
ESX.ShowNotification(TranslateCap("no_threat"))
end
end
end
Expand All @@ -107,7 +107,7 @@ CreateThread(function()
if holdingUp then
letSleep = false
if #(playerPos - Stores[store].position) > Config.MaxDistance then
TriggerServerEvent("esx_holdup:tooFar", store)
TriggerServerEvent("bpt_holdup:tooFar", store)
holdingUp, letSleep = false, true
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,68 +1,68 @@
local rob = false
local robbers = {}

RegisterServerEvent("esx_holdup:tooFar")
AddEventHandler("esx_holdup:tooFar", function(currentStore)
RegisterServerEvent("bpt_holdup:tooFar")
AddEventHandler("bpt_holdup:tooFar", function(currentStore)
local source = source
rob = false
for _, xPlayer in pairs(ESX.GetExtendedPlayers("job", "police")) do
TriggerClientEvent("esx:showNotification", xPlayer.source, _U("robbery_cancelled_at", Stores[currentStore].nameOfStore))
TriggerClientEvent("esx_holdup:killBlip", xPlayer.source)
TriggerClientEvent("esx:showNotification", xPlayer.source, TranslateCap("robbery_cancelled_at", Stores[currentStore].nameOfStore))
TriggerClientEvent("bpt_holdup:killBlip", xPlayer.source)
end
if robbers[source] then
TriggerClientEvent("esx_holdup:tooFar", source)
TriggerClientEvent("bpt_holdup:tooFar", source)
ESX.ClearTimeout(robbers[source])
robbers[source] = nil
TriggerClientEvent("esx:showNotification", source, _U("robbery_cancelled_at", Stores[currentStore].nameOfStore))
TriggerClientEvent("esx:showNotification", source, TranslateCap("robbery_cancelled_at", Stores[currentStore].nameOfStore))
end
end)

RegisterServerEvent("esx_holdup:robberyStarted")
AddEventHandler("esx_holdup:robberyStarted", function(currentStore)
RegisterServerEvent("bpt_holdup:robberyStarted")
AddEventHandler("bpt_holdup:robberyStarted", function(currentStore)
local source = source
local xPlayer = ESX.GetPlayerFromId(source)
if Stores[currentStore] then
local store = Stores[currentStore]
if (os.time() - store.lastRobbed) < Config.TimerBeforeNewRob and store.lastRobbed ~= 0 then
TriggerClientEvent("esx:showNotification", source, _U("recently_robbed", Config.TimerBeforeNewRob - (os.time() - store.lastRobbed)))
TriggerClientEvent("esx:showNotification", source, TranslateCap("recently_robbed", Config.TimerBeforeNewRob - (os.time() - store.lastRobbed)))
return
end
if not rob then
local xPlayers = ESX.GetExtendedPlayers("job", "police")
if #xPlayers >= Config.PoliceNumberRequired then
rob = true
for i = 1, #xPlayers do
local xPlayer = xPlayers[i]
TriggerClientEvent("esx:showNotification", xPlayer.source, _U("rob_in_prog", store.nameOfStore))
TriggerClientEvent("esx_holdup:setBlip", xPlayer.source, Stores[currentStore].position)
local _ = xPlayers[i]
TriggerClientEvent("esx:showNotification", xPlayer.source, TranslateCap("rob_in_prog", store.nameOfStore))
TriggerClientEvent("bpt_holdup:setBlip", xPlayer.source, Stores[currentStore].position)
end
TriggerClientEvent("esx:showNotification", source, _U("started_to_rob", store.nameOfStore))
TriggerClientEvent("esx:showNotification", source, _U("alarm_triggered"))
TriggerClientEvent("esx_holdup:currentlyRobbing", source, currentStore)
TriggerClientEvent("esx_holdup:startTimer", source)
TriggerClientEvent("esx:showNotification", source, TranslateCap("started_to_rob", store.nameOfStore))
TriggerClientEvent("esx:showNotification", source, TranslateCap("alarm_triggered"))
TriggerClientEvent("bpt_holdup:currentlyRobbing", source, currentStore)
TriggerClientEvent("bpt_holdup:startTimer", source)
Stores[currentStore].lastRobbed = os.time()
robbers[source] = ESX.SetTimeout(store.secondsRemaining * 1000, function()
rob = false
if xPlayer then
TriggerClientEvent("esx_holdup:robberyComplete", source, store.reward)
TriggerClientEvent("bpt_holdup:robberyComplete", source, store.reward)
if Config.GiveBlackMoney then
xPlayer.addAccountMoney("black_money", store.reward, "Robbery")
else
xPlayer.addMoney(store.reward, "Robbery")
end
local xPlayers = ESX.GetExtendedPlayers("job", "police")
local _ = ESX.GetExtendedPlayers("job", "police")
for i = 1, #xPlayers do
local xPlayer = xPlayers[i]
TriggerClientEvent("esx:showNotification", xPlayer.source, _U("robbery_complete_at", store.nameOfStore))
TriggerClientEvent("esx_holdup:killBlip", xPlayer.source)
local _ = xPlayers[i]
TriggerClientEvent("esx:showNotification", xPlayer.source, TranslateCap("robbery_complete_at", store.nameOfStore))
TriggerClientEvent("bpt_holdup:killBlip", xPlayer.source)
end
end
end)
else
TriggerClientEvent("esx:showNotification", source, _U("min_police", Config.PoliceNumberRequired))
TriggerClientEvent("esx:showNotification", source, TranslateCap("min_police", Config.PoliceNumberRequired))
end
else
TriggerClientEvent("esx:showNotification", source, _U("robbery_already"))
TriggerClientEvent("esx:showNotification", source, TranslateCap("robbery_already"))
end
end
end)
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +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.

esx_mechanicjob
bpt_mechanicjob
Copyright (C) 2022-2024 bitpredator

This program is free software: you can redistribute it and/or modify
Expand All @@ -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:

esx_mechanicjob Copyright (C) 2022-2024 bitpredator
bpt_mechanicjob Copyright (C) 2022-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.
Expand Down
19 changes: 19 additions & 0 deletions server-data/resources/[bpt_addons]/bpt_mechanicjob/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<h1 align='center'>bpt_mechanicjob</a></h1>
<p align='center'><a href='https://discord.gg/ksGfNvDEfq'>Discord</a>

Copyright (C) 2022-2024 bitpredator

This program Is free software: you can redistribute it And/Or modify it under the terms Of the GNU General Public License As published by the Free Software Foundation, either version 3 Of the License, Or (at your option) any later version.

This program Is distributed In the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty Of MERCHANTABILITY Or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License For more details.

ATTENTION:
You are not authorized to change the name of the resource and the resources within it.

If you want to contribute you can open a pull request.

You are not authorized to sell this software (this is free project).

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Loading

0 comments on commit e34cb77

Please sign in to comment.