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

Add 30 days expiracy on buy new document #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 5 additions & 5 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,39 +35,39 @@ Config = {
reissuePrice = 20,
changePhotoPrice = 10,
extendPrice = 10,
defaultPicture = ''
defaultPicture = 'https://i.ibb.co/2s29db7/idcard.png'
},
huntinglicence = {
displayName = "Hunting Licence",
price = 10,
reissuePrice = 30,
changePhotoPrice = 10,
extendPrice = 10,
defaultPicture = ''
defaultPicture = 'https://i.ibb.co/rkXmSPs/hunterlicence.png'
},
mininglicence = {
displayName = "Mining Licence",
price = 20,
reissuePrice = 25,
changePhotoPrice = 10,
extendPrice = 10,
defaultPicture = ''
defaultPicture = 'https://i.ibb.co/PYk5gCn/mininglicence.png'
},
lumberlicence = {
displayName = "Lumber Licence",
price = 15,
reissuePrice = 20,
changePhotoPrice = 10,
extendPrice = 10,
defaultPicture = ''
defaultPicture = 'https://i.ibb.co/6mvwkRw/lumberlicence.png'
},
goldpanninglicence = {
displayName = "Gold Panning Licence",
price = 10,
reissuePrice = 15,
changePhotoPrice = 10,
extendPrice = 10,
defaultPicture = ''
defaultPicture = 'https://i.ibb.co/HKMWGBX/goldpanninglicence.png'
}
},

Expand Down
7 changes: 5 additions & 2 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ AddEventHandler('bcc-documents:server:createDocument', function(docType)
local charidentifier = Character.charIdentifier
local Money = Character.money
local price = Config.DocumentTypes[docType].price
local date, newExpiryDate = os.date('%Y-%m-%d %H:%M:%S')
local date = os.date('%Y-%m-%d %H:%M:%S')
-- Calcula 30 dias a partir da data atual (30 dias * 86400 segundos por dia)
local newExpiryDate = os.date('%Y-%m-%d %H:%M:%S', os.time() + (30 * 86400))
local picture = Config.DocumentTypes[docType].defaultPicture

devPrint("Creating document for user:", charidentifier, "docType:", docType)
Expand All @@ -72,7 +74,7 @@ AddEventHandler('bcc-documents:server:createDocument', function(docType)
Character.identifier, charidentifier, docType,
Character.firstname, Character.lastname, Character.nickname,
Character.jobLabel, Character.age, Character.gender,
date, picture, newExpiryDate
date, picture, newExpiryDate -- Aqui está a nova data de expiração
}, function()
Character.removeCurrency(0, price)
VORPcore.NotifyLeft(src, _U('BoughtDocument') .. price .. '$', "", Config.Textures.tick[1], Config.Textures.tick[2], 5000)
Expand All @@ -88,6 +90,7 @@ AddEventHandler('bcc-documents:server:createDocument', function(docType)
end)
end)


RegisterServerEvent('bcc-documents:server:reissueDocument')
AddEventHandler('bcc-documents:server:reissueDocument', function(docType)
local src = source
Expand Down