diff --git a/client/main.lua b/client/main.lua index 27df6e1..e5c3c91 100644 --- a/client/main.lua +++ b/client/main.lua @@ -1,6 +1,5 @@ local CreatedBlip = {} local CreatedNpc = {} -local MyidOpen = false local documentMainMenu local function debugPrint(...) @@ -58,68 +57,115 @@ end function OpenMenu() documentMainMenu = BCCDocumentsMainMenu:RegisterPage("Main:Page") - documentMainMenu:RegisterElement('header', { value = _U('Licenses'), slot = 'header', style = {} }) - documentMainMenu:RegisterElement('line', { slot = "header", style = {} }) + documentMainMenu:RegisterElement('header', { + value = _U('Licenses'), + slot = 'header', + style = {} + }) + documentMainMenu:RegisterElement('line', { + slot = "header", + style = {} + }) for docType, settings in pairs(Config.DocumentTypes) do if settings.sellNpc then - documentMainMenu:RegisterElement('button', { label = settings.displayName, style = {} }, function() + documentMainMenu:RegisterElement('button', { + label = settings.displayName, + style = {} + }, function() OpenDocumentSubMenu(docType) end) end end - documentMainMenu:RegisterElement('bottomline', { value = _U('Licenses'), slot = 'footer', style = {} }) - BCCDocumentsMainMenu:Open({ startupPage = documentMainMenu }) + documentMainMenu:RegisterElement('bottomline', { + style = {} + }) + BCCDocumentsMainMenu:Open({ + startupPage = documentMainMenu + }) end function OpenDocumentSubMenu(docType) local documentSubMenu = BCCDocumentsMainMenu:RegisterPage("submenu:" .. docType) - documentSubMenu:RegisterElement('header', - { value = Config.DocumentTypes[docType].displayName, slot = 'header', style = {} }) - documentSubMenu:RegisterElement('button', - { label = _U('RegisterDoc') .. " - $" .. Config.DocumentTypes[docType].price, style = {} }, function() + documentSubMenu:RegisterElement('header', { + value = Config.DocumentTypes[docType].displayName, + slot = 'header', + style = {} + }) + documentSubMenu:RegisterElement('button', { + label = _U('RegisterDoc') .. " - $" .. Config.DocumentTypes[docType].price, + style = {} + }, function() TriggerEvent('bcc-documents:client:createDocument', docType) end) if docType == 'idcard' then - documentSubMenu:RegisterElement('button', - { label = _U('ChangePicture') .. " - $" .. Config.DocumentTypes[docType].changePhotoPrice, style = {} }, - function() - ChangeDocumentPhoto(docType) - end) + documentSubMenu:RegisterElement('button', { + label = _U('ChangePicture') .. " - $" .. Config.DocumentTypes[docType].changePhotoPrice, + style = {} + }, function() + ChangeDocumentPhoto(docType) + end) end - documentSubMenu:RegisterElement('button', - { label = _U('DocumentLost') .. " - $" .. Config.DocumentTypes[docType].reissuePrice, style = {} }, function() + documentSubMenu:RegisterElement('button', { + label = _U('DocumentLost') .. " - $" .. Config.DocumentTypes[docType].reissuePrice, + style = {} + }, function() TriggerEvent('bcc-documents:client:reissueDocument', docType) end) if docType ~= 'idcard' or docType ~= 'weaponlicense' then local docConfig = Config.DocumentTypes[docType] - documentSubMenu:RegisterElement('button', - { label = _U('ExtendExpiry') .. " - $" .. docConfig.extendPrice, style = {} }, function() + documentSubMenu:RegisterElement('button', { + label = _U('ExtendExpiry') .. " - $" .. docConfig.extendPrice, + style = {} + }, function() AddExpiryDate(docType) end) end - documentSubMenu:RegisterElement('button', { label = _U('BackButton'), style = {} }, function() + documentSubMenu:RegisterElement('line', { + value = _U('Licenses'), + slot = 'footer', + style = {} + }) + + documentSubMenu:RegisterElement('button', { + label = _U('BackButton'), + slot = 'footer', + style = {} + }, function() openMainMenu() end) - documentSubMenu:RegisterElement('bottomline', { value = _U('Licenses'), slot = 'footer', style = {} }) - BCCDocumentsMainMenu:Open({ startupPage = documentSubMenu }) + documentSubMenu:RegisterElement('bottomline', { + slot = 'footer', + style = {} + }) + + BCCDocumentsMainMenu:Open({ + startupPage = documentSubMenu + }) end function ChangeDocumentPhoto(docType) local ChangePhotoPage = BCCDocumentsMainMenu:RegisterPage('change:photo') local photoLink = nil - ChangePhotoPage:RegisterElement('header', - { value = Config.DocumentTypes[docType].displayName, slot = 'header', style = {} }) - ChangePhotoPage:RegisterElement('input', - { label = _U('InputPhotolink'), placeholder = _U('PastePhotoLink'), persist = false, style = {} }, function(data) + ChangePhotoPage:RegisterElement('header', { + value = Config.DocumentTypes[docType].displayName, + slot = 'header', + style = {} + }) + ChangePhotoPage:RegisterElement('input', { + label = _U('InputPhotolink'), + placeholder = _U('PastePhotoLink'), + persist = false, + style = {} + }, function(data) if data.value and data.value ~= "" then photoLink = data.value else @@ -127,7 +173,16 @@ function ChangeDocumentPhoto(docType) end end) - ChangePhotoPage:RegisterElement('button', { label = _U('Submit'), style = { ['border-radius'] = '6px' } }, function() + ChangePhotoPage:RegisterElement('line', { + slot = 'footer', + style = {} + }) + + ChangePhotoPage:RegisterElement('button', { + label = _U('Submit'), + slot = 'footer', + style = {} + }, function() if docType and photoLink then TriggerServerEvent('bcc-documents:server:changeDocumentPhoto', docType, photoLink) OpenDocumentSubMenu(docType) @@ -136,31 +191,59 @@ function ChangeDocumentPhoto(docType) end end) - ChangePhotoPage:RegisterElement('button', { label = _U('BackButton'), style = {} }, function() + ChangePhotoPage:RegisterElement('button', { + label = _U('BackButton'), + slot = 'footer', + style = {} + }, function() OpenDocumentSubMenu(docType) end) - BCCDocumentsMainMenu:Open({ startupPage = ChangePhotoPage }) + ChangePhotoPage:RegisterElement('bottomline', { + slot = 'footer', + style = {} + }) + + BCCDocumentsMainMenu:Open({ + startupPage = ChangePhotoPage + }) end function AddExpiryDate(docType) local inputPage = BCCDocumentsMainMenu:RegisterPage("input:expiry") local daysToAdd = nil - inputPage:RegisterElement('header', - { value = Config.DocumentTypes[docType].displayName, slot = 'header', style = {} }) - inputPage:RegisterElement('input', - { label = _U('EnterExpiryDays'), placeholder = _U('NumberOfDays'), inputType = 'number', slot = 'content', style = {} }, - function(data) - if tonumber(data.value) and tonumber(data.value) > 0 then - daysToAdd = tonumber(data.value) - else - daysToAdd = nil - debugPrint("Invalid input for days.") - end - end) + inputPage:RegisterElement('header', { + value = Config.DocumentTypes[docType].displayName, + slot = 'header', + style = {} + }) + + inputPage:RegisterElement('input', { + label = _U('EnterExpiryDays'), + placeholder = _U('NumberOfDays'), + inputType = 'number', + slot = 'content', + style = {} + }, function(data) + if tonumber(data.value) and tonumber(data.value) > 0 then + daysToAdd = tonumber(data.value) + else + daysToAdd = nil + debugPrint("Invalid input for days.") + end + end) - inputPage:RegisterElement('button', { label = _U('Confirm'), style = { ['border-radius'] = '6px' } }, function() + inputPage:RegisterElement('line', { + slot = 'footer', + style = {} + }) + + inputPage:RegisterElement('button', { + label = _U('Confirm'), + slot = 'footer', + style = {} + }, function() if daysToAdd then TriggerServerEvent('bcc-documents:server:updateExpiryDate', docType, daysToAdd) OpenDocumentSubMenu(docType) @@ -169,24 +252,45 @@ function AddExpiryDate(docType) end end) - inputPage:RegisterElement('button', { label = _U('BackButton'), style = {} }, function() + inputPage:RegisterElement('button', { + label = _U('BackButton'), + slot = 'footer', + style = {} + }, function() OpenDocumentSubMenu(docType) end) - BCCDocumentsMainMenu:Open({ startupPage = inputPage }) + inputPage:RegisterElement('bottomline', { + slot = 'footer', + style = {} + }) + + BCCDocumentsMainMenu:Open({ + startupPage = inputPage + }) end function ShowDocument(docType, firstname, lastname, nickname, job, age, gender, date, picture, expire_date) - if not MyidOpen then - local DocumentPageShow = BCCDocumentsMainMenu:RegisterPage("show:document") - DocumentPageShow:RegisterElement('header', { value = Config.DocumentTypes[docType].displayName, slot = 'header' }) - DocumentPageShow:RegisterElement('line', { slot = 'header' }) - DocumentPageShow:RegisterElement("html", - { slot = 'header', value = [[]] }) - if docType == "idcard" or docType == "weaponlicense" then - DocumentPageShow:RegisterElement("html", { - value = [[ + local DocumentPageShow = BCCDocumentsMainMenu:RegisterPage("show:document") + + DocumentPageShow:RegisterElement('header', { + value = Config.DocumentTypes[docType].displayName, + slot = 'header' + }) + + DocumentPageShow:RegisterElement('line', { + slot = 'header' + }) + + DocumentPageShow:RegisterElement("html", + { + slot = 'header', + value = [[]] + }) + if docType == "idcard" or docType == "weaponlicense" then + DocumentPageShow:RegisterElement("html", { + value = [[

]] .. _U('Firstname') .. [[ ]] .. (firstname or 'Unknown') .. [[

]] .. _U('Lastname') .. [[ ]] .. (lastname or 'Unknown') .. [[

@@ -197,10 +301,10 @@ function ShowDocument(docType, firstname, lastname, nickname, job, age, gender,

]] .. _U('CreationDate') .. [[ ]] .. (date or 'Unknown') .. [[

]] - }) - else - DocumentPageShow:RegisterElement("html", { - value = [[ + }) + else + DocumentPageShow:RegisterElement("html", { + value = [[

]] .. _U('Firstname') .. [[ ]] .. (firstname or 'Unknown') .. [[

]] .. _U('Lastname') .. [[ ]] .. (lastname or 'Unknown') .. [[

@@ -213,27 +317,37 @@ function ShowDocument(docType, firstname, lastname, nickname, job, age, gender,
]] }) - end - - MyidOpen = true - BCCDocumentsMainMenu:Open({ startupPage = DocumentPageShow }) - else - BCCDocumentsMainMenu:Close() - MyidOpen = false end + + BCCDocumentsMainMenu:Open({ + startupPage = DocumentPageShow + }) end function OpenDocument(docType, firstname, lastname, nickname, job, age, gender, date, picture, expire_date) - if not MyidOpen then - local DocumentPageOpen = BCCDocumentsMainMenu:RegisterPage("open:document") - DocumentPageOpen:RegisterElement('header', { value = Config.DocumentTypes[docType].displayName, slot = 'header' }) - DocumentPageOpen:RegisterElement('line', { slot = 'header' }) - DocumentPageOpen:RegisterElement("html", - { slot = 'header', value = [[]] }) - if docType == "idcard" or docType == "weaponlicense" then - DocumentPageOpen:RegisterElement("html", { - value = [[ + local DocumentPageOpen = BCCDocumentsMainMenu:RegisterPage("open:document") + DocumentPageOpen:RegisterElement('header', { + value = Config.DocumentTypes[docType].displayName, + slot = 'header' + }) + DocumentPageOpen:RegisterElement('line', { + slot = 'header' + }) + + DocumentPageOpen:RegisterElement("html", { + slot = 'header', + value = [[ + + ]] + }) + + DocumentPageOpen:RegisterElement('line', { + }) + + if docType == "idcard" or docType == "weaponlicense" then + DocumentPageOpen:RegisterElement("html", { + value = [[

]] .. _U('Firstname') .. [[ ]] .. (firstname or 'Unknown') .. [[

]] .. _U('Lastname') .. [[ ]] .. (lastname or 'Unknown') .. [[

@@ -244,10 +358,10 @@ function OpenDocument(docType, firstname, lastname, nickname, job, age, gender,

]] .. _U('CreationDate') .. [[ ]] .. (date or 'Unknown') .. [[

]] - }) - else - DocumentPageOpen:RegisterElement("html", { - value = [[ + }) + else + DocumentPageOpen:RegisterElement("html", { + value = [[

]] .. _U('Firstname') .. [[ ]] .. (firstname or 'Unknown') .. [[

]] .. _U('Lastname') .. [[ ]] .. (lastname or 'Unknown') .. [[

@@ -259,64 +373,108 @@ function OpenDocument(docType, firstname, lastname, nickname, job, age, gender,

]] .. _U('ExpiryDate') .. [[ ]] .. (expire_date or 'N/A') .. [[

]] - }) - end + }) + end - DocumentPageOpen:RegisterElement('button', { label = _U('ShowDocument'), style = { ['border-radius'] = '6px' } }, - function() - OpenShowToPlayerMenu(docType, firstname, lastname, nickname, job, age, gender, date, picture, expire_date) - end) - DocumentPageOpen:RegisterElement('button', - { label = _U('RevokeDocument'), style = { ['border-radius'] = '6px' } }, function() - if docType and docType ~= '' then - TriggerServerEvent('bcc-documents:server:revokeMyDocument', docType) - Wait(500) -- Small delay to ensure synchronization - BCCDocumentsMainMenu:Close() - else - debugPrint("Error: docType is nil or empty") - end - end) - DocumentPageOpen:RegisterElement('button', { label = _U('PutBack'), style = { ['border-radius'] = '6px' } }, - function() - BCCDocumentsMainMenu:Close() - end) + DocumentPageOpen:RegisterElement('line', { + slot = 'footer', + style = {} + }) + + DocumentPageOpen:RegisterElement('button', { + label = _U('ShowDocument'), + slot = 'footer', + style = {} + }, function() + OpenShowToPlayerMenu(docType, firstname, lastname, nickname, job, age, gender, date, picture, expire_date) + end) - MyidOpen = true - BCCDocumentsMainMenu:Open({ startupPage = DocumentPageOpen }) - else - --BCCDocumentsMainMenu:Close() - MyidOpen = false - end + DocumentPageOpen:RegisterElement('button', { + label = _U('RevokeDocument'), + slot = 'footer', + style = {} + }, function() + if docType and docType ~= '' then + TriggerServerEvent('bcc-documents:server:revokeMyDocument', docType) + Wait(500) -- Small delay to ensure synchronization + BCCDocumentsMainMenu:Close() + else + debugPrint("Error: docType is nil or empty") + end + end) + + DocumentPageOpen:RegisterElement('button', { + label = _U('PutBack'), + slot = 'footer', + style = {} + }, function() + BCCDocumentsMainMenu:Close() + end) + + DocumentPageOpen:RegisterElement('bottomline', { + slot = 'footer', + style = {} + }) + + BCCDocumentsMainMenu:Open({ + startupPage = DocumentPageOpen + }) end function OpenShowToPlayerMenu(docType, firstname, lastname, nickname, job, age, gender, date, picture, expire_date) local players = GetNearbyPlayers() local playerMenu = BCCDocumentsMainMenu:RegisterPage("playerMenu") - playerMenu:RegisterElement('header', { value = _U('ChoosePlayer'), slot = 'header' }) + playerMenu:RegisterElement('header', { + value = _U('ChoosePlayer'), + slot = 'header' + }) if #players > 0 then for _, player in ipairs(players) do debugPrint("Nearby Player:", player.id, GetPlayerName(GetPlayerFromServerId(player.id))) - playerMenu:RegisterElement('button', { label = GetPlayerName(GetPlayerFromServerId(player.id)), style = {} }, - function() - TriggerServerEvent('bcc-documents:server:showDocumentToPlayer', player.id, docType, firstname, - lastname, nickname, job, age, gender, date, picture, expire_date) - Wait(500) -- Small delay to ensure synchronization - VORPcore.NotifyObjective( - GetPlayerName(GetPlayerFromServerId(player.id)) .. " - Verifica documentul dvs", 4000) - end) + playerMenu:RegisterElement('button', { + label = GetPlayerName(GetPlayerFromServerId(player.id)), + style = {} + }, function() + TriggerServerEvent('bcc-documents:server:showDocumentToPlayer', player.id, docType, firstname, + lastname, nickname, job, age, gender, date, picture, expire_date) + Wait(500) -- Small delay to ensure synchronization + VORPcore.NotifyObjective(GetPlayerName(GetPlayerFromServerId(player.id)) .. _U('checkingYourDoc'), 4000) + end) end else - playerMenu:RegisterElement('text', - { value = _U('NoNearbyPlayer'), style = { color = 'red', ['text-align'] = 'center', ['margin-top'] = '10px' } }) + TextDisplay = playerMenu:RegisterElement('textdisplay', { + value = _U('NoNearbyPlayer'), + style = { + color = 'red', + ['text-align'] = 'center', + ['margin-top'] = '10px' + } + }) end - playerMenu:RegisterElement('button', { label = _U('BackButton'), style = {} }, function() + playerMenu:RegisterElement('line', { + slot = 'footer', + style = {} + }) + + playerMenu:RegisterElement('button', { + label = _U('BackButton'), + slot = 'footer', + style = {} + }, function() OpenDocument(docType, firstname, lastname, nickname, job, age, gender, date, picture, expire_date) end) - BCCDocumentsMainMenu:Open({ startupPage = playerMenu }) + playerMenu:RegisterElement('bottomline', { + slot = 'footer', + style = {} + }) + + BCCDocumentsMainMenu:Open({ + startupPage = playerMenu + }) end function GetNearbyPlayers() @@ -347,6 +505,7 @@ end) RegisterNetEvent('bcc-documents:client:opendocument') AddEventHandler('bcc-documents:client:opendocument', function(docType, firstname, lastname, nickname, job, age, gender, date, picture, expire_date) + debugPrint("OpenDocument triggered with docType: " .. docType) OpenDocument(docType, firstname, lastname, nickname, job, age, gender, date, picture, expire_date) end) diff --git a/config.lua b/config.lua index 3fbe761..f5aa1ad 100644 --- a/config.lua +++ b/config.lua @@ -41,6 +41,7 @@ Config = { reissuePrice = 20, changePhotoPrice = 10, extendPrice = 10, + expiryDays = 0, -- Set expiry duration by default defaultPicture = '', sellNpc = true, givenCommand = false, @@ -52,7 +53,8 @@ Config = { reissuePrice = 30, changePhotoPrice = 10, extendPrice = 10, - defaultPicture = '', + expiryDays = 1, -- Set expiry duration by default + defaultPicture ='', sellNpc = true, givenCommand = false, allowJob = "", @@ -63,7 +65,11 @@ Config = { reissuePrice = 25, changePhotoPrice = 10, extendPrice = 10, - defaultPicture = '' + expiryDays = 1, -- Set expiry duration by default + defaultPicture = '', + sellNpc = true, + givenCommand = false, + allowJob = "", }, lumberlicence = { displayName = "Lumber Licence", @@ -71,6 +77,7 @@ Config = { reissuePrice = 20, changePhotoPrice = 10, extendPrice = 10, + expiryDays = 1, -- Set expiry duration by default defaultPicture = '', sellNpc = true, givenCommand = false, @@ -82,6 +89,7 @@ Config = { reissuePrice = 15, changePhotoPrice = 10, extendPrice = 10, + expiryDays = 1, -- Set expiry duration by default defaultPicture = '', sellNpc = true, givenCommand = false, @@ -93,7 +101,8 @@ Config = { reissuePrice = 0, changePhotoPrice = 0, extendPrice = 0, - defaultPicture = 'https://upload.fixitfy.com.tr/images/FIXITFY-lCnMiZnVCH.png', + expiryDays = 0, -- Set expiry duration by default + defaultPicture = '', sellNpc = false, givenCommand = "giveweaponlicense", allowJob = "doj", diff --git a/fxmanifest.lua b/fxmanifest.lua index 47aa2ad..078f4cc 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -32,4 +32,4 @@ dependency { 'bcc-utils' } -version '0.0.2' +version '0.1.0' diff --git a/languages/de_lang.lua b/languages/de_lang.lua index e392e9d..1465123 100644 --- a/languages/de_lang.lua +++ b/languages/de_lang.lua @@ -47,5 +47,6 @@ Locales["de_lang"] = { GetDocument = "Du hast ein Dokument erhalten: ", GiveDocument = "Du hast ein Dokument ausgestellt: ", TargetAlreadyGotDocument = "Die Person besitzt dieses Dokument bereits!", - NoNeedItem = "Dir fehlt folgender Gegenstand: " + NoNeedItem = "Dir fehlt folgender Gegenstand: ", + checkingYourDoc = " - Checking your document" } diff --git a/languages/en_lang.lua b/languages/en_lang.lua index 79bc0d0..1a8e98b 100644 --- a/languages/en_lang.lua +++ b/languages/en_lang.lua @@ -47,5 +47,6 @@ Locales["en_lang"] = { GetDocument = "You have received a document: ", GiveDocument = "You gave a document: ", TargetAlreadyGotDocument = "The person already has this document!", - NoNeedItem = "You are missing the following item: " + NoNeedItem = "You are missing the following item: ", + checkingYourDoc = " - Checking your document" } diff --git a/languages/ro_lang.lua b/languages/ro_lang.lua index b76b824..1ab4b89 100644 --- a/languages/ro_lang.lua +++ b/languages/ro_lang.lua @@ -43,9 +43,10 @@ Locales["ro_lang"] = { YouRevokedDocument = 'Ti-ai anulat documentul', DontHaveToRevoke = 'Nu ai un document de anulat', --- New - NoJob = "Nu sunteți autorizat să faceți acest lucru!", - GetDocument = "Ați primit un document: ", + NoJob = "Nu sunteți autorizat sa faceți acest lucru!", + GetDocument = "Ati primit un document: ", GiveDocument = "Ai dat un document: ", TargetAlreadyGotDocument = "Persoana are deja acest document!", - NoNeedItem = "Vă lipsește următorul articol: " + NoNeedItem = "Va lipseste urmatorul articol: ", + checkingYourDoc = " - Verifica documentul dvs" } diff --git a/server/main.lua b/server/main.lua index 5b5fa28..ed5c521 100644 --- a/server/main.lua +++ b/server/main.lua @@ -7,15 +7,8 @@ local function devPrint(...) end end --- Function to register a document type as a usable item -local function registerDocumentType(docType) - exports.vorp_inventory:registerUsableItem(docType, function(data) - handleDocumentUse(data.source, docType) - end) -end - -- Function to handle the usage of a document -function handleDocumentUse(src, docType) +function handleDocumentUse(src, docType, docDisplayName) local User = VORPcore.getUser(src) if User then @@ -27,12 +20,14 @@ function handleDocumentUse(src, docType) MySQL.query('SELECT * FROM `bcc_documents` WHERE charidentifier = ? AND doc_type = ?', {charidentifier, docType}, function(result) if result and #result > 0 then local doc = result[1] - devPrint("Document found:", doc) + devPrint("Document found:", json.encode(doc)) -- Use json.encode to print the table contents TriggerClientEvent('bcc-documents:client:opendocument', src, docType, doc.firstname, doc.lastname, doc.nickname, doc.job, doc.age, doc.gender, doc.date, doc.picture, doc.expire_date) else devPrint("No document found for user:", charidentifier, "docType:", docType) VORPcore.NotifyLeft(src, _U('GotNoDocument'), "", Config.Textures.cross[1], Config.Textures.cross[2], 5000) end + -- Close inventory only after event handling + exports.vorp_inventory:closeInventory(src) end) else devPrint("Error: Character data not found for user:", src) @@ -40,12 +35,15 @@ function handleDocumentUse(src, docType) else devPrint("Error: User not found for source:", src) end - exports.vorp_inventory:closeInventory(src) end --- Iterate over each document type and register it -for docType, _ in pairs(Config.DocumentTypes) do - registerDocumentType(docType) +-- Iterate over each document type and register it as a usable item +for docType, docData in pairs(Config.DocumentTypes) do + exports.vorp_inventory:registerUsableItem(docType, function(data) + local src = data.source + exports.vorp_inventory:closeInventory(src) -- Close inventory on use + handleDocumentUse(src, docType, docData.displayName) -- Pass the display name + end) end -- Register other server events @@ -57,7 +55,8 @@ AddEventHandler('bcc-documents:server:createDocument', function(docType) local Money = Character.money local price = Config.DocumentTypes[docType].price local year = Config.PlayYear - local date, newExpiryDate = os.date(year..'-%m-%d %H:%M:%S') + local date = os.date(year..'-%m-%d %H:%M:%S') + local newExpiryDate = os.date(year..'-%m-%d %H:%M:%S', os.time() + (Config.DocumentTypes[docType].expiryDays * 86400)) local picture = Config.DocumentTypes[docType].defaultPicture devPrint("Creating document for user:", charidentifier, "docType:", docType) @@ -98,7 +97,8 @@ AddEventHandler('bcc-documents:server:createDocumentCommand', function(src, docu local targetIdentifier = target.charIdentifier local docType = document local year = Config.PlayYear - local date, newExpiryDate = os.date(year..'-%m-%d %H:%M:%S') + local date = os.date(year..'-%m-%d %H:%M:%S') + local newExpiryDate = os.date(year..'-%m-%d %H:%M:%S', os.time() + (Config.DocumentTypes[docType].expiryDays * 86400)) local picture = Config.DocumentTypes[docType].defaultPicture local itemNeedCount = exports.vorp_inventory:getItemCount(src, nil, Config.NeedItemName) if Config.NeedItem then @@ -334,10 +334,9 @@ end) function RegisterCommands(command, document, job) RegisterCommand(command, function(source, args, rawCommand) local src = source - --GiveDoc(src, document, job, args) TriggerEvent('bcc-documents:server:createDocumentCommand', src, document, job, args) end) - print("--------------------------------------------------------------") - print("Command Registered!", command) - print("--------------------------------------------------------------") + devPrint("--------------------------------------------------------------") + devPrint("Command Registered!", command) + devPrint("--------------------------------------------------------------") end diff --git a/version b/version index 06e8aa4..e160781 100644 --- a/version +++ b/version @@ -1,2 +1,2 @@ -<0.0.2> +<0.1.0> See GitHub for details! \ No newline at end of file