diff --git a/server-data/resources/[bpt_addons]/bpt_basicItem/basicItem.sql b/server-data/resources/[bpt_addons]/bpt_basicItem/basicItem.sql new file mode 100644 index 000000000..c4cc214d7 --- /dev/null +++ b/server-data/resources/[bpt_addons]/bpt_basicItem/basicItem.sql @@ -0,0 +1,5 @@ +INSERT INTO `items` (`name`, `label`) VALUES + ('idcard', 'Identity Cards'), + ('licensecard', 'PPA License'), + ('dmvcard', 'License DMV') +; \ No newline at end of file diff --git a/server-data/resources/[bpt_addons]/bpt_basicItem/client/main.lua b/server-data/resources/[bpt_addons]/bpt_basicItem/client/main.lua new file mode 100644 index 000000000..b8a421d8b --- /dev/null +++ b/server-data/resources/[bpt_addons]/bpt_basicItem/client/main.lua @@ -0,0 +1,39 @@ +local closestDistance, closestPlayer, playerReceiveCard = {}, {}, {} + +ESX = exports["es_extended"]:getSharedObject() + +RegisterNetEvent("IDCARD:USE") +AddEventHandler("IDCARD:USE", function() + closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + if closestDistance ~= -1 and closestDistance <= 2.0 then + TriggerServerEvent("bpt_idcard:open", GetPlayerServerId(PlayerId()), GetPlayerServerId(closestPlayer)) + else + TriggerServerEvent("bpt_idcard:open", GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId())) + end + Wait(1) +end) + +RegisterNetEvent("DMVCARD:USE") +AddEventHandler("DMVCARD:USE", function() + closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + if closestDistance ~= -1 and closestDistance <= 2.0 then + ESX.ShowNotification((playerReceiveCard):format(GetPlayerName(closestPlayer))) + TriggerServerEvent("bpt_idcard:open", GetPlayerServerId(PlayerId()), GetPlayerServerId(closestPlayer), "driver") + else + TriggerServerEvent("bpt_idcard:open", GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()), "driver") + end + Wait(1) +end) + +RegisterNetEvent("WCARD:USE") +AddEventHandler("WCARD:USE", function() + closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + if closestDistance ~= -1 and closestDistance <= 2.0 then + ESX.ShowNotification((playerReceiveCard):format(GetPlayerName(closestPlayer))) + TriggerServerEvent("bpt_idcardidcard:open", GetPlayerServerId(PlayerId()), GetPlayerServerId(closestPlayer), + "weapon") + else + TriggerServerEvent("bpt_idcard:open", GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()), "weapon") + end + Wait(1) +end) diff --git a/server-data/resources/[esx_addons]/BasicItem/config.lua b/server-data/resources/[bpt_addons]/bpt_basicItem/config.lua similarity index 100% rename from server-data/resources/[esx_addons]/BasicItem/config.lua rename to server-data/resources/[bpt_addons]/bpt_basicItem/config.lua diff --git a/server-data/resources/[esx_addons]/BasicItem/fxmanifest.lua b/server-data/resources/[bpt_addons]/bpt_basicItem/fxmanifest.lua similarity index 72% rename from server-data/resources/[esx_addons]/BasicItem/fxmanifest.lua rename to server-data/resources/[bpt_addons]/bpt_basicItem/fxmanifest.lua index 293f65414..9e8a8c1b0 100644 --- a/server-data/resources/[esx_addons]/BasicItem/fxmanifest.lua +++ b/server-data/resources/[bpt_addons]/bpt_basicItem/fxmanifest.lua @@ -1,14 +1,12 @@ fx_version("cerulean") game("gta5") -name("LItemBasic") -description("fivem resource") -author("LQuatre") -version("1.0.1") +description("fivem basic Item") +author("bitpredator") +version("1.0.0") lua54("yes") shared_scripts({ - "shared/*.lua", "@es_extended/imports.lua", }) @@ -16,7 +14,6 @@ client_scripts({ "@es_extended/locale.lua", "client/*.lua", "locales/*.lua", - "shared/*.lua", "config.lua", }) @@ -25,7 +22,6 @@ server_scripts({ "@mysql-async/lib/MySQL.lua", "server/*.lua", "locales/*.lua", - "shared/*.lua", "config.lua", }) diff --git a/server-data/resources/[esx_addons]/BasicItem/locales/en.lua b/server-data/resources/[bpt_addons]/bpt_basicItem/locales/en.lua similarity index 100% rename from server-data/resources/[esx_addons]/BasicItem/locales/en.lua rename to server-data/resources/[bpt_addons]/bpt_basicItem/locales/en.lua diff --git a/server-data/resources/[esx_addons]/BasicItem/locales/it.lua b/server-data/resources/[bpt_addons]/bpt_basicItem/locales/it.lua similarity index 100% rename from server-data/resources/[esx_addons]/BasicItem/locales/it.lua rename to server-data/resources/[bpt_addons]/bpt_basicItem/locales/it.lua diff --git a/server-data/resources/[esx_addons]/BasicItem/client/main.lua b/server-data/resources/[esx_addons]/BasicItem/client/main.lua deleted file mode 100644 index 8b188f587..000000000 --- a/server-data/resources/[esx_addons]/BasicItem/client/main.lua +++ /dev/null @@ -1,81 +0,0 @@ -local closestDistance, closestPlayer, playerReceiveCard = {}, {}, {} - -ESX = exports["es_extended"]:getSharedObject() - -RegisterNetEvent("IDCARD:USE") -AddEventHandler("IDCARD:USE", function() - closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - if closestDistance ~= -1 and closestDistance <= 2.0 then - ESX.ShowNotification((_LConfig.playerReceiveCard):format(GetPlayerName(closestPlayer))) - TriggerServerEvent("bpt_idcard:open", GetPlayerServerId(PlayerId()), GetPlayerServerId(closestPlayer)) - else - ESX.ShowNotification(_LConfig.nobodyFound) - TriggerServerEvent("bpt_idcard:open", GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId())) - end - Wait(1) -end) - -RegisterNetEvent("DMVCARD:USE") -AddEventHandler("DMVCARD:USE", function() - closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - if closestDistance ~= -1 and closestDistance <= 2.0 then - ESX.ShowNotification((playerReceiveCard):format(GetPlayerName(closestPlayer))) - TriggerServerEvent("bpt_idcard:open", GetPlayerServerId(PlayerId()), GetPlayerServerId(closestPlayer), "driver") - else - ESX.ShowNotification(_LConfig.nobodyFound) - TriggerServerEvent("bpt_idcard:open", GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()), "driver") - end - Wait(1) -end) - -RegisterNetEvent("WCARD:USE") -AddEventHandler("WCARD:USE", function() - closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - if closestDistance ~= -1 and closestDistance <= 2.0 then - ESX.ShowNotification((playerReceiveCard):format(GetPlayerName(closestPlayer))) - TriggerServerEvent("bpt_idcardidcard:open", GetPlayerServerId(PlayerId()), GetPlayerServerId(closestPlayer), "weapon") - else - ESX.ShowNotification(_LConfig.nobodyFound) - TriggerServerEvent("bpt_idcard:open", GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()), "weapon") - end - Wait(1) -end) - -RegisterNetEvent("JOBCARD:USE") -AddEventHandler("JOBCARD:USE", function(user) - closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - ESX.PlayerData = ESX.GetPlayerData() - - local userData = user[1] - local name = userData.firstname - local name2 = userData.lastname - - if closestDistance ~= -1 and closestDistance <= 2.0 then - ESX.ShowNotification(TranslateCap("you_have_licensed"):format(GetPlayerName(closestPlayer))) - for job, info in pairs(_LConfig.jobs) do - if ESX.PlayerData.job.name == job then - local msg = info.message - local DataPlayer = ESX.PlayerData - TriggerServerEvent("JOBCARD:MSG", GetPlayerServerId(closestPlayer), msg, name, name2, DataPlayer) - return - end - end - local msg = _LConfig.defaultJobMessage - local DataPlayer = ESX.PlayerData - TriggerServerEvent("JOBCARD:MSG", GetPlayerServerId(closestPlayer), msg, name, name2, DataPlayer) - else - ESX.ShowNotification(_LConfig.nobodyFound) - for job, info in pairs(_LConfig.jobs) do - if ESX.PlayerData.job.name == job then - ESX.ShowNotification( - (info.message):format(name, name2, ESX.PlayerData.job.label, ESX.PlayerData.job.grade_label) - ) - return - end - end - ESX.ShowNotification( - (_LConfig.defaultJobMessage):format(name, name2, ESX.PlayerData.job.label, ESX.PlayerData.job.grade_label) - ) - end - Wait(1) -end) diff --git a/server-data/resources/[esx_addons]/BasicItem/server/main.lua b/server-data/resources/[esx_addons]/BasicItem/server/main.lua deleted file mode 100644 index 18939d9f3..000000000 --- a/server-data/resources/[esx_addons]/BasicItem/server/main.lua +++ /dev/null @@ -1,39 +0,0 @@ -ESX = exports["es_extended"]:getSharedObject() - -ESX.RegisterUsableItem("idcard", function(source) - local _source = source - TriggerClientEvent("IDCARD:USE", _source) -end) - -ESX.RegisterUsableItem("dmvcard", function(source) - local _source = source - TriggerClientEvent("DMVCARD:USE", _source) -end) - -ESX.RegisterUsableItem("licensecard", function(source) - local _source = source - TriggerClientEvent("WCARD:USE", _source) -end) - -ESX.RegisterUsableItem("jobcard", function(source) - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - local identifier = ESX.GetPlayerFromId(_source).identifier - local _ = xPlayer.getName() - local firstname, lastname = {}, {} - - MySQL.Async.fetchAll( - "SELECT firstname, lastname, dateofbirth, sex, height FROM users WHERE identifier = @identifier", - { ["@identifier"] = identifier }, - function(user) - TriggerClientEvent("JOBCARD:USE", _source, user, firstname, lastname) - end - ) -end) - -RegisterNetEvent("JOBCARD:MSG") -AddEventHandler("JOBCARD:MSG", function(closestPlayer, msg, name, name2, DataPlayer) - TriggerClientEvent("esx:showNotification", closestPlayer, - (msg):format(name, name2, DataPlayer.job, DataPlayer.job_grade) - ) -end) diff --git a/server-data/resources/[esx_addons]/BasicItem/shared/main.lua b/server-data/resources/[esx_addons]/BasicItem/shared/main.lua deleted file mode 100644 index 4a7c22b46..000000000 --- a/server-data/resources/[esx_addons]/BasicItem/shared/main.lua +++ /dev/null @@ -1,16 +0,0 @@ -_LConfig = { - playerReceiveCard = "[~b~Inventaire~s~]~n~ %s a bien reçu votre carte.", - nobodyFound = "[~b~Inventaire~s~]~n~~r~Vous n'avez pesonne a qui la présenter, ~n~~s~vous regardez votre carte.", - jobs = { - ["police"] = { - message = "[~b~Inventaire~s~] ~b~%s %s~s~ vous présente sa plaque de %s - %s", - }, - ["gouvernement"] = { - message = "[~b~Inventaire~s~] ~b~%s %s~s~ vous présente sa plaque de %s - %s", - }, - ["ambulance"] = { - message = "[~b~Inventaire~s~] ~b~%s %s~s~ vous présente sa carte %s - %s", - }, - }, - defaultJobMessage = "[~b~Inventaire~s~] ~b~%s %s~s~ vous présente sa carte d'entreprise %s - %s", -} diff --git a/server-data/resources/[esx_addons]/BasicItem/sql.sql b/server-data/resources/[esx_addons]/BasicItem/sql.sql deleted file mode 100644 index da258ad3e..000000000 --- a/server-data/resources/[esx_addons]/BasicItem/sql.sql +++ /dev/null @@ -1,6 +0,0 @@ -INSERT INTO `items` (`name`, `label`) VALUES - ('idcard', 'Carte d Identité'), - ('jobcard', 'Carte Entreprise'), - ('licensecard', 'License PPA'), - ('dmvcard', 'License DMV') -; \ No newline at end of file