Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: cron updated to version 1.0.1 #660

Merged
merged 19 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
c84cd3f
chore: cron updated to version 1.0.1
bitpredator Feb 29, 2024
696b6ae
Add files via upload
bitpredator Feb 29, 2024
a76d175
refactor: partial rebuild for es_extended
bitpredator Feb 29, 2024
f7997e8
Merge branch 'dev' of https://github.com/bitpredator/empiretown into dev
bitpredator Feb 29, 2024
f4698d6
Merge branch 'dev' of https://github.com/bitpredator/empiretown into dev
bitpredator Feb 29, 2024
4d8a3b7
chore: esx_context updated to version 1.0.1
bitpredator Feb 29, 2024
3e69375
chore: esx_identity updated to version 1.0.1 + Run formatter
bitpredator Feb 29, 2024
10505ba
chore: esx_menu_default updated to version 1.0.1 + Run formatter
bitpredator Feb 29, 2024
771e676
chore: esx_menu_dialog updated to version 1.0.1 + Run formatter
bitpredator Feb 29, 2024
48454e4
chore: esx_menu_list updated to version 1.0.1
bitpredator Feb 29, 2024
efacccd
chore: esx_multicharacter updated to version 1.0.1
bitpredator Feb 29, 2024
2762250
chore: esx_notify updated to version 1.0.1
bitpredator Feb 29, 2024
d7b43ab
chore: esx_progressbar updated to version 1.0.1
bitpredator Feb 29, 2024
8c66112
chore: esx_textui updated to version 1.0.1 + Run formatter
bitpredator Feb 29, 2024
d799309
chore: Translated the database into the main directory in English
bitpredator Feb 29, 2024
39d15a1
chore: Translated the database into the main directory in English
bitpredator Feb 29, 2024
4bda410
chore: update ox_inventory version 2.38.1
bitpredator Feb 29, 2024
eda88d6
chore: new database for version 1.0.1
bitpredator Feb 29, 2024
b802b8a
Delete async.lua
bitpredator Mar 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
674 changes: 674 additions & 0 deletions server-data/resources/[esx]/cron/LICENSE

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions server-data/resources/[esx]/cron/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<h1 align='center'>cron</a></h1>
<p align='center'><a href='https://discord.gg/ksGfNvDEfq'>Discord</a>

A simple, but vital, resource that allows resources to Run tasks at specific intervals.

# Example Usage

```lua

-- Execute task 5:10, every day
function CronTask(d, h, m)
print('Task done')
end

TriggerEvent('cron:runAt', 5, 10, CronTask)

-- Execute task every monday at 18:30
function CronTask(d, h, m)
if d == 1 then
print('Task done')
end
end

TriggerEvent('cron:runAt', 18, 30, CronTask)

```

# Legal

cron - run tasks at specific intervals!

Copyright (C) 2015-2024 Jérémie N'gadi

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.

You should have received a copy Of the GNU General Public License along with this program. If Not, see http://www.gnu.org/licenses/.
9 changes: 9 additions & 0 deletions server-data/resources/[esx]/cron/fxmanifest.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
fx_version 'adamant'

game 'gta5'
author 'bitpredator'
description 'cron'
lua54 'yes'
version '1.0.1'

server_script 'server/main.lua'
50 changes: 50 additions & 0 deletions server-data/resources/[esx]/cron/server/main.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
local Jobs = {}
local LastTime = nil

function RunAt(h, m, cb)
Jobs[#Jobs + 1] = {
h = h,
m = m,
cb = cb,
}
end

function GetUnixTimestamp()
return os.time()
end

function OnTime(time)
for i = 1, #Jobs, 1 do
local scheduledTimestamp = os.time({
hour = Jobs[i].h,
minute = Jobs[i].m,
second = 0, -- Assuming tasks run at the start of the minute
day = os.date("%d", time),
month = os.date("%m", time),
year = os.date("%Y", time),
})

if time >= scheduledTimestamp and (not LastTime or LastTime < scheduledTimestamp) then
Jobs[i].cb(Jobs[i].h, Jobs[i].m)
end
end
end

function Tick()
local time = GetUnixTimestamp()

if not LastTime or os.date("%M", time) ~= os.date("%M", LastTime) then
OnTime(time)
LastTime = time
end

SetTimeout(60000, Tick)
end

LastTime = GetUnixTimestamp()

Tick()

AddEventHandler("cron:runAt", function(h, m, cb)
RunAt(h, m, cb)
end)
13 changes: 6 additions & 7 deletions server-data/resources/[esx]/es_extended/LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

Expand Down Expand Up @@ -631,8 +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.

<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 2022-2024 bitpredator
es_extended 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
Expand All @@ -645,14 +644,14 @@ the "copyright" line and a pointer to where the full notice is found.
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 <https://www.gnu.org/licenses/>.
along with this program. If not, see <http://www.gnu.org/licenses/>.

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) 2022-2024 bitpredator
es_extended 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 All @@ -664,11 +663,11 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
<http://www.gnu.org/licenses/>.

The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
11 changes: 4 additions & 7 deletions server-data/resources/[esx]/es_extended/client/common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@ exports("getSharedObject", function()
return ESX
end)

if GetResourceState("ox_inventory") ~= "missing" then
Config.OxInventory = true
end

RegisterNetEvent("esx:getSharedObject", function()
AddEventHandler("esx:getSharedObject", function()
local Invoke = GetInvokingResource()
print(
("[^1ERROR^7] Resource ^5%s^7 Used the ^5getSharedObject^7 Event, this event ^1no longer exists!^7 Visit https://bitpredator.github.io/bptdevelopment/docs/esx-tutorial/sharedevent for how to fix!"):format(
GetInvokingResource
("[^1ERROR^7] Resource ^5%s^7 Used the ^5getSharedObject^7 Event, this event ^1no longer exists!^7 Visit https://documentation.esx-framework.org/tutorials/tutorials-esx/sharedevent for how to fix!"):format(
Invoke
)
)
end)
Loading
Loading