From 2801c70e7b3c01fbb98ab68c35e87af683db179e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Brossard?= Date: Wed, 26 Feb 2020 13:47:37 +0100 Subject: [PATCH 01/16] Add Config File --- config/config_Global.lua | 104 ++++++++++++++++++ config/config_Jobs.lua | 37 +++++++ config/config_vehicle.lua | 217 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 358 insertions(+) create mode 100644 config/config_Global.lua create mode 100644 config/config_Jobs.lua create mode 100644 config/config_vehicle.lua diff --git a/config/config_Global.lua b/config/config_Global.lua new file mode 100644 index 00000000..707e9cc8 --- /dev/null +++ b/config/config_Global.lua @@ -0,0 +1,104 @@ + +Config = {} + +--+------------------------------------------+ +--| Global | +--+------------------------------------------+ + +-- set your server Name +Config.serverName = "OnsetRp Server" +-- set server language +Config.lang = "en" +-- set player spawn location (after server registration) +Config.playerSpawnLocation = { x = 204094, y = 180846, z = 1500 } +-- set all possible spawn when user join the server +Config.spawnLocation = { + -- The three last value are temporary until RandomFloat is fixed + town = { 170402, 38013, 1180, "-", "-", "" }, + city = { 211526, 176056, 1450, "", "", "" }, + desert_town = { 16223, 8033, 2080, "-", "-", "" }, + old_town = { 39350, 138061, 1690, "", "", "" } +} + +--+------------------------------------------+ +--| Salary | +--+------------------------------------------+ + +-- number of minutes between each salary +Config.salaryTime = 20 +-- Default salary (when hace no jobs) +Config.defaultSalary = 50 +-- Salary when are Police +Config.PoliceSalary = 200 +-- Salary when are Medic +Config.MedicSalary = 500 + +--+------------------------------------------+ +--| Day/Night Cycle | +--+------------------------------------------+ + +-- set time when the server start +Config.worldTime = 12 +-- set speed of day +Config.dayTime = 0.01 +-- set speed of night +Config.nightTime = 0.05 +-- set time the sun rises +Config.morning = 5 +-- set time the sun sets +Config.evening = 20 + +--+------------------------------------------+ +--| Whitelist | +--+------------------------------------------+ + +-- Activate/Desactivate whitelist system +Config.whitelist = true + + +--+------------------------------------------+ +--| Radios | +--+------------------------------------------+ + +-- set all radios available on the server +Config.radioList = { + {label = "NCS #1", url = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://51.15.152.81:8947/listen.pls?sid=1&t=.pls"}, + {label = "NCS #2", url = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://91.121.113.129:9115/listen.pls?sid=1&t=.pls"}, + {label = "Metal", url = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://5.135.154.69:11590/listen.pls?sid=1&t=.pls"}, + {label = "Reggae", url = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://us5.internet-radio.com:8487/listen.pls&t=.pls"}, + {label = "Dance", url = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://pulseedm.cdnstream1.com:8124/1373_128.m3u&t=.pls"}, + {label = "Jazz", url = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://199.180.72.2:8015/listen.pls?sid=1&t=.pls"}, + {label = "Rap", url = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://192.211.51.158:8010/listen.pls?sid=1&t=.pls"}, +} + +--+------------------------------------------+ +--| Bus System | +--+------------------------------------------+ + +-- set price of a ticket +Config.ticketPrice = 5 +-- set amount the ticket price will be in order of kilometers +Config.kilometerPrice = 2 + +-- set all bus stop +Config.busStop = { + { x= 43977, y= 134767, z= 1567, labelArret= _("old_town") }, --Vieille ville + { x= -23335, y= -12534, z= 2081, labelArret= _("desert_town") }, --Ville du desert + { x= -162541, y= 79023, z= 1545, labelArret= _("prison") }, --Ville du desert + { x= -181984, y= -44583, z= 1149, labelArret= _("town") }, --Village + { x= -165259, y= -37945, z= 1149, labelArret= _("town").." 2" }, --Village + { x= 178654, y= 210121, z= 1314, labelArret= _("city").." 1" }, -- Ville + { x= 210387, y= 194379, z= 1310, labelArret= _("city").." 2" }, -- Ville + { x= 194706, y= 211555, z= 1310, labelArret= _("city").." 3" }, -- Ville + { x= 196929, y= 200157, z= 1309, labelArret= _("city").." 4" }, -- Ville + { x= 179352, y= 195067, z= 1310, labelArret= _("city").." 5" }, -- Ville + { x= 182731, y= 198008, z= 1310, labelArret= _("city").." 6" }, -- Ville + { x= 157242, y= 210114, z= 1310, labelArret= _("city").." 7" }, -- Ville + { x= 204877, y= 187104, z= 1312, labelArret= _("city").." 8" }, -- Ville +} + +-- add bus stop props if not on the map +Config.addProp = { + { x= 44159, y= 134743, z= 1467, ry= -3 }, --Vieille ville + { x= -162727, y= 79044, z= 1434, ry= 183 }, --Prison +} diff --git a/config/config_Jobs.lua b/config/config_Jobs.lua new file mode 100644 index 00000000..6bbcf2a8 --- /dev/null +++ b/config/config_Jobs.lua @@ -0,0 +1,37 @@ +--+------------------------------------------+ +--| Global | +--+------------------------------------------+ + + + +--+------------------------------------------+ +--| Police | +--+------------------------------------------+ + +-- how many policemens at the same time +Config.MaxPolice = 30 +-- Allow the respawn of the vehicle by destroying the previously spawned one. (Can break RP if the car is stolen or need repairs or fuel) +Config.AllowVehicleRespawn = false + +Config.Police = { + vehiclespawnLocation = { + {x = 189301, y = 206802, z = 1320, h = 220}, + {x = -173007, y = -65864, z = 1130, h = -90}, + }, + serviceNPC = { + {x = 191680, y = 208448, z = 2427, h = 0}, + {x = -173771, y = -64070, z = 1209, h = 90}, + }, + vehicleNPC = { + {x = 189593, y = 206346, z = 1323, h = 180}, + {x = -172714, y = -65156, z = 1149, h = -90}, + }, + garage = { + {x = 197007, y = 205898, z = 1321}, + {x = -172667, y = -65824, z = 1130}, + }, + equipmentNPC = { + {x = 192373, y = 208150, z = 2420, h = 180}, + {x = -173980, y = -63613, z = 1209, h = -90}, + } +} \ No newline at end of file diff --git a/config/config_vehicle.lua b/config/config_vehicle.lua new file mode 100644 index 00000000..a356b6b2 --- /dev/null +++ b/config/config_vehicle.lua @@ -0,0 +1,217 @@ +--+------------------------------------------+ +--| Car Dealer | +--+------------------------------------------+ + +-- set color groups for vehicle vendors +-- Syntax : +-- groupName = { +-- colorname = "colorHex", +-- colorname = "colorHex" +--} +Config.VehiclesColor = { + defaultColor = { + black = "0000", + red = "FF0000", + blue = "0000FF", + green = "00FF00", + orange = "FF6600" + } +} + +-- set vehicle groups for vehicle vendors +Config.VehicleGroups = { + DefaultVehicles = { + vehicle_25 = 2000, + vehicle_1 = 6000, + vehicle_19 = 6000, + vehicle_5 = 9000, + vehicle_4 = 12000, + vehicle_7 = 30000, + vehicle_11 = 40000, + vehicle_12 = 50000, + vehicle_22 = 45000, + vehicle_23 = 45000, + vehicle_17 = 60000, + vehicle_18 = 60000, + vehicle_6 = 70000, + } +} + +-- set all car Dealers +Config.CarDealers = { + { + vehicles = CarDefaultVehicles, -- group of color used + colors = CarDefaultColors, -- group of vehicle used + location = { 162911, 191166, 1380, 180 }, -- location of car dealer + spawn = { 162518, 189841, 1347, -90 } -- location of vehicle spawn + }, + { + vehicles = CarDefaultVehicles, -- group of color used + colors = CarDefaultColors, -- group of vehicle used + location = { -188591, -50391, 1150, 180 }, -- location of car dealer + spawn = { -188315, -51413, 1150, 180 } -- location of vehicle spawn + }, + { + vehicles = CarDefaultVehicles, -- group of color used + colors = CarDefaultColors, -- group of vehicle used + location = { -24737, -18052, 2087, -150 }, -- location of car dealer + spawn = { -25060, -18800, 2062, -150 } -- location of vehicle spawn + } +} + +--+------------------------------------------+ +--| Vehicle Def | +--+------------------------------------------+ + +Config.Vehicles = { + vehicle_1 = { + itemSpace = 205, + price = 144572, + fuel = "fuel_1" + }, + + vehicle_2 = { + itemSpace = 50, + price = 144572, + fuel = "fuel_1" + }, + + vehicle_3 = { + itemSpace = 80, + price = 144572, + fuel = "fuel_1" + }, + + vehicle_4 = { + itemSpace = 215, + price = 144572, + fuel = "fuel_1" + }, + + vehicle_5 = { + itemSpace = 205, + price = 144572, + fuel = "fuel_1" + }, + + vehicle_6 = { + itemSpace = 90, + price = 144572, + fuel = "fuel_1" + }, + + vehicle_7 = { + itemSpace = 315, + price = 144572, + fuel = "fuel_1" + }, + + vehicle_8 = { + itemSpace = 50, + price = 144572, + fuel = "fuel_1" + }, + + vehicle_9 = { + itemSpace = 10, + price = 144572, + fuel = "fuel_1" + }, + + vehicle_10 = { + itemSpace = 10, + price = 144572, + fuel = "fuel_1" + }, + + vehicle_11 = { + itemSpace = 140, + price = 144572, + fuel = "fuel_1" + }, + + vehicle_12 = { + itemSpace = 100, + price = 144572, + fuel = "fuel_1" + }, + + vehicle_13 = { + itemSpace = 100, + price = 144572, + fuel = "fuel_1" + }, + + vehicle_14 = { + itemSpace = 100, + price = 144572, + fuel = "fuel_1" + }, + + vehicle_15 = { + itemSpace = 100, + price = 144572, + fuel = "fuel_1" + }, + + vehicle_16 = { + itemSpace = 100, + price = 144572, + fuel = "fuel_1" + }, + + vehicle_17 = { + itemSpace = 540, + price = 144572, + fuel = "fuel_1" + }, + + vehicle_18 = { + itemSpace = 540, + price = 144572, + fuel = "fuel_1" + }, + + vehicle_19 = { + itemSpace = 205, + price = 144572, + fuel = "fuel_1" + }, + + vehicle_20 = { + itemSpace = 10, + price = 144572, + fuel = "fuel_1" + }, + + vehicle_21 = { + itemSpace = 100, + price = 144572, + fuel = "fuel_1" + }, + + vehicle_22 = { + itemSpace = 475, + price = 144572, + fuel = "fuel_1" + }, + + vehicle_23 = { + itemSpace = 475, + price = 144572, + fuel = "fuel_1" + }, + + vehicle_24 = { + itemSpace = 10, + price = 144572, + fuel = "fuel_1" + }, + + vehicle_25 = { + itemSpace = 160, + price = 144572, + fuel = "fuel_1" + } +} + From 0a18304f9c52f79a8254c5af4b9f58f05614c731 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Brossard?= Date: Wed, 26 Feb 2020 14:18:05 +0100 Subject: [PATCH 02/16] Cahnge local config var to global --- config/config_Global.lua | 2 ++ config/config_vehicle.lua | 12 ++++---- package.json | 3 ++ police/s_police.lua | 46 +++++++-------------------- salary/server.lua | 14 +++------ spawn/server.lua | 4 +-- stylist/server.lua | 4 +-- transport/s_busstop.lua | 37 +++++----------------- vehicle/server.lua | 4 +-- vehicle_dealer/server.lua | 53 +++----------------------------- vehicle_radio/s_vehicleradio.lua | 23 ++++---------- welcome/client.lua | 2 +- whitelist/server.lua | 7 ++--- worldtime/server.lua | 23 +++++--------- 14 files changed, 60 insertions(+), 174 deletions(-) diff --git a/config/config_Global.lua b/config/config_Global.lua index 707e9cc8..bc2ac9c3 100644 --- a/config/config_Global.lua +++ b/config/config_Global.lua @@ -60,6 +60,8 @@ Config.whitelist = true --| Radios | --+------------------------------------------+ +-- Base volume for radio +Config.radioBaseVolume = 0.2 -- set all radios available on the server Config.radioList = { {label = "NCS #1", url = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://51.15.152.81:8947/listen.pls?sid=1&t=.pls"}, diff --git a/config/config_vehicle.lua b/config/config_vehicle.lua index a356b6b2..d56c3254 100644 --- a/config/config_vehicle.lua +++ b/config/config_vehicle.lua @@ -40,20 +40,20 @@ Config.VehicleGroups = { -- set all car Dealers Config.CarDealers = { { - vehicles = CarDefaultVehicles, -- group of color used - colors = CarDefaultColors, -- group of vehicle used + vehicles = Config.VehicleGroups.DefaultVehicles, -- group of color used + colors = Config.VehiclesColor.defaultColor, -- group of vehicle used location = { 162911, 191166, 1380, 180 }, -- location of car dealer spawn = { 162518, 189841, 1347, -90 } -- location of vehicle spawn }, { - vehicles = CarDefaultVehicles, -- group of color used - colors = CarDefaultColors, -- group of vehicle used + vehicles = Config.VehicleGroups.DefaultVehicles, -- group of color used + colors = Config.VehiclesColor.defaultColor, -- group of vehicle used location = { -188591, -50391, 1150, 180 }, -- location of car dealer spawn = { -188315, -51413, 1150, 180 } -- location of vehicle spawn }, { - vehicles = CarDefaultVehicles, -- group of color used - colors = CarDefaultColors, -- group of vehicle used + vehicles = Config.VehicleGroups.DefaultVehicles, -- group of color used + colors = Config.VehiclesColor.defaultColor, -- group of vehicle used location = { -24737, -18052, 2087, -150 }, -- location of car dealer spawn = { -25060, -18800, 2062, -150 } -- location of vehicle spawn } diff --git a/package.json b/package.json index ccfbf296..6f15a095 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,9 @@ "author": "Frédéric C. - Frederic2ec", "version": "1.0", "server_scripts": [ + "config/config_Global.lua", + "config/config_Jobs.lua", + "config/config_vehicle.lua", "misc/s_database.lua", "accounts/server.lua", "chat/server.lua", diff --git a/police/s_police.lua b/police/s_police.lua index 734f1224..1f88f854 100644 --- a/police/s_police.lua +++ b/police/s_police.lua @@ -1,9 +1,5 @@ local _ = function(k, ...) return ImportPackage("i18n").t(GetPackageName(), k, ...) end -local MAX_POLICE = 30 -- Number of policemens at the same time -local ALLOW_RESPAWN_VEHICLE = false -- Allow the respawn of the vehicle by destroying the previously spawned one. (Can break RP if the car is stolen or need repairs or fuel) -local NB_HANDCUFFS = 3 - --- PLAN B EN CAS DE FPS EN DELIRE AVEC LE MOD DE SALSI -- local VEHICLE_SPAWN_LOCATION = { -- {x = 189301, y = 206802, z = 1320, h = 220}, @@ -26,55 +22,35 @@ local NB_HANDCUFFS = 3 -- } --- PLAN B EN CAS DE FPS EN DELIRE AVEC LE MOD DE SALSI -local VEHICLE_SPAWN_LOCATION = { - {x = 189301, y = 206802, z = 1320, h = 220}, - {x = -173007, y = -65864, z = 1130, h = -90}, -} - -local POLICE_SERVICE_NPC = { - {x = 191680, y = 208448, z = 2427, h = 0}, - {x = -173771, y = -64070, z = 1209, h = 90}, -} - -local POLICE_VEHICLE_NPC = { - {x = 189593, y = 206346, z = 1323, h = 180}, - {x = -172714, y = -65156, z = 1149, h = -90}, -} - local POLICE_GARAGE = { {x = 197007, y = 205898, z = 1321}, {x = -172667, y = -65824, z = 1130}, } -local POLICE_EQUIPMENT_NPC = { - {x = 192373, y = 208150, z = 2420, h = 180}, - {x = -173980, y = -63613, z = 1209, h = -90}, -} - local policeNpcIds = {} local policeVehicleNpcIds = {} local policeGarageIds = {} local policeEquipmentNpcIds = {} AddEvent("OnPackageStart", function() - for k, v in pairs(POLICE_SERVICE_NPC) do + for k, v in pairs(Config.Police.serviceNPC) do v.npcObject = CreateNPC(v.x, v.y, v.z, v.h) SetNPCAnimation(v.npcObject, "WALLLEAN04", true) table.insert(policeNpcIds, v.npcObject) end - for k, v in pairs(POLICE_GARAGE) do + for k, v in pairs(Config.Police.garage) do v.garageObject = CreatePickup(2, v.x, v.y, v.z) table.insert(policeGarageIds, v.garageObject) end - for k, v in pairs(POLICE_VEHICLE_NPC) do + for k, v in pairs(Config.Police.vehicleNPC) do v.npcObject = CreateNPC(v.x, v.y, v.z, v.h) SetNPCAnimation(v.npcObject, "WALLLEAN04", true) table.insert(policeVehicleNpcIds, v.npcObject) end - for k, v in pairs(POLICE_EQUIPMENT_NPC) do + for k, v in pairs(Config.Police.equipmentNPC) do v.npcObject = CreateNPC(v.x, v.y, v.z, v.h) table.insert(policeEquipmentNpcIds, v.npcObject) end @@ -115,7 +91,7 @@ function PoliceStartService(player)-- To start the police service for k, v in pairs(PlayerData) do if v.job == "police" then policemens = policemens + 1 end end - if policemens >= MAX_POLICE then + if policemens >= Config.MaxPolice then CallRemoteEvent(player, "MakeErrorNotification", _("job_full")) return end @@ -164,8 +140,8 @@ function GivePoliceEquipmentToPlayer(player)-- To give police equipment to polic SetInventory(player, "weapon_21", 1) SetPlayerWeapon(player, 21, 100, false, 3, true) end - if GetNumberOfItem(player, "handcuffs") < NB_HANDCUFFS then -- If the player doesnt have handcuffs we give it to him - SetInventory(player, "handcuffs", NB_HANDCUFFS) + if GetNumberOfItem(player, "handcuffs") < Config.nbHandcuffs then -- If the player doesnt have handcuffs we give it to him + SetInventory(player, "handcuffs", Config.nbHandcuffs) end SetPlayerArmor(player, 100) end @@ -230,7 +206,7 @@ function SpawnPoliceCar(player) end -- #2 Check if the player has a job vehicle spawned then destroy it - if PlayerData[player].job_vehicle ~= nil and ALLOW_RESPAWN_VEHICLE then + if PlayerData[player].job_vehicle ~= nil and Config.AllowVehicleRespawn = false then DestroyVehicle(PlayerData[player].job_vehicle) DestroyVehicleData(PlayerData[player].job_vehicle) PlayerData[player].job_vehicle = nil @@ -238,7 +214,7 @@ function SpawnPoliceCar(player) -- #3 Try to spawn the vehicle if PlayerData[player].job_vehicle == nil then - local spawnPoint = VEHICLE_SPAWN_LOCATION[PoliceGetClosestSpawnPoint(player)] + local spawnPoint = Config.Police.vehiclespawnLocation[PoliceGetClosestSpawnPoint(player)] if spawnPoint == nil then return end for k, v in pairs(GetStreamedVehiclesForPlayer(player)) do local x, y, z = GetVehicleLocation(v) @@ -276,7 +252,7 @@ end AddEvent("OnPlayerPickupHit", function(player, pickup)-- Store the vehicle in garage if PlayerData[player].job ~= "police" then return end - for k, v in pairs(POLICE_GARAGE) do + for k, v in pairs(Config.Police.garage) do if v.garageObject == pickup then local vehicle = GetPlayerVehicle(player) @@ -542,7 +518,7 @@ function PoliceGetClosestSpawnPoint(player) local x, y, z = GetPlayerLocation(player) local closestSpawnPoint local dist - for k, v in pairs(VEHICLE_SPAWN_LOCATION) do + for k, v in pairs(Config.Police.vehiclespawnLocation) do local currentDist = GetDistance3D(x, y, z, v.x, v.y, v.z) if (dist == nil or currentDist < dist) and currentDist <= 2000 then closestSpawnPoint = k diff --git a/salary/server.lua b/salary/server.lua index 6e559f06..6fd90888 100644 --- a/salary/server.lua +++ b/salary/server.lua @@ -1,11 +1,6 @@ local _ = function(k,...) return ImportPackage("i18n").t(GetPackageName(),k,...) end -local minutes = 15 - -local MINIMUM_WAGE = 50 local JOB_WAGE = 100 -local POLICE_WAGE = 200 -local MEDIC_WAGE = 500 CreateTimer(function() for key, player in pairs(GetAllPlayers()) do @@ -13,17 +8,16 @@ CreateTimer(function() -- THOSE HAS TO BE ORDER BY WAGE AMOUNT (desc) if PlayerData[player].job == "medic" then - PlayerData[player].bank_balance = PlayerData[player].bank_balance + MEDIC_WAGE + PlayerData[player].bank_balance = PlayerData[player].bank_balance + Config.MedicSalary elseif PlayerData[player].job == "police" then - PlayerData[player].bank_balance = PlayerData[player].bank_balance + POLICE_WAGE + PlayerData[player].bank_balance = PlayerData[player].bank_balance + Config.PoliceSalary elseif PlayerData[player].job ~= nil then PlayerData[player].bank_balance = PlayerData[player].bank_balance + JOB_WAGE else - PlayerData[player].bank_balance = PlayerData[player].bank_balance + MINIMUM_WAGE + PlayerData[player].bank_balance = PlayerData[player].bank_balance + Config.defaultSalary end - PlayerData[player].bank_balance = PlayerData[player].bank_balance + salary CallRemoteEvent(player, "MakeSuccessNotification", _("salary_notification", _("price_in_currency", tostring(salary)))) end end -end, minutes * 60000) \ No newline at end of file +end, Config.salaryTime * 60000) \ No newline at end of file diff --git a/spawn/server.lua b/spawn/server.lua index e5521508..8885e497 100644 --- a/spawn/server.lua +++ b/spawn/server.lua @@ -28,7 +28,7 @@ AddRemoteEvent("ServerSpawnMenu", function(player) end end - CallRemoteEvent(player, "OpenSpawnMenu", spawnLocation, hasHouse) + CallRemoteEvent(player, "OpenSpawnMenu", Config.spawnLocation, hasHouse) end end) @@ -51,7 +51,7 @@ AddRemoteEvent("PlayerSpawn", function(player, spawn) end) function GetSpawnLocation(spawn) - for k,v in pairs(spawnLocation) do + for k,v in pairs(Config.spawnLocation) do if k == spawn then return v end diff --git a/stylist/server.lua b/stylist/server.lua index 5f6e4ab1..66053663 100644 --- a/stylist/server.lua +++ b/stylist/server.lua @@ -8,8 +8,6 @@ StylistNPCTable = { } -- } -- } -local PLAYER_SPAWN_POINT = { x = 204094, y = 180846, z = 1500 } - -- Event ---------------------------------------------------- AddEvent("OnPackageStart", function() @@ -103,7 +101,7 @@ AddRemoteEvent("ModifyEvent", function(player, hairsChoice, shirtsChoice, pantsC end UpdateClothes(player) - SetPlayerLocation(player, PLAYER_SPAWN_POINT.x, PLAYER_SPAWN_POINT.y, PLAYER_SPAWN_POINT.z) + SetPlayerLocation(player, Config.playerSpawnLocation.x, Config.playerSpawnLocation.y, Config.playerSpawnLocation.z) SetPlayerName(player,PlayerData[player].accountid) SavePlayerAccount(player) end) diff --git a/transport/s_busstop.lua b/transport/s_busstop.lua index 588ea0bf..47d484e1 100644 --- a/transport/s_busstop.lua +++ b/transport/s_busstop.lua @@ -1,27 +1,6 @@ local _ = function(k,...) return ImportPackage("i18n").t(GetPackageName(),k,...) end -local bus_stops = { - prop = { -- Arrêts de bus (id 1588) - { x= 44159, y= 134743, z= 1467, ry= -3 }, --Vieille ville - { x= -162727, y= 79044, z= 1434, ry= 183 }, --Prison - }, - location = { - { x= 43977, y= 134767, z= 1567, labelArret= _("old_town") }, --Vieille ville - { x= -23335, y= -12534, z= 2081, labelArret= _("desert_town") }, --Ville du desert - { x= -162541, y= 79023, z= 1545, labelArret= _("prison") }, --Ville du desert - { x= -181984, y= -44583, z= 1149, labelArret= _("town") }, --Village - { x= -165259, y= -37945, z= 1149, labelArret= _("town").." 2" }, --Village - { x= 178654, y= 210121, z= 1314, labelArret= _("city").." 1" }, -- Ville - { x= 210387, y= 194379, z= 1310, labelArret= _("city").." 2" }, -- Ville - { x= 194706, y= 211555, z= 1310, labelArret= _("city").." 3" }, -- Ville - { x= 196929, y= 200157, z= 1309, labelArret= _("city").." 4" }, -- Ville - { x= 179352, y= 195067, z= 1310, labelArret= _("city").." 5" }, -- Ville - { x= 182731, y= 198008, z= 1310, labelArret= _("city").." 6" }, -- Ville - { x= 157242, y= 210114, z= 1310, labelArret= _("city").." 7" }, -- Ville - { x= 204877, y= 187104, z= 1312, labelArret= _("city").." 8" }, -- Ville - }, - pickup = {} -} +local pickup = {} local ticketPrice = 5 local kilometerPrice = 2 @@ -36,13 +15,13 @@ function CalculateAmount(distance) end AddEvent("OnPackageStart", function() -- Création des halos jaunes sur les arrêts de bus - for i,j in pairs(bus_stops.location) do - bus_stops.pickup[i] = CreatePickup(2 , bus_stops.location[i].x, bus_stops.location[i].y, bus_stops.location[i].z) - CreateText3D( _("bus_stop").."\n".._("press_e"), 18, bus_stops.location[i].x, bus_stops.location[i].y, bus_stops.location[i].z + 120, 0, 0, 0) - table.insert(bus_stops_cached, bus_stops.pickup[i]) + for i,j in pairs(Config.busStop) do + pickup[i] = CreatePickup(2 , j.x, j.y, j.z) + CreateText3D( _("bus_stop").."\n".._("press_e"), 18, j.x, j.y, j.z + 120, 0, 0, 0) + table.insert(bus_stops_cached, pickup[i]) end - for i,j in pairs(bus_stops.prop) do -- Ajout des arrêts de bus qui ne sont pas présents de base + for i,j in pairs(Config.addProp) do -- Ajout des arrêts de bus qui ne sont pas présents de base CreateObject(1588, j.x, j.y, j.z, 0, j.ry) end end) @@ -54,7 +33,7 @@ end) AddRemoteEvent("TransportMenuSGetListe", function(player) -- Récupération de la liste des arrêts de bus et envoie au menu transportMenuListe = {} local x,y = GetPlayerLocation(player) - for k,v in pairs(bus_stops.location) do + for k,v in pairs(Config.busStop) do local distance = math.floor(tonumber(GetDistance2D(x, y, v.x, v.y)) / 100) transportMenuListe[k] = { label= v.labelArret, distance= distance, amount= CalculateAmount(distance)} if distance <= 4 then @@ -65,7 +44,7 @@ AddRemoteEvent("TransportMenuSGetListe", function(player) -- Récupération de l end) AddRemoteEvent("TransportMenuSTeleportPlayer", function(player, arret) -- Téléport du joueur a l'arrêt de bus - for k,v in pairs(bus_stops.location) do + for k,v in pairs(Config.busStop) do if k == tonumber(arret) then local x,y = GetPlayerLocation(player) local amount = CalculateAmount(math.floor(tonumber(GetDistance2D(x, y, v.x, v.y)) / 100)) diff --git a/vehicle/server.lua b/vehicle/server.lua index 4fc3967c..50e616bd 100644 --- a/vehicle/server.lua +++ b/vehicle/server.lua @@ -225,7 +225,7 @@ AddRemoteEvent("OpenTrunk", function(player, vehicle) id = vehicleId, name = vehicleName, inventory = VehicleData[vehicle].inventory, - maxSlots = VehicleTrunkSlots["vehicle_"..VehicleData[vehicle].modelid] + maxSlots = Config.Vehicles["vehicle_"..VehicleData[vehicle].modelid].itemSpace } table.insert(playersList, { id = vehicleId, name = vehicleName }) @@ -343,7 +343,7 @@ function getVehicleId(modelid) end function AddVehicleInventory(vehicle, item, amount, player) - if item == "cash" or (VehicleTrunkSlots["vehicle_"..VehicleData[vehicle].modelid] - GetVehicleUsedSlots(vehicle)) >= (amount * ItemsWeight[item]) then + if item == "cash" or (Config.Vehicles["vehicle_"..VehicleData[vehicle].modelid].itemSpace - GetVehicleUsedSlots(vehicle)) >= (amount * ItemsWeight[item]) then if VehicleData[vehicle].inventory[item] == nil then VehicleData[vehicle].inventory[item] = amount else diff --git a/vehicle_dealer/server.lua b/vehicle_dealer/server.lua index c5b3bdf9..71f5e578 100644 --- a/vehicle_dealer/server.lua +++ b/vehicle_dealer/server.lua @@ -2,53 +2,8 @@ local _ = function(k,...) return ImportPackage("i18n").t(GetPackageName(),k,...) CarDealerObjectsCached = { } -CarDefaultColors = { - black = "0000", - red = "FF0000", - blue = "0000FF", - green = "00FF00", - orange = "FF6600" -} - -CarDefaultVehicles = { - vehicle_25 = 2000, - vehicle_1 = 6000, - vehicle_19 = 6000, - vehicle_5 = 9000, - vehicle_4 = 12000, - vehicle_7 = 30000, - vehicle_11 = 40000, - vehicle_12 = 50000, - vehicle_22 = 45000, - vehicle_23 = 45000, - vehicle_17 = 60000, - vehicle_18 = 60000, - vehicle_6 = 70000, -} - -CarDealerTable = { - { - vehicles = CarDefaultVehicles, - colors = CarDefaultColors, - location = { 162911, 191166, 1380, 180 }, - spawn = { 162518, 189841, 1347, -90 } - }, - { - vehicles = CarDefaultVehicles, - colors = CarDefaultColors, - location = { -188591, -50391, 1150, 180 }, - spawn = { -188315, -51413, 1150, 180 } - }, - { - vehicles = CarDefaultVehicles, - colors = CarDefaultColors, - location = { -24737, -18052, 2087, -150 }, - spawn = { -25060, -18800, 2062, -150 } - } -} - AddEvent("OnPackageStart", function() - for k,v in pairs(CarDealerTable) do + for k,v in pairs(Config.CarDealers) do v.npc = CreateNPC(v.location[1], v.location[2], v.location[3], v.location[4]) CreateText3D(_("car_dealer").."\n".._("press_e"), 18, v.location[1], v.location[2], v.location[3] + 120, 0, 0, 0) @@ -70,7 +25,7 @@ AddRemoteEvent("carDealerInteract", function(player, cardealerobject) local dist = GetDistance3D(x, y, z, x2, y2, z2) if dist < 250 then - for k,v in pairs(CarDealerTable) do + for k,v in pairs(Config.CarDealers) do if cardealerobject == v.npc then CallRemoteEvent(player, "openCarDealer", v.vehicles, v.colors) end @@ -84,7 +39,7 @@ AddRemoteEvent("carDealerInteract", function(player, cardealerobject) end) function GetCarDealearByObject(cardealerobject) - for k,v in pairs(CarDealerTable) do + for k,v in pairs(Config.CarDealers) do if v.npc == cardealerobject then return v end @@ -118,7 +73,7 @@ function buyCarServer(player, modelid, color, cardealerobject) else local x, y, z = GetPlayerLocation(player) - for k,v in pairs(CarDealerTable) do + for k,v in pairs(Config.CarDealers) do local x2, y2, z2 = GetNPCLocation(v.npc) local dist = GetDistance3D(x, y, z, x2, y2, z2) if dist < 150.0 then diff --git a/vehicle_radio/s_vehicleradio.lua b/vehicle_radio/s_vehicleradio.lua index 1c1f13f8..5f6dd5ca 100644 --- a/vehicle_radio/s_vehicleradio.lua +++ b/vehicle_radio/s_vehicleradio.lua @@ -1,21 +1,10 @@ sr = ImportPackage("soundstreamer") local _ = function(k, ...) return ImportPackage("i18n").t(GetPackageName(), k, ...) end -local Radios = { - {label = "NCS #1", url = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://51.15.152.81:8947/listen.pls?sid=1&t=.pls"}, - {label = "NCS #2", url = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://91.121.113.129:9115/listen.pls?sid=1&t=.pls"}, - {label = "Metal", url = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://5.135.154.69:11590/listen.pls?sid=1&t=.pls"}, - {label = "Reggae", url = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://us5.internet-radio.com:8487/listen.pls&t=.pls"}, - {label = "Dance", url = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://pulseedm.cdnstream1.com:8124/1373_128.m3u&t=.pls"}, - {label = "Jazz", url = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://199.180.72.2:8015/listen.pls?sid=1&t=.pls"}, - {label = "Rap", url = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://192.211.51.158:8010/listen.pls?sid=1&t=.pls"}, -} - local nowPlaying = {} local TIMER_REFRESH_RADIO_POSITION = 25 local HOOD_BONUS = 300 local RADIO_RADIUS = 800 -local BASE_VOLUME = 0.2 AddEvent("OnPackageStart", function() CreateTimer(function() @@ -49,14 +38,14 @@ function VehicleRadioToggle(player) else nowPlaying[veh] = {} nowPlaying[veh].channel = 1 - local sound = sr.CreateSound3D(Radios[1].url, x, y, z + HOOD_BONUS, RADIO_RADIUS, BASE_VOLUME) + local sound = sr.CreateSound3D(Config.radioList[1].url, x, y, z + HOOD_BONUS, RADIO_RADIUS, Config.radioBaseVolume) nowPlaying[veh].sound = sound - nowPlaying[veh].volume = BASE_VOLUME + nowPlaying[veh].volume = Config.radioBaseVolume for k=1, GetVehicleNumberOfSeats(veh) do local target = GetVehiclePassenger(veh, k) if IsValidPlayer(target) then CallRemoteEvent(target, "vehicle:radio:toggleui", true) - CallRemoteEvent(target, "vehicle:radio:updateui", Radios[nowPlaying[veh].channel].label, nowPlaying[veh].volume) + CallRemoteEvent(target, "vehicle:radio:updateui", Config.radioList[nowPlaying[veh].channel].label, nowPlaying[veh].volume) end end end @@ -78,7 +67,7 @@ function VehicleRadioUpdateVolume(player, increaseOrLower) sr.SetSound3DVolume(nowPlaying[veh].sound, nowPlaying[veh].volume) for k=1, GetVehicleNumberOfSeats(veh) do local target = GetVehiclePassenger(veh, k) - if IsValidPlayer(target) then CallRemoteEvent(target, "vehicle:radio:updateui", Radios[nowPlaying[veh].channel].label, nowPlaying[veh].volume) end + if IsValidPlayer(target) then CallRemoteEvent(target, "vehicle:radio:updateui", Config.radioList[nowPlaying[veh].channel].label, nowPlaying[veh].volume) end end end end @@ -90,12 +79,12 @@ function VehicleRadioUpdateChannel(player, channelId) if GetPlayerVehicleSeat(player) ~= 1 and GetPlayerVehicleSeat(player) ~= 2 then return end local x, y, z = GetVehicleLocation(veh) sr.DestroySound3D(nowPlaying[veh].sound) - local sound = sr.CreateSound3D(Radios[channelId].url, x, y, z + HOOD_BONUS, RADIO_RADIUS, nowPlaying[veh].volume) + local sound = sr.CreateSound3D(Config.radioList[channelId].url, x, y, z + HOOD_BONUS, RADIO_RADIUS, nowPlaying[veh].volume) nowPlaying[veh].sound = sound nowPlaying[veh].channel = channelId for k=1, GetVehicleNumberOfSeats(veh) do local target = GetVehiclePassenger(veh, k) - if IsValidPlayer(target) then CallRemoteEvent(target, "vehicle:radio:updateui", Radios[nowPlaying[veh].channel].label, nowPlaying[veh].volume) end + if IsValidPlayer(target) then CallRemoteEvent(target, "vehicle:radio:updateui", Config.radioList[nowPlaying[veh].channel].label, nowPlaying[veh].volume) end end end end diff --git a/welcome/client.lua b/welcome/client.lua index b357368e..9481d39d 100644 --- a/welcome/client.lua +++ b/welcome/client.lua @@ -10,7 +10,7 @@ local screenWidth, screenHeight = GetScreenSize() AddEvent("OnPackageStart", function() welcomeUI = CreateWebUI(0.0, 0.0, 0.0, 0.0, 1, 60) SetWebAnchors(welcomeUI, 0.0, 0.0, 1.0, 1.0) - LoadWebFile(welcomeUI, 'http://asset/' .. GetPackageName() .. '/welcome/index_fr.html') + LoadWebFile(welcomeUI, 'http://asset/' .. GetPackageName() .. '/welcome/index_'..Config.lang..'.html') SetWebVisibility(welcomeUI, WEB_VISIBLE) end) diff --git a/whitelist/server.lua b/whitelist/server.lua index 04ebac8a..1ea097a8 100644 --- a/whitelist/server.lua +++ b/whitelist/server.lua @@ -1,9 +1,6 @@ local _ = function(k,...) return ImportPackage("i18n").t(GetPackageName(),k,...) end - -local whitelist = true - AddEvent("OnPlayerSteamAuth", function(player) - if whitelist then + if Config.whitelist then local steamid = GetPlayerSteamId(player) local query = mariadb_prepare(sql, "SELECT * FROM whitelist WHERE steamid = ?;", @@ -18,7 +15,7 @@ AddEvent("OnPlayerSteamAuth", function(player) end) AddEvent("OnPackageStart", function() - if whitelist == true then + if Config.whitelist == true then print('→ Whitelist initialized') end end) diff --git a/worldtime/server.lua b/worldtime/server.lua index 4f322cbd..b1162da2 100644 --- a/worldtime/server.lua +++ b/worldtime/server.lua @@ -1,27 +1,20 @@ -worldTime = 12 - -local dayTime = 0.01 -local nightTime = 0.05 -local morning = 5 -local evening = 20 - function OnPackageStart() -- Start the day/night system CreateTimer(function() - if worldTime >= 24 then - worldTime = 0 + if Config.worldTime >= 24 then + Config.worldTime = 0 end -- edited by wasied - if worldTime < morning or worldTime > evening then -- night - worldTime = worldTime + nightTime + if Config.worldTime < morning or Config.worldTime > evening then -- night + Config.worldTime = Config.worldTime + nightTime else -- day - worldTime = worldTime + dayTime + Config.worldTime = Config.worldTime + dayTime end -- for k, v in pairs(GetAllPlayers()) do - CallRemoteEvent(v, "setTimeOfClient", worldTime) + CallRemoteEvent(v, "setTimeOfClient", Config.worldTime) end end, 1000) end @@ -29,12 +22,12 @@ AddEvent("OnPackageStart", OnPackageStart) function OnPlayerSpawn(player) -- This script is used to make the time changing and synchronise to all client - CallRemoteEvent(player, "setTimeOfClient", worldTime) + CallRemoteEvent(player, "setTimeOfClient", Config.worldTime) end AddEvent("OnPlayerSpawn", OnPlayerSpawn) AddCommand("time", function(player, time) if PlayerData[player].admin == 1 and (tonumber(time) >= 0 and tonumber(time) <= 23)then - worldTime = tonumber(time) + Config.worldTime = tonumber(time) end end) From 0ebef2f75843821e50d73a0b930ae01a079e54f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Brossard?= Date: Wed, 26 Feb 2020 14:19:42 +0100 Subject: [PATCH 03/16] Update s_police.lua --- police/s_police.lua | 5 ----- 1 file changed, 5 deletions(-) diff --git a/police/s_police.lua b/police/s_police.lua index 1f88f854..7851e142 100644 --- a/police/s_police.lua +++ b/police/s_police.lua @@ -22,11 +22,6 @@ local _ = function(k, ...) return ImportPackage("i18n").t(GetPackageName(), k, . -- } --- PLAN B EN CAS DE FPS EN DELIRE AVEC LE MOD DE SALSI -local POLICE_GARAGE = { - {x = 197007, y = 205898, z = 1321}, - {x = -172667, y = -65824, z = 1130}, -} - local policeNpcIds = {} local policeVehicleNpcIds = {} local policeGarageIds = {} From 9d3b2d3491e7607ba817b6c5f0e91da196fa1441 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Brossard?= Date: Wed, 26 Feb 2020 17:07:42 +0100 Subject: [PATCH 04/16] update configs --- config/config_Clothing.lua | 46 +++++++++ config/config_Gather.lua | 123 ++++++++++++++++++++++++ config/config_Global.lua | 96 +++++++++++++++++++ config/config_Jobs.lua | 59 +++++++++++- config/config_Licenses.lua | 21 +++++ config/config_vehicle.lua | 37 ++++++++ fuel/server.lua | 53 ++--------- garage/server.lua | 48 ++-------- gathering/s_gathering.lua | 172 ++++++---------------------------- inventory/server.lua | 7 +- licenses/client.lua | 2 +- licenses/server.lua | 13 +-- medic/s_damage.lua | 24 ++--- medic/s_medic.lua | 109 ++++++--------------- misc/s_database.lua.dist | 18 +--- onset-characterize/server.lua | 50 +--------- onset-phone/server.lua | 8 +- 17 files changed, 475 insertions(+), 411 deletions(-) create mode 100644 config/config_Clothing.lua create mode 100644 config/config_Gather.lua create mode 100644 config/config_Licenses.lua diff --git a/config/config_Clothing.lua b/config/config_Clothing.lua new file mode 100644 index 00000000..4f8eb124 --- /dev/null +++ b/config/config_Clothing.lua @@ -0,0 +1,46 @@ +--+------------------------------------------+ +--| Charactere clothing | +--+------------------------------------------+ + +Config.clothing.body = { + "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Business_LPR", + "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Normal01_LPR", + "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Normal02_LPR", + "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Normal03_LPR", + "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Normal04_LPR", + "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Pimp_LPR", + "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Police_LPR", + "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Scientist_LPR", + "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_SpecialAgent_LPR" +} + +Config.clothing.shirt = { + "", + "/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_FormalShirt_LPR", + "/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_FormalShirt2_LPR", + "/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_Shirt_LPR", + "/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_TShirt_Knitted2_LPR", + "/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_TShirt_Knitted_LPR", + "/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_TShirt_LPR" +} + +Config.clothing.pant = { + "/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_CargoPants_LPR", + "/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_DenimPants_LPR", + "/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_FormalPants_LPR" +} + +Config.clothing.shoe = { + "", + "/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_NormalShoes_LPR", + "/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_BusinessShoes_LPR" +} + +Config.clothing.hair = { + "/Game/CharacterModels/SkeletalMesh/HZN_CH3D_Hair_Business_LP", + "/Game/CharacterModels/SkeletalMesh/HZN_CH3D_Hair_Scientist_LP", + "/Game/CharacterModels/SkeletalMesh/HZN_CH3D_Police_Hair_LPR", + "/Game/CharacterModels/SkeletalMesh/HZN_CH3D_Normal_Hair_01_LPR", + "/Game/CharacterModels/SkeletalMesh/HZN_CH3D_Normal_Hair_03_LPR", + "/Game/CharacterModels/SkeletalMesh/HZN_CH3D_Normal_Hair_02_LPR" +} \ No newline at end of file diff --git a/config/config_Gather.lua b/config/config_Gather.lua new file mode 100644 index 00000000..319b6725 --- /dev/null +++ b/config/config_Gather.lua @@ -0,0 +1,123 @@ +Config.Gather = { + {-- LUMBERJACK STUFF + gather_zone = { + {x = -215796, y = -74619, z = 291} + }, -- Zone of initial gathering + gather_item = "tree_log", -- item that is given by initial gathering + gather_time = 15, -- Time in seconds to gather one item, + process_steps = {-- Describe the steps of processing + { + step_zone = {x = -70149, y = -59260, z = 1466}, -- zone of processing + step_require = "tree_log", -- item that is required (take the one from previous step) + step_require_number = 1, -- number of item required + step_require_tool = "lumberjack_saw", + step_processed_item = "wood_plank", -- item that will be given + step_processed_item_number = 2, -- number of item that will be given + step_process_time = 30, -- Time in seconds to process one item + step_animation = "COMBINE", -- Animation for processing + step_animation_attachement = nil + } + }, + require_job = false, -- Job required, + require_tool = "lumberjack_axe", -- Tool required in inventory, + require_knowledge = false, -- Require knowledge (for processing illegal stuff → drugdealer, cocaine) + gather_animation = "PICKAXE_SWING", -- Animation that the player will act when doing stuff + gather_animation_attachement = {modelid = 1047, bone = "hand_r"}, + gather_rp_props = nil, + sell_zone = { + {x = 203566, y = 171875, z = 1306, h = -90, item_to_sell = "wood_plank", price_per_unit = 36, sell_time = 5} + } + }, + + + + {-- PEACH HARVESTION (FOR ALTIS LIFE FANS) + gather_zone = { + {x = -174432, y = 10837, z = 1831}, + {x = 189595, y = 147717, z = 5875}, + }, + gather_item = "peach", + gather_animation = "PICKUP_UPPER", + gather_time = 4, + gather_rp_props = { + -- Peach trees + {model = 145, x = -174006, y = 10457, z = 1773, rx = 0, ry = 10, rz = 0}, + {model = 145, x = -173829, y = 10894, z = 1743, rx = 0, ry = 30, rz = 0}, + {model = 145, x = -173980, y = 11396, z = 1698, rx = 0, ry = 45, rz = 0}, + {model = 145, x = -174691, y = 11532, z = 1709, rx = 0, ry = 0, rz = 0}, + {model = 145, x = -175204, y = 11094, z = 1755, rx = 0, ry = 145, rz = 0}, + {model = 145, x = -175449, y = 11528, z = 1757, rx = 0, ry = 80, rz = 0}, + {model = 145, x = -175171, y = 12038, z = 1719, rx = 0, ry = 50, rz = 0}, + {model = 145, x = -174581, y = 12021, z = 1686, rx = 0, ry = 40, rz = 0}, + }, + sell_zone = { + { x = -167521, y = -39359, z = 1146, h = 180, item_to_sell = "peach", price_per_unit = 2, sell_time = 2 } + } + }, + + {-- COCAINE + gather_zone = { + {x = 101448, y = -137535, z = 2178} + }, + gather_item = "coca_leaf", + gather_time = 7, + process_steps = { + { + step_zone = {x = 74387, y = -92653, z = 2293}, + step_require = "coca_leaf", + step_require_number = 3, + step_processed_item = "cocaine", + step_processed_item_number = 1, + step_process_time = 15, + } + }, + require_knowledge = true, + }, + + { -- FISHING + gather_zone = { + {x = 232464, y = 193521, z = 112}, + {x = -220130, y = 23036, z = 107}, + }, + gather_item = "herring", + require_tool = "fishing_rod", + gather_animation = "FISHING", + gather_time = 6, + gather_animation_attachement = {modelid = 1111, bone = "hand_r"}, + sell_zone = { + {x = -21295, y = -22954, z = 2080, h = -90, item_to_sell = "herring", price_per_unit = 5, sell_time = 5} + } + }, + + { -- MINING + gather_zone = { + {x = -101174, y = 98223, z = 180} + }, + gather_item = "iron_ore", + require_tool = "pickaxe", + gather_animation = "PICKAXE_SWING", + gather_time = 18, + gather_animation_attachement = {modelid = 1063, bone = "hand_r"}, + process_steps = { + { + step_zone = {x = -82629, y = 90991, z = 481}, + step_require = "iron_ore", + step_require_number = 1, + step_processed_item = "iron_ingot", + step_processed_item_number = 2, + step_process_time = 18, + }, + { + step_zone = {x = -191437, y = -31107, z = 1148}, + step_require = "iron_ingot", + step_require_number = 2, + step_processed_item = "iron_pipe", + step_processed_item_number = 1, + step_process_time = 30, + } + }, + sell_zone = { + {x = 67862, y = 184741, z = 535, h = 90, item_to_sell = "iron_pipe", price_per_unit = 54, sell_time = 5} + } + } +} \ No newline at end of file diff --git a/config/config_Global.lua b/config/config_Global.lua index bc2ac9c3..c0247718 100644 --- a/config/config_Global.lua +++ b/config/config_Global.lua @@ -20,6 +20,26 @@ Config.spawnLocation = { old_town = { 39350, 138061, 1690, "", "", "" } } +--+------------------------------------------+ +--| Database | +--+------------------------------------------+ + +-- hostname of database +Config.db.SQL_HOST = "127.0.0.1" +-- port of database +Config.db.SQL_PORT = 3306 +-- user used for loggin to (DO NOT USE ROOT USER !) +Config.db.SQL_USER = "root" +-- user password +Config.db.SQL_PASS = "" +-- database name +Config.db.SQL_DB = "roleplay" +-- charset used (if you don't know how use it don't touch) +Config.db.SQL_CHAR = "utf8mb4" +-- sql logs +Config.db.SQL_LOGL = "error" + + --+------------------------------------------+ --| Salary | --+------------------------------------------+ @@ -56,6 +76,25 @@ Config.evening = 20 Config.whitelist = true +--+------------------------------------------+ +--| Inventory System | +--+------------------------------------------+ + +Config.inventoryBaseMaxSlots = 50 +Config.backpackSlotToAdd = 35 + +--+------------------------------------------+ +--| Damage system | +--+------------------------------------------+ + +Config.bleedingChance = 40 +Config.InitialDamageToBleed = 1.5 +Config.DmamgePerTick = 1 +Config.BlledingDamageInterval = 5000 +Config.BleedEffectAmount = 70 +Config.tazerLockDuration = 10000 +Config.TazerEffectDuration = 20000 + --+------------------------------------------+ --| Radios | --+------------------------------------------+ @@ -104,3 +143,60 @@ Config.addProp = { { x= 44159, y= 134743, z= 1467, ry= -3 }, --Vieille ville { x= -162727, y= 79044, z= 1434, ry= 183 }, --Prison } + +--+------------------------------------------+ +--| Phone | +--+------------------------------------------+ + +-- can use phone without phone item +Config.useWithoutPhone = false +-- Name of phone item +Config.phoneItemName = "phone" +-- can use phon while gathering +Config.usewhilegathering = false + +--+------------------------------------------+ +--| Fuel System | +--+------------------------------------------+ + +Config.gasStation.location = { + { 127810, 78431, 1568 }, + { 127446, 78415, 1568 }, + { 127048, 78430, 1568 }, + { 126678, 78404, 1568 }, + { 126246, 78420, 1568 }, + { 125904, 78406, 1568 }, + { -17171, -2172, 2062 }, + { -16814, -3187, 2062 }, + { -17155, -3305, 2062 }, + { -17526, -2315, 2062 }, + { -17804, -2415, 2062 }, + { -17447, -3387, 2062 }, + { -17753, -3526, 2062 }, + { -18106, -2502, 2062 }, + { -167866, -37112, 1146 }, + { -168188, -37103, 1146 }, + { -168693, -37095, 1146 }, + { -169015, -37088, 1146 }, + { 170659, 207324, 1411 }, + { 170105, 207314, 1410 }, + { 170630, 206760, 1411 }, + { 170107, 206783, 1410 }, + { 170099, 206107, 1410 }, + { 170647, 206097, 1411 }, + { 170623, 205561, 1411 }, + { 170100, 205587, 1411 }, + { 42526, 137156, 1569 }, + { 42966, 137150, 1569 }, + { 42524, 136717, 1569 }, + { 42949, 136744, 1569 } +} + +Config.gasStation.Fuel = { + gasoil = { + price = "1" + }, + gasoilplus = { + price = "2" + } +} \ No newline at end of file diff --git a/config/config_Jobs.lua b/config/config_Jobs.lua index 6bbcf2a8..5ef96b57 100644 --- a/config/config_Jobs.lua +++ b/config/config_Jobs.lua @@ -2,7 +2,8 @@ --| Global | --+------------------------------------------+ - +-- Allow the respawn of the vehicle by destroying the previously spawned one. (Can break RP if the car is stolen or need repairs or fuel) +Config.AllowVehicleRespawn = false --+------------------------------------------+ --| Police | @@ -10,8 +11,8 @@ -- how many policemens at the same time Config.MaxPolice = 30 --- Allow the respawn of the vehicle by destroying the previously spawned one. (Can break RP if the car is stolen or need repairs or fuel) -Config.AllowVehicleRespawn = false +-- Number of handcuffs per players +Config.nbHandcuffs = 3 Config.Police = { vehiclespawnLocation = { @@ -34,4 +35,56 @@ Config.Police = { {x = 192373, y = 208150, z = 2420, h = 180}, {x = -173980, y = -63613, z = 1209, h = -90}, } +} + +--+------------------------------------------+ +--| Medic | +--+------------------------------------------+ + +-- how many medic at the same time +Config.MaxMedic = 30 +-- time before respawn +config.waitbeforerespawn = 30*60 -- 30 minutes +-- percentage of success revive +Config.revivePercentSuccess = 40 +-- time needed to revive someone +Config.timeToRevive = 15 +-- auto call medic on death +Config.autoCall = false +-- time needed to heal +Config.timeToHeal = 5 + +Config.medkitHeal = 10 +Config.medkitMaxheal = 30 +Config.adrSyringeHeal = 50 +Config.ItemTimeToUse = 5 + +Config.Medic = { + defaultRespawnPoint = {x = 212124, y = 159055, z = 1305, h = 90}, + + equipmentNeeded = { + {item = "defibrillator", qty = 1}, + {item = "adrenaline_syringe", qty = 5}, + {item = "bandage", qty = 5}, + {item = "health_kit", qty = 3}, + } + + vehiclespawnLocation = { + {x = 213325, y = 161177, z = 1305, h = -90}, + }, + serviceNPC = { + {x = 212493, y = 157096, z = 2780, h = 180}, + }, + vehicleNPC = { + {x = 212571, y = 159486, z = 1320, h = 90}, + }, + garage = { + {x = 215766, y = 161131, z = 1305}, + }, + equipmentNPC = { + {x = 212744, y = 157405, z = 2781, h = -90}, + }, + hospitalLocation = { + {x = 213079, y = 155179, radius = 2000} + } } \ No newline at end of file diff --git a/config/config_Licenses.lua b/config/config_Licenses.lua new file mode 100644 index 00000000..2155c90a --- /dev/null +++ b/config/config_Licenses.lua @@ -0,0 +1,21 @@ +Config.LicensesNpcLocation = { x = 169336, y = 193430, z = 1307, h = 180 } + +-- class: +-- displayName = License Name +-- price = License Price +-- illegal = Illegal License +-- + + +Config.Licenses = { + driver_license { + displayName = "Permis de conduire", + price = 1500, + illegal = false + }, + gun_license { + displayName = "Permis de port d'arme", + price = 6000, + illegal = false + } +} \ No newline at end of file diff --git a/config/config_vehicle.lua b/config/config_vehicle.lua index d56c3254..83b24afa 100644 --- a/config/config_vehicle.lua +++ b/config/config_vehicle.lua @@ -59,6 +59,43 @@ Config.CarDealers = { } } +-- set all garage on map +Config.GarageDealerTable = { + { + location = { 22083, 146617, 1560, -90 }, + spawn = { 22120, 145492 , 1560, -90 } + }, + { + location = { -184007, -50877, 1146, -90 }, + spawn = { -183649, -51499, 1146, -90 } + }, + { + location = { 202673, 198046, 1307, 90 }, + spawn = { 202786, 199085, 1307, 0 } + }, + { + location = { -25135, -17097, 2062, -150 }, + spawn = { -25576, -17300, 2062 , -150 } + } + } + +Config.GarageStoreTable = { + { + modelid = 2, + location = { + { 23432, 145697, 1550 }, + { 20752, 168878, 1306 }, + { -184587, -51196, 1146 }, + { -185403, -51170, 1146 }, + { -185603, -51410, 1146 }, + { 203269, 201098, 1307 }, + { 203973, 201098, 1307 }, + { -25189, -16824, 2077 } + }, + object = {} + } +} + --+------------------------------------------+ --| Vehicle Def | --+------------------------------------------+ diff --git a/fuel/server.lua b/fuel/server.lua index 541eb53e..09a1bee8 100644 --- a/fuel/server.lua +++ b/fuel/server.lua @@ -1,53 +1,12 @@ local _ = function(k,...) return ImportPackage("i18n").t(GetPackageName(),k,...) end -local gas_station = { - location = { - { 127810, 78431, 1568 }, - { 127446, 78415, 1568 }, - { 127048, 78430, 1568 }, - { 126678, 78404, 1568 }, - { 126246, 78420, 1568 }, - { 125904, 78406, 1568 }, - { -17171, -2172, 2062 }, - { -16814, -3187, 2062 }, - { -17155, -3305, 2062 }, - { -17526, -2315, 2062 }, - { -17804, -2415, 2062 }, - { -17447, -3387, 2062 }, - { -17753, -3526, 2062 }, - { -18106, -2502, 2062 }, - { -167866, -37112, 1146 }, - { -168188, -37103, 1146 }, - { -168693, -37095, 1146 }, - { -169015, -37088, 1146 }, - { 170659, 207324, 1411 }, - { 170105, 207314, 1410 }, - { 170630, 206760, 1411 }, - { 170107, 206783, 1410 }, - { 170099, 206107, 1410 }, - { 170647, 206097, 1411 }, - { 170623, 205561, 1411 }, - { 170100, 205587, 1411 }, - { 42526, 137156, 1569 }, - { 42966, 137150, 1569 }, - { 42524, 136717, 1569 }, - { 42949, 136744, 1569 } - }, - pickup = {} -} - -local gasPrices = { - gasoil = "1", - gasoilplus = "2" -} - GasStationCached = {} AddEvent("OnPackageStart", function() - for i,j in pairs(gas_station.location) do - gas_station.pickup[i] = CreatePickup(2 , gas_station.location[i][1], gas_station.location[i][2], gas_station.location[i][3]) - CreateText3D( _("refuel").."\n".._("press_e"), 18, gas_station.location[i][1], gas_station.location[i][2], gas_station.location[i][3] + 120, 0, 0, 0) - table.insert(GasStationCached, gas_station.pickup[i]) + for i,j in pairs(Config.gasStation.location.location) do + Config.gasStation.location.pickup[i] = CreatePickup(2 , Config.gasStation.location.location[i][1], Config.gasStation.location.location[i][2], Config.gasStation.location.location[i][3]) + CreateText3D( _("refuel").."\n".._("press_e"), 18, Config.gasStation.location.location[i][1], Config.gasStation.location.location[i][2], Config.gasStation.location.location[i][3] + 120, 0, 0, 0) + table.insert(GasStationCached, Config.gasStation.location.pickup[i]) end CreateTimer(function() @@ -99,12 +58,12 @@ AddRemoteEvent("StartRefuel", function(player, vehicle) local cash = PlayerData[player].inventory['cash'] or 0 local fuel = VehicleData[vehicle].fuel or 100 - CallRemoteEvent(player, "OpenUIGasStation", cash, 100, fuel, gasPrices.gasoil, gasPrices.gasoilplus) + CallRemoteEvent(player, "OpenUIGasStation", cash, 100, fuel, Config.gasStation.Fuel.gasoil.price, Config.gasStation.Fuel.gasoilplus.price) end end) AddRemoteEvent("PayGasStation", function(player, count, fuel, vehicle) - price = count * tonumber(gasPrices[fuel]) + price = count * tonumber(Config.gasStation.Fuel[fuel]) local resultPay = RemovePlayerCash(player, price) if resultPay then diff --git a/garage/server.lua b/garage/server.lua index efd39884..8f19a446 100644 --- a/garage/server.lua +++ b/garage/server.lua @@ -1,42 +1,6 @@ local _ = function(k,...) return ImportPackage("i18n").t(GetPackageName(),k,...) end -GarageDealerObjectsCached = { } -GarageDealerTable = { - { - location = { 22083, 146617, 1560, -90 }, - spawn = { 22120, 145492 , 1560, -90 } - }, - { - location = { -184007, -50877, 1146, -90 }, - spawn = { -183649, -51499, 1146, -90 } - }, - { - location = { 202673, 198046, 1307, 90 }, - spawn = { 202786, 199085, 1307, 0 } - }, - { - location = { -25135, -17097, 2062, -150 }, - spawn = { -25576, -17300, 2062 , -150 } - } - } - - GarageStoreTable = { - { - modelid = 2, - location = { - { 23432, 145697, 1550 }, - { 20752, 168878, 1306 }, - { -184587, -51196, 1146 }, - { -185403, -51170, 1146 }, - { -185603, -51410, 1146 }, - { 203269, 201098, 1307 }, - { 203973, 201098, 1307 }, - { -25189, -16824, 2077 } - }, - object = {} - } -} - +GarageDealerObjectsCached = {} GarageStoreObjectsCached = {} AddEvent("database:connected", function() @@ -44,7 +8,7 @@ AddEvent("database:connected", function() end) AddEvent("OnPackageStart", function() - for k,v in pairs(GarageDealerTable) do + for k,v in pairs(Config.GarageDealerTable) do v.npc = CreateNPC(v.location[1], v.location[2], v.location[3], v.location[4]) CreateText3D(_("garage").."\n".._("press_e"), 18, v.location[1], v.location[2], v.location[3] + 120, 0, 0, 0) @@ -52,7 +16,7 @@ end) table.insert(GarageDealerObjectsCached, v.npc) end - for k,v in pairs(GarageStoreTable) do + for k,v in pairs(Config.GarageStoreTable) do for i,j in pairs(v.location) do v.object[i] = CreatePickup(v.modelid , v.location[i][1], v.location[i][2], v.location[i][3]) @@ -78,7 +42,7 @@ AddRemoteEvent("garageDealerInteract", function(player, garagedealerobject) end) function GetGarageDealearByObject(garagedealerobject) - for k,v in pairs(GarageDealerTable) do + for k,v in pairs(Config.GarageDealerTable) do if v.npc == garagedealerobject then return v end @@ -112,7 +76,7 @@ function OnGarageListLoaded(player) end function OnPlayerPickupHit(player, pickup) - for k,v in pairs(GarageStoreTable) do + for k,v in pairs(Config.GarageStoreTable) do for i,j in pairs(v.object) do if j == pickup then vehicle = GetPlayerVehicle(player) @@ -163,7 +127,7 @@ function spawnCarServerLoaded(player) local x, y, z = GetPlayerLocation(player) - for k,v in pairs(GarageDealerTable) do + for k,v in pairs(Config.GarageDealerTable) do local x2, y2, z2 = GetNPCLocation(v.npc) local dist = GetDistance3D(x, y, z, x2, y2, z2) if dist < 150.0 then diff --git a/gathering/s_gathering.lua b/gathering/s_gathering.lua index 0c527970..dc04f56f 100644 --- a/gathering/s_gathering.lua +++ b/gathering/s_gathering.lua @@ -1,123 +1,5 @@ local _ = function(k, ...) return ImportPackage("i18n").t(GetPackageName(), k, ...) end -gatherTable = { - {-- LUMBERJACK STUFF - gather_zone = { - {x = -215796, y = -74619, z = 291} - }, -- Zone of initial gathering - gather_item = "tree_log", -- item that is given by initial gathering - gather_time = 15, -- Time in seconds to gather one item, - process_steps = {-- Describe the steps of processing - { - step_zone = {x = -70149, y = -59260, z = 1466}, -- zone of processing - step_require = "tree_log", -- item that is required (take the one from previous step) - step_require_number = 1, -- number of item required - step_require_tool = "lumberjack_saw", - step_processed_item = "wood_plank", -- item that will be given - step_processed_item_number = 2, -- number of item that will be given - step_process_time = 30, -- Time in seconds to process one item - step_animation = "COMBINE", -- Animation for processing - step_animation_attachement = nil - } - }, - require_job = false, -- Job required, - require_tool = "lumberjack_axe", -- Tool required in inventory, - require_knowledge = false, -- Require knowledge (for processing illegal stuff → drugdealer, cocaine) - gather_animation = "PICKAXE_SWING", -- Animation that the player will act when doing stuff - gather_animation_attachement = {modelid = 1047, bone = "hand_r"}, - gather_rp_props = nil, - sell_zone = { - {x = 203566, y = 171875, z = 1306, h = -90, item_to_sell = "wood_plank", price_per_unit = 36, sell_time = 5} - } - }, - {-- PEACH HARVESTION (FOR ALTIS LIFE FANS) - gather_zone = { - {x = -174432, y = 10837, z = 1831}, - {x = 189595, y = 147717, z = 5875}, - }, - gather_item = "peach", - gather_animation = "PICKUP_UPPER", - gather_time = 4, - gather_rp_props = { - -- Peach trees - {model = 145, x = -174006, y = 10457, z = 1773, rx = 0, ry = 10, rz = 0}, - {model = 145, x = -173829, y = 10894, z = 1743, rx = 0, ry = 30, rz = 0}, - {model = 145, x = -173980, y = 11396, z = 1698, rx = 0, ry = 45, rz = 0}, - {model = 145, x = -174691, y = 11532, z = 1709, rx = 0, ry = 0, rz = 0}, - {model = 145, x = -175204, y = 11094, z = 1755, rx = 0, ry = 145, rz = 0}, - {model = 145, x = -175449, y = 11528, z = 1757, rx = 0, ry = 80, rz = 0}, - {model = 145, x = -175171, y = 12038, z = 1719, rx = 0, ry = 50, rz = 0}, - {model = 145, x = -174581, y = 12021, z = 1686, rx = 0, ry = 40, rz = 0}, - }, - sell_zone = { - { x = -167521, y = -39359, z = 1146, h = 180, item_to_sell = "peach", price_per_unit = 2, sell_time = 2 } - } - }, - {-- COCAINE - gather_zone = { - {x = 101448, y = -137535, z = 2178} - }, - gather_item = "coca_leaf", - gather_time = 7, - process_steps = { - { - step_zone = {x = 74387, y = -92653, z = 2293}, - step_require = "coca_leaf", - step_require_number = 3, - step_processed_item = "cocaine", - step_processed_item_number = 1, - step_process_time = 15, - } - }, - require_knowledge = true, - }, - {-- FISHING - gather_zone = { - {x = 232464, y = 193521, z = 112}, - {x = -220130, y = 23036, z = 107}, - }, - gather_item = "herring", - require_tool = "fishing_rod", - gather_animation = "FISHING", - gather_time = 6, - gather_animation_attachement = {modelid = 1111, bone = "hand_r"}, - sell_zone = { - {x = -21295, y = -22954, z = 2080, h = -90, item_to_sell = "herring", price_per_unit = 5, sell_time = 5} - } - }, - {-- MINING - gather_zone = { - {x = -101174, y = 98223, z = 180} - }, - gather_item = "iron_ore", - require_tool = "pickaxe", - gather_animation = "PICKAXE_SWING", - gather_time = 18, - gather_animation_attachement = {modelid = 1063, bone = "hand_r"}, - process_steps = { - { - step_zone = {x = -82629, y = 90991, z = 481}, - step_require = "iron_ore", - step_require_number = 1, - step_processed_item = "iron_ingot", - step_processed_item_number = 2, - step_process_time = 18, - }, - { - step_zone = {x = -191437, y = -31107, z = 1148}, - step_require = "iron_ingot", - step_require_number = 2, - step_processed_item = "iron_pipe", - step_processed_item_number = 1, - step_process_time = 30, - } - }, - sell_zone = { - {x = 67862, y = 184741, z = 535, h = 90, item_to_sell = "iron_pipe", price_per_unit = 54, sell_time = 5} - } - } -} - gatherPickupsCached = {} processPickupsCached = {} sellZoneNpcsCached = {} @@ -127,7 +9,7 @@ local defaultAnimationProcess = "COMBINE" local defaultGatherTime = 8 AddEvent("OnPackageStart", function()-- Initialize pickups and objects - for k, v in pairs(gatherTable) do + for k, v in pairs(Config.Gather) do if v.gather_zone ~= nil then -- Create pickups for gathering zones v.gatherPickup = {} for k2, v2 in pairs(v.gather_zone) do @@ -192,7 +74,7 @@ AddRemoteEvent("gathering:gather:start", function(player, gatherPickup)-- Start if GetPlayerVehicle(player) ~= 0 then return end local gather = GetGatherByGatherPickup(gatherPickup) - if gatherTable[gather] == nil then return end -- fail check + if Config.Gather[gather] == nil then return end -- fail check if GetPlayerBusy(player) then -- Stop gathering StopGathering(player, gather) CallRemoteEvent(player, "MakeNotification", _("gather_cancelled"), "linear-gradient(to right, #ff5f6d, #ffc371)") @@ -200,20 +82,20 @@ AddRemoteEvent("gathering:gather:start", function(player, gatherPickup)-- Start end -- #1 Check for jobs - if gatherTable[gather].require_job ~= nil and gatherTable[gather].require_job ~= false and gatherTable[gather].require_job ~= PlayerData[player].job then - CallRemoteEvent(player, "MakeNotification", _("wrong_job", _(gatherTable[gather].require_job)), "linear-gradient(to right, #ff5f6d, #ffc371)") + if Config.Gather[gather].require_job ~= nil and Config.Gather[gather].require_job ~= false and Config.Gather[gather].require_job ~= PlayerData[player].job then + CallRemoteEvent(player, "MakeNotification", _("wrong_job", _(Config.Gather[gather].require_job)), "linear-gradient(to right, #ff5f6d, #ffc371)") return end -- #2 Check for tools - if gatherTable[gather].require_tool ~= nil and PlayerData[player].inventory[gatherTable[gather].require_tool] == nil then - CallRemoteEvent(player, "MakeNotification", _("need_tool2", _(gatherTable[gather].require_tool)), "linear-gradient(to right, #ff5f6d, #ffc371)") + if Config.Gather[gather].require_tool ~= nil and PlayerData[player].inventory[Config.Gather[gather].require_tool] == nil then + CallRemoteEvent(player, "MakeNotification", _("need_tool2", _(Config.Gather[gather].require_tool)), "linear-gradient(to right, #ff5f6d, #ffc371)") return end -- #3 Attach tool if any - if gatherTable[gather].gather_animation_attachement ~= nil then - SetAttachedItem(player, gatherTable[gather].gather_animation_attachement.bone, gatherTable[gather].gather_animation_attachement.modelid) + if Config.Gather[gather].gather_animation_attachement ~= nil then + SetAttachedItem(player, Config.Gather[gather].gather_animation_attachement.bone, Config.Gather[gather].gather_animation_attachement.modelid) end SetPlayerBusy(player) @@ -224,7 +106,7 @@ end) function DoGathering(player, gather, antiglitchKey) local ableToGather = false - for k,v in pairs(gatherTable[gather].gatherPickup) do + for k,v in pairs(Config.Gather[gather].gatherPickup) do local x,y,z = GetPickupLocation(v) local x2,y2,z2 = GetPlayerLocation(player) if GetDistance3D(x, y, z, x2, y2, z2) <= 2000 then @@ -237,22 +119,22 @@ function DoGathering(player, gather, antiglitchKey) CallRemoteEvent(player, "LockControlMove", true) -- #5 Start animation and loop - SetPlayerAnimation(player, gatherTable[gather].gather_animation or defaultAnimationGather) + SetPlayerAnimation(player, Config.Gather[gather].gather_animation or defaultAnimationGather) if PlayerData[player].timerGathering ~= nil then DestroyTimer(PlayerData[player].timerGathering) end PlayerData[player].timerGathering = CreateTimer(function(player, anim)-- for anim loop SetPlayerAnimation(player, anim) - end, 4000, player, gatherTable[gather].gather_animation or defaultAnimationGather) + end, 4000, player, Config.Gather[gather].gather_animation or defaultAnimationGather) -- #6 Display loading bar - CallRemoteEvent(player, "loadingbar:show", _("gather") .. " " .. _(gatherTable[gather].gather_item), gatherTable[gather].gather_time or defaultGatherTime)-- LOADING BAR + CallRemoteEvent(player, "loadingbar:show", _("gather") .. " " .. _(Config.Gather[gather].gather_item), Config.Gather[gather].gather_time or defaultGatherTime)-- LOADING BAR -- #7 When job is done, add to inventory and loop if PlayerData[player].isGathering == gather and PlayerData[player].gatheringAntiGlitch == antiglitchKey then - Delay((gatherTable[gather].gather_time or defaultGatherTime) * 1000, function() + Delay((Config.Gather[gather].gather_time or defaultGatherTime) * 1000, function() if GetPlayerVehicle(player) ~= 0 then return end if GetPlayerBusy(player) and PlayerData[player].isGathering == gather and PlayerData[player].gatheringAntiGlitch == antiglitchKey then -- Check if the player didnt canceled the job - if AddInventory(player, gatherTable[gather].gather_item, 1) == true then - CallRemoteEvent(player, "MakeNotification", _("gather_success", _(gatherTable[gather].gather_item)), "linear-gradient(to right, #00b09b, #96c93d)") + if AddInventory(player, Config.Gather[gather].gather_item, 1) == true then + CallRemoteEvent(player, "MakeNotification", _("gather_success", _(Config.Gather[gather].gather_item)), "linear-gradient(to right, #00b09b, #96c93d)") DoGathering(player, gather, antiglitchKey) else CallRemoteEvent(player, "MakeNotification", _("inventory_notenoughspace"), "linear-gradient(to right, #ff5f6d, #ffc371)") @@ -270,7 +152,7 @@ function StopGathering(player, gather) PlayerData[player].timerGathering = nil SetPlayerAnimation(player, "STOP") CallRemoteEvent(player, "LockControlMove", false) - if gatherTable[gather].gather_animation_attachement ~= nil then SetAttachedItem(player, gatherTable[gather].gather_animation_attachement.bone, 0) end + if Config.Gather[gather].gather_animation_attachement ~= nil then SetAttachedItem(player, Config.Gather[gather].gather_animation_attachement.bone, 0) end CallRemoteEvent(player, "loadingbar:hide") end @@ -279,9 +161,9 @@ AddRemoteEvent("gathering:process:start", function(player, processPickup) if GetPlayerVehicle(player) ~= 0 then return end local gather = GetGatherByProcessPickup(processPickup) if gather == nil then return end - if gatherTable[gather[1]] == nil and gatherTable[gather[1]].process_steps[gather[2]] then return end -- fail check + if Config.Gather[gather[1]] == nil and Config.Gather[gather[1]].process_steps[gather[2]] then return end -- fail check - local process = gatherTable[gather[1]].process_steps[gather[2]] + local process = Config.Gather[gather[1]].process_steps[gather[2]] if GetPlayerBusy(player) then -- Stop processing SetPlayerNotBusy(player) @@ -291,8 +173,8 @@ AddRemoteEvent("gathering:process:start", function(player, processPickup) end -- #1 Check for jobs - if gatherTable[gather[1]].require_job ~= nil and gatherTable[gather[1]].require_job ~= false and gatherTable[gather[1]].require_job ~= PlayerData[player].job then - CallRemoteEvent(player, "MakeNotification", _("wrong_job", _(gatherTable[gather[1]].require_job)), "linear-gradient(to right, #ff5f6d, #ffc371)") + if Config.Gather[gather[1]].require_job ~= nil and Config.Gather[gather[1]].require_job ~= false and Config.Gather[gather[1]].require_job ~= PlayerData[player].job then + CallRemoteEvent(player, "MakeNotification", _("wrong_job", _(Config.Gather[gather[1]].require_job)), "linear-gradient(to right, #ff5f6d, #ffc371)") return end @@ -310,7 +192,7 @@ AddRemoteEvent("gathering:process:start", function(player, processPickup) SetPlayerBusy(player) PlayerData[player].isProcessing = gather[2] PlayerData[player].gatheringAntiGlitch = math.random(0, 100) - DoProcessing(player, gatherTable[gather[1]], process, gather[2], PlayerData[player].gatheringAntiGlitch) + DoProcessing(player, Config.Gather[gather[1]], process, gather[2], PlayerData[player].gatheringAntiGlitch) end) function DoProcessing(player, gather, process, processKey, antiglitchKey) @@ -393,9 +275,9 @@ end --- SELLING function StartSelling(player, npc) local gather = GetGatherBySellNpc(npc) - local item = gatherTable[gather[1]].sell_zone[gather[2]].item_to_sell - local time = gatherTable[gather[1]].sell_zone[gather[2]].sell_time - local price = gatherTable[gather[1]].sell_zone[gather[2]].price_per_unit + local item = Config.Gather[gather[1]].sell_zone[gather[2]].item_to_sell + local time = Config.Gather[gather[1]].sell_zone[gather[2]].sell_time + local price = Config.Gather[gather[1]].sell_zone[gather[2]].price_per_unit if PlayerData[player].inventory[item] ~= nil and PlayerData[player].inventory[item] > 0 then CallRemoteEvent(player, "loadingbar:show", _("selling_of_item", tonumber(PlayerData[player].inventory[item]), _(item)), time)-- LOADING BAR @@ -422,7 +304,7 @@ AddRemoteEvent("gathering:sell:start", StartSelling) -- tools function GetGatherByGatherPickup(gatherPickup) - for k, v in pairs(gatherTable) do + for k, v in pairs(Config.Gather) do for k2, v2 in pairs(v.gatherPickup) do if v2 == gatherPickup then return k @@ -432,7 +314,7 @@ function GetGatherByGatherPickup(gatherPickup) end function GetGatherByProcessPickup(processPickup) - for k, v in pairs(gatherTable) do + for k, v in pairs(Config.Gather) do if v.process_steps ~= nil then for k2, v2 in pairs(v.process_steps) do if v2.processPickup == processPickup then @@ -444,7 +326,7 @@ function GetGatherByProcessPickup(processPickup) end function GetGatherBySellNpc(npc) - for k, v in pairs(gatherTable) do + for k, v in pairs(Config.Gather) do if v.sell_zone ~= nil then for k2, v2 in pairs(v.sell_zone) do if v2.sellNpc == npc then diff --git a/inventory/server.lua b/inventory/server.lua index a9b9c195..37521466 100644 --- a/inventory/server.lua +++ b/inventory/server.lua @@ -1,8 +1,5 @@ local _ = function(k, ...) return ImportPackage("i18n").t(GetPackageName(), k, ...) end -local inventory_base_max_slots = 50 -local backpack_slot_to_add = 35 - local droppedObjectsPickups = {} AddRemoteEvent("ServerPersonalMenu", function(player, inVehicle, vehiclSpeed) @@ -673,9 +670,9 @@ end function GetPlayerMaxSlots(player) if PlayerData[player].inventory['item_backpack'] and math.tointeger(PlayerData[player].inventory['item_backpack']) > 0 then - return math.floor(inventory_base_max_slots + backpack_slot_to_add) + return math.floor(Config.inventoryBaseMaxSlots + Config.backpackSlotToAdd) else - return inventory_base_max_slots + return Config.inventoryBaseMaxSlots end end diff --git a/licenses/client.lua b/licenses/client.lua index 974f8185..1cf3743f 100644 --- a/licenses/client.lua +++ b/licenses/client.lua @@ -58,7 +58,7 @@ end AddRemoteEvent("OpenLicenses", function(licenses) local licenseItems = {} for k, v in pairs(licenses) do - licenseItems[k] = _(k).." ["..v.._("currency").."]" + licenseItems[k] = v.displayName.." ["..v.price.._("currency").."]" end Dialog.setSelectLabeledOptions(licenseNpcMenu, 1, 1, licenseItems) diff --git a/licenses/server.lua b/licenses/server.lua index 87694cba..a4dab3f7 100644 --- a/licenses/server.lua +++ b/licenses/server.lua @@ -1,17 +1,12 @@ local _ = function(k,...) return ImportPackage("i18n").t(GetPackageName(),k,...) end -Licenses = { - driver_license = 1500, - gun_license = 6000 --- helicopter_license = 30000 -} LicensesNpcLocation = { x = 169336, y = 193430, z = 1307, h = 180 } -- LicensesNpcLocation = { x = 211564, y = 175848, z = 1307, h = 180 } LicensesNpc = {} AddEvent("OnPackageStart", function() - LicensesNpc = CreateNPC(LicensesNpcLocation.x, LicensesNpcLocation.y, LicensesNpcLocation.z, LicensesNpcLocation.h) - CreateText3D(_("license_shop").."\n".._("press_e"), 18, LicensesNpcLocation.x, LicensesNpcLocation.y, LicensesNpcLocation.z + 120, 0, 0, 0) + LicensesNpc = CreateNPC(Config.LicensesNpcLocation.x, Config.LicensesNpcLocation.y, Config.LicensesNpcLocation.z, Config.LicensesNpcLocation.h) + CreateText3D(_("license_shop").."\n".._("press_e"), 18, Config.LicensesNpcLocation.x, Config.LicensesNpcLocation.y, Config.LicensesNpcLocation.z + 120, 0, 0, 0) end) AddEvent("OnPlayerJoin", function(player) @@ -21,7 +16,7 @@ end) AddRemoteEvent("LicenseInteract", function(player) local availableLicenses = {} - for k, v in pairs(Licenses) do + for k, v in pairs(Config.Licenses) do if PlayerData[player][k] == 0 then availableLicenses[k] = v end @@ -31,7 +26,7 @@ AddRemoteEvent("LicenseInteract", function(player) end) AddRemoteEvent("BuyLicense", function (player, license) - local price = Licenses[license] + local price = Config.Licenses[license].price if GetPlayerCash(player) < price then CallRemoteEvent(player, "MakeNotification", _("not_enought_cash"), "linear-gradient(to right, #ff5f6d, #ffc371)") diff --git a/medic/s_damage.lua b/medic/s_damage.lua index 8371580e..bb2a70d7 100644 --- a/medic/s_damage.lua +++ b/medic/s_damage.lua @@ -1,13 +1,5 @@ local _ = function(k, ...) return ImportPackage("i18n").t(GetPackageName(), k, ...) end -local BLEEDING_CHANCE = 40 -- Chance for the player to bleed on damage -local INITIAL_DAMAGE_TO_BLEED = 1.5 -- how much the damages have to be divided by -local DAMAGE_PER_TICK = 1 -- the damages the player will take on each tick -local BLEEDING_DAMAGE_INTERVAL = 5000 -- The interval to apply damages -local BLEED_EFFECT_AMOUNT = 70 -- the amount of bleed effect (red flash) -local TASER_LOCK_DURATION = 10000 -local TASER_EFFECT_DURATION = 20000 - local BODY_Z = 50 local HEAD_Z = 150 local HEAD_Z_CROUCHING = 130 @@ -51,7 +43,7 @@ AddEvent("OnPlayerDamage", function(player, damagetype, amount) if GetPlayerHealth(player) > 0 and damagetype == 1 and amount > 10 then math.randomseed(os.time()) local lucky = math.random(100) - if lucky <= BLEEDING_CHANCE then + if lucky <= Config.bleedingChance then ApplyBleeding(player, amount) end end @@ -60,8 +52,8 @@ end) function ApplyTaserEffect(player) SetPlayerRagdoll(player, true)-- Makes player ragdoll CallRemoteEvent(player, "LockControlMove", true) - CallRemoteEvent(player, "damage:taser:starteffect", TASER_EFFECT_DURATION) - Delay(TASER_LOCK_DURATION, function()-- Waits 6 seconds before the player can stand up again + CallRemoteEvent(player, "damage:taser:starteffect", Config.tazerLockDuration) + Delay(Config.tazerLockDuration, function()-- Waits 6 seconds before the player can stand up again SetPlayerRagdoll(player, false)-- Disables the ragdoll so he can walk again. SetPlayerAnimation(player, "PUSHUP_END") CallRemoteEvent(player, "LockControlMove", false) @@ -72,8 +64,8 @@ function ApplyTaserEffect(player) end function ApplyBleeding(player, damageAmount) - local damages = (tonumber(damageAmount) / INITIAL_DAMAGE_TO_BLEED) - local bleedingTime = math.ceil(damages / DAMAGE_PER_TICK)-- calculate the amount of time while the player will bleed + local damages = (tonumber(damageAmount) / Config.InitialDamageToBleed) + local bleedingTime = math.ceil(damages / Config.DmamgePerTick)-- calculate the amount of time while the player will bleed -- Reset timer if another bleed occur if bleedingTimers[player] ~= nil then @@ -94,14 +86,14 @@ function ApplyBleeding(player, damageAmount) return end i = i + 1 - SetPlayerHealth(player, GetPlayerHealth(player) - DAMAGE_PER_TICK) - CallRemoteEvent(player, "damage:bleed:tickeffect", BLEED_EFFECT_AMOUNT) + SetPlayerHealth(player, GetPlayerHealth(player) - Config.DmamgePerTick) + CallRemoteEvent(player, "damage:bleed:tickeffect", Config.BleedEffectAmount) for k, v in pairs(GetStreamedPlayersForPlayer(player)) do if IsValidPlayer(v) then CallRemoteEvent(v, "damage:bleed:dropblood", player) end end - end, BLEEDING_DAMAGE_INTERVAL) + end, Config.BlledingDamageInterval) end function CleanPlayerEffects(player) diff --git a/medic/s_medic.lua b/medic/s_medic.lua index 70d28f82..b4411000 100644 --- a/medic/s_medic.lua +++ b/medic/s_medic.lua @@ -1,52 +1,5 @@ local _ = function(k, ...) return ImportPackage("i18n").t(GetPackageName(), k, ...) end -local MAX_MEDIC = 20 -local ALLOW_RESPAWN_VEHICLE = false -local TIMER_RESPAWN_WAITER = 1800 -- 30 minutes -local REVIVE_PERCENT_SUCCESS = 40 -- in percent -local TIME_TO_REVIVE = 15 -- in seconds -local AUTO_CALL_FOR_MEDIC = false -local TIME_TO_HEAL = 5 -- in seconds -local AMOUNT_TO_HEAL_PER_INTERACTION = 30 -- Hp that will be healed each time the medic interact - -local DEFAULT_RESPAWN_POINT = {x = 212124, y = 159055, z = 1305, h = 90} - -local VEHICLE_SPAWN_LOCATION = { - {x = 213325, y = 161177, z = 1305, h = -90}, -} - -local MEDIC_SERVICE_NPC = { - {x = 212493, y = 157096, z = 2780, h = 180}, -} - -local MEDIC_VEHICLE_NPC = { - {x = 212571, y = 159486, z = 1320, h = 90}, -} - -local MEDIC_GARAGE = { - {x = 215766, y = 161131, z = 1305}, -} - -local MEDIC_EQUIPMENT_NPC = { - {x = 212744, y = 157405, z = 2781, h = -90}, -} - -local MEDIC_HOSPITAL_LOCATION = { - {x = 213079, y = 155179, radius = 2000} -} - -local MEDIC_EQUIPEMENT_NEEDED = { - {item = "defibrillator", qty = 1}, - {item = "adrenaline_syringe", qty = 5}, - {item = "bandage", qty = 5}, - {item = "health_kit", qty = 3}, -} - -local ITEM_MEDKIT_HEAL = 10 -local ITEM_MEDKIT_MAX_HEAL = 30 -local ITEM_ADRENALINE_SYRINGE_HEAL = 50 -local ITEM_TIME_TO_USE = 5 - local medicNpcIds = {} local medicVehicleNpcIds = {} local medicGarageIds = {} @@ -56,24 +9,24 @@ local medicHospitalLocationIds = {} AddEvent("OnPackageStart", function() - for k, v in pairs(MEDIC_SERVICE_NPC) do + for k, v in pairs(Config.Medic.serviceNPC) do v.npcObject = CreateNPC(v.x, v.y, v.z, v.h) table.insert(medicNpcIds, v.npcObject) end - for k, v in pairs(MEDIC_GARAGE) do + for k, v in pairs(Config.Medic.garage) do v.garageObject = CreatePickup(2, v.x, v.y, v.z) table.insert(medicGarageIds, v.garageObject) end - for k, v in pairs(MEDIC_VEHICLE_NPC) do + for k, v in pairs(Config.Medic.vehicleNPC) do v.npcObject = CreateNPC(v.x, v.y, v.z, v.h) SetNPCAnimation(v.npcObject, "WALLLEAN04", true) table.insert(medicVehicleNpcIds, v.npcObject) end - for k, v in pairs(MEDIC_EQUIPMENT_NPC) do + for k, v in pairs(Config.Medic.equipmentNPC) do v.npcObject = CreateNPC(v.x, v.y, v.z, v.h) SetNPCAnimation(v.npcObject, "WALLLEAN04", true) table.insert(medicEquipmentNpcIds, v.npcObject) @@ -115,7 +68,7 @@ function MedicStartService(player)-- start service for k, v in pairs(PlayerData) do if v.job == "medic" then medics = medics + 1 end end - if medics >= MAX_MEDIC then + if medics >= Config.MaxMedic then CallRemoteEvent(player, "MakeErrorNotification", _("job_full")) return end @@ -152,7 +105,7 @@ end function GiveMedicEquipmentToPlayer(player)-- To give medic equipment to medics if PlayerData[player].job == "medic" and PlayerData[player].medic == 1 then -- Fail check - for k, v in pairs(MEDIC_EQUIPEMENT_NEEDED) do + for k, v in pairs(Config.Medic.equipmentNeeded) do SetInventory(player, v.item, v.qty) end end @@ -160,7 +113,7 @@ end AddRemoteEvent("medic:checkmyequipment", GiveMedicEquipmentToPlayer) function RemoveMedicEquipmentToPlayer(player)-- remove equipment from a medic - for k, v in pairs(MEDIC_EQUIPEMENT_NEEDED) do + for k, v in pairs(Config.Medic.equipmentNeeded) do SetInventory(player, v.item, 0) end end @@ -209,7 +162,7 @@ function SpawnMedicCar(player)-- to spawn an ambulance end -- #2 Check if the player has a job vehicle spawned then destroy it - if PlayerData[player].job_vehicle ~= nil and ALLOW_RESPAWN_VEHICLE then + if PlayerData[player].job_vehicle ~= nil and Config.AllowVehicleRespawn then DestroyVehicle(PlayerData[player].job_vehicle) DestroyVehicleData(PlayerData[player].job_vehicle) PlayerData[player].job_vehicle = nil @@ -217,7 +170,7 @@ function SpawnMedicCar(player)-- to spawn an ambulance -- #3 Try to spawn the vehicle if PlayerData[player].job_vehicle == nil then - local spawnPoint = VEHICLE_SPAWN_LOCATION[MedicGetClosestSpawnPoint(player)] + local spawnPoint = Config.Medic.vehiclespawnLocation[MedicGetClosestSpawnPoint(player)] if spawnPoint == nil then return end for k, v in pairs(GetStreamedVehiclesForPlayer(player)) do local x, y, z = GetVehicleLocation(v) @@ -255,7 +208,7 @@ end AddEvent("OnPlayerPickupHit", function(player, pickup)-- Store the vehicle in garage if PlayerData[player].medic ~= 1 then return end if PlayerData[player].job ~= "medic" then return end - for k, v in pairs(MEDIC_GARAGE) do + for k, v in pairs(Config.Medic.garage) do if v.garageObject == pickup then local vehicle = GetPlayerVehicle(player) if vehicle == nil then return end @@ -346,13 +299,13 @@ function MedicRevivePlayer(player)-- To revive a player. can fail. need defib. CallRemoteEvent(player, "LockControlMove", true) SetPlayerBusy(player) - CallRemoteEvent(player, "loadingbar:show", _("medic_revive_attempt"), TIME_TO_REVIVE)-- LOADING BAR + CallRemoteEvent(player, "loadingbar:show", _("medic_revive_attempt"), Config.timeToRevive)-- LOADING BAR SetPlayerAnimation(player, "REVIVE") local timer = CreateTimer(function() SetPlayerAnimation(player, "REVIVE") end, 4000) - Delay(TIME_TO_REVIVE * 1000, function() + Delay(Config.timeToRevive * 1000, function() DestroyTimer(timer) SetPlayerAnimation(player, "STOP") @@ -362,7 +315,7 @@ function MedicRevivePlayer(player)-- To revive a player. can fail. need defib. math.randomseed(os.time()) local lucky = math.random(100) - if lucky > REVIVE_PERCENT_SUCCESS then -- Success ! + if lucky > Config.revivePercentSuccess then -- Success ! local x, y, z = GetPlayerLocation(nearestPlayer) local h = GetPlayerHeading(nearestPlayer) SetPlayerSpawnLocation(nearestPlayer, x, y, z, h) @@ -408,13 +361,13 @@ function MedicTruelyHealPlayer(player)-- To really heal a player. This need to b -- Lock player while he's healing SetPlayerBusy(player) - CallRemoteEvent(player, "loadingbar:show", _("medic_healing_in_progress"), TIME_TO_HEAL)-- LOADING BAR + CallRemoteEvent(player, "loadingbar:show", _("medic_healing_in_progress"), Config.timeToHeal)-- LOADING BAR SetPlayerAnimation(player, "HANDSHAKE") local timer = CreateTimer(function() SetPlayerAnimation(player, "HANDSHAKE") end, 4000) - Delay(TIME_TO_HEAL * 1000, function() + Delay(Config.timeToHeal * 1000, function() DestroyTimer(timer) SetPlayerAnimation(player, "STOP") @@ -436,13 +389,13 @@ AddRemoteEvent("medic:interact:heal", MedicTruelyHealPlayer) --------- INTERACTIONS END --------- HEALTH BEHAVIOR AddEvent("OnPlayerDeath", function(player, instigator)-- do some stuff when player die - SetPlayerSpawnLocation(player, DEFAULT_RESPAWN_POINT.x, DEFAULT_RESPAWN_POINT.y, DEFAULT_RESPAWN_POINT.z, DEFAULT_RESPAWN_POINT.h)-- HOSPITAL + SetPlayerSpawnLocation(player, Config.Medic.defaultRespawnPoint.x, Config.Medic.defaultRespawnPoint.y, Config.Medic.defaultRespawnPoint.z, Config.Medic.defaultRespawnPoint.h)-- HOSPITAL - SetPlayerRespawnTime(player, TIMER_RESPAWN_WAITER * 1000) + SetPlayerRespawnTime(player, config.waitbeforerespawn * 1000) CallRemoteEvent(player, "medic:revivescreen:toggle", true) if GetMedicsOnDuty(player) > 0 then - if AUTO_CALL_FOR_MEDIC == true then CreateMedicCallout(player) end + if Config.autoCall == true then CreateMedicCallout(player) end CallRemoteEvent(player, "medic:revivescreen:btncallmedic:toggle", 1) else @@ -479,18 +432,18 @@ end) --------- ITEMS USES function MedicUseItem(player, item) if item == "health_kit" then -- PERSONNAL HEALTH KIT (Dont need to be medic) - if GetPlayerHealth(player) < ITEM_MEDKIT_MAX_HEAL then - CallRemoteEvent(player, "loadingbar:show", _("medic_item_use", _("health_kit")), ITEM_TIME_TO_USE)-- LOADING BAR + if GetPlayerHealth(player) < Config.medkitMaxheal then + CallRemoteEvent(player, "loadingbar:show", _("medic_item_use", _("health_kit")), Config.ItemTimeToUse = 5)-- LOADING BAR SetPlayerAnimation(player, "COMBINE") local timer = CreateTimer(function() SetPlayerAnimation(player, "COMBINE") end, 2000) - Delay(ITEM_TIME_TO_USE * 1000, function() + Delay(Config.ItemTimeToUse = 5 * 1000, function() DestroyTimer(timer) SetPlayerAnimation(player, "STOP") - SetPlayerHealth(player, GetPlayerHealth(player) + ITEM_MEDKIT_HEAL) - if GetPlayerHealth(player) > ITEM_MEDKIT_MAX_HEAL then SetPlayerHealth(player, ITEM_MEDKIT_MAX_HEAL) end + SetPlayerHealth(player, GetPlayerHealth(player) + Config.medkitHeal) + if GetPlayerHealth(player) > Config.medkitMaxheal then SetPlayerHealth(player, Config.medkitMaxheal) end PlayerData[player].health = GetPlayerHealth(player) if PlayerData[player].job == "medic" then SetPlayerHealth(player, 60) @@ -513,17 +466,17 @@ function MedicUseItem(player, item) CallRemoteEvent(player, "MakeErrorNotification", _("medic_nobody_nearby")) return end - if GetPlayerHealth(nearestPlayer) < ITEM_ADRENALINE_SYRINGE_HEAL then - CallRemoteEvent(player, "loadingbar:show", _("medic_item_use", _("adrenaline_syringe")), ITEM_TIME_TO_USE)-- LOADING BAR + if GetPlayerHealth(nearestPlayer) < Config.adrSyringeHeal then + CallRemoteEvent(player, "loadingbar:show", _("medic_item_use", _("adrenaline_syringe")), Config.ItemTimeToUse = 5)-- LOADING BAR SetPlayerAnimation(player, "COMBINE") local timer = CreateTimer(function() SetPlayerAnimation(player, "COMBINE") end, 2000) - Delay(ITEM_TIME_TO_USE * 1000, function() + Delay(Config.ItemTimeToUse = 5 * 1000, function() DestroyTimer(timer) SetPlayerAnimation(player, "STOP") - SetPlayerHealth(nearestPlayer, ITEM_ADRENALINE_SYRINGE_HEAL) + SetPlayerHealth(nearestPlayer, Config.adrSyringeHeal) PlayerData[player].health = GetPlayerHealth(nearestPlayer) RemoveInventory(player, item, 1) CallRemoteEvent(player, "MakeNotification", _("medic_item_adrenaline_syringue_success"), "linear-gradient(to right, #00b09b, #96c93d)") @@ -540,13 +493,13 @@ function MedicUseItem(player, item) return end if IsPlayerBleeding(nearestPlayer) then - CallRemoteEvent(player, "loadingbar:show", _("medic_item_use", _("bandage")), ITEM_TIME_TO_USE)-- LOADING BAR + CallRemoteEvent(player, "loadingbar:show", _("medic_item_use", _("bandage")), Config.ItemTimeToUse = 5)-- LOADING BAR SetPlayerAnimation(player, "COMBINE") local timer = CreateTimer(function() SetPlayerAnimation(player, "COMBINE") end, 2000) - Delay(ITEM_TIME_TO_USE * 1000, function() + Delay(Config.ItemTimeToUse = 5 * 1000, function() DestroyTimer(timer) SetPlayerAnimation(player, "STOP") StopBleedingForPlayer(nearestPlayer) @@ -568,7 +521,7 @@ function MedicGetClosestSpawnPoint(player)-- get closeest spawn point for vehicl local x, y, z = GetPlayerLocation(player) local closestSpawnPoint local dist - for k, v in pairs(VEHICLE_SPAWN_LOCATION) do + for k, v in pairs(Config.Medic.vehiclespawnLocation) do local currentDist = GetDistance3D(x, y, z, v.x, v.y, v.z) if (dist == nil or currentDist < dist) and currentDist <= 2000 then closestSpawnPoint = k @@ -590,7 +543,7 @@ end function IsHospitalInRange(player)-- to nknow if player and targets are in range from hospital local x, y, z = GetPlayerLocation(player) - for k, v in pairs(MEDIC_HOSPITAL_LOCATION) do + for k, v in pairs(Config.Medic.hospitalLocation) do if GetDistance2D(x, y, v.x, v.y) <= v.radius then return true end diff --git a/misc/s_database.lua.dist b/misc/s_database.lua.dist index d3d14322..b5b594e0 100644 --- a/misc/s_database.lua.dist +++ b/misc/s_database.lua.dist @@ -1,24 +1,16 @@ sql = false -local SQL_HOST = "localhost" -local SQL_PORT = 3306 -local SQL_USER = "root" -local SQL_PASS = "" -local SQL_DATA = "roleplay" -local SQL_CHAR = "utf8mb4" -local SQL_LOGL = "error" - -- Setup a MariaDB connection when the package/server starts local function OnPackageStart() - mariadb_log(SQL_LOGL) + mariadb_log(Config.db.SQL_LOGL) - sql = mariadb_connect(SQL_HOST .. ':' .. SQL_PORT, SQL_USER, SQL_PASS, SQL_DATA) + sql = mariadb_connect(Config.db.SQL_HOST .. ':' .. Config.db.SQL_PORT, Config.db.SQL_USER, Config.db.SQL_PASS, Config.db.SQL_DB) if (sql ~= false) then - print("MariaDB: Connected to " .. SQL_HOST) - mariadb_set_charset(sql, SQL_CHAR) + print("MariaDB: Connected to " .. Config.db.SQL_HOST) + mariadb_set_charset(sql, Config.db.SQL_CHAR) else - print("MariaDB: Connection failed to " .. SQL_HOST .. ", see mariadb_log file") + print("MariaDB: Connection failed to " .. Config.db.SQL_HOST .. ", see mariadb_log file") -- Immediately stop the server if we cannot connect ServerExit() diff --git a/onset-characterize/server.lua b/onset-characterize/server.lua index e962ed89..b1f313b5 100644 --- a/onset-characterize/server.lua +++ b/onset-characterize/server.lua @@ -1,50 +1,10 @@ - -local bodyOptions = { - [1] = "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Business_LPR", - [2] = "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Normal01_LPR", - [3] = "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Normal02_LPR", - [4] = "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Normal03_LPR", - [5] = "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Normal04_LPR", - [6] = "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Pimp_LPR", - [7] = "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Police_LPR", - [8] = "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Scientist_LPR", - [9] = "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_SpecialAgent_LPR" -} -local shirtOptions = { - [1] = "", - [2] = "/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_FormalShirt_LPR", - [3] = "/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_FormalShirt2_LPR", - [4] = "/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_Shirt_LPR", - [5] = "/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_TShirt_Knitted2_LPR", - [6] = "/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_TShirt_Knitted_LPR", - [7] = "/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_TShirt_LPR" -} -local pantOptions = { - [1] = "/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_CargoPants_LPR", - [2] = "/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_DenimPants_LPR", - [3] = "/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_FormalPants_LPR" -} -local shoeOptions = { - [1] = "", - [2] = "/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_NormalShoes_LPR", - [3] = "/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_BusinessShoes_LPR" -} -local hairOptions = { - [1] = "/Game/CharacterModels/SkeletalMesh/HZN_CH3D_Hair_Business_LP", - [2] = "/Game/CharacterModels/SkeletalMesh/HZN_CH3D_Hair_Scientist_LP", - [3] = "/Game/CharacterModels/SkeletalMesh/HZN_CH3D_Police_Hair_LPR", - [3] = "/Game/CharacterModels/SkeletalMesh/HZN_CH3D_Normal_Hair_01_LPR", - [4] = "/Game/CharacterModels/SkeletalMesh/HZN_CH3D_Normal_Hair_03_LPR", - [5] = "/Game/CharacterModels/SkeletalMesh/HZN_CH3D_Normal_Hair_02_LPR" -} - AddRemoteEvent("characterize:GetOptions", function(player) CallRemoteEvent(player, "characterize:SetOptions", - json_encode(bodyOptions), - json_encode(shirtOptions), - json_encode(pantOptions), - json_encode(shoeOptions), - json_encode(hairOptions)) + json_encode(Config.clothing.body), + json_encode(Config.clothing.shirt), + json_encode(Config.clothing.pant), + json_encode(Config.clothing.shoe), + json_encode(Config.clothing.hair)) end) AddRemoteEvent("characterize:Submit", function(player, params) diff --git a/onset-phone/server.lua b/onset-phone/server.lua index 7407ff15..d528a127 100644 --- a/onset-phone/server.lua +++ b/onset-phone/server.lua @@ -1,15 +1,9 @@ local _ = function(k,...) return ImportPackage("i18n").t(GetPackageName(),k,...) end --- CONFIGS - -local canUsePhoneWithoutPhoneItem = false -local phoneItemName = 'phone' -local canUsePhoneWhileGathering = false - -- LOADING function LoadPhone(player) - if (canUsePhoneWhileGathering or not PlayerData[player].onAction) and canUsePhoneWithoutPhoneItem or PlayerData[player].inventory[phoneItemName] then + if (Config.usewhilegathering or not PlayerData[player].onAction) and Config.useWithoutPhone or PlayerData[player].inventory[Config.phoneItemName] then if not GetPlayerPropertyValue(player, "sit") then local x, y, z = GetPlayerLocation(player) local Ophone = CreateObject(181, x, y, z) From ca48bb91b8b5c6cd33f6007186c9e19c2cefddc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Brossard?= Date: Wed, 26 Feb 2020 17:21:22 +0100 Subject: [PATCH 05/16] update some files --- config/config_Global.lua | 46 ++++++++++++++++++++++ delivery/server.lua | 83 +++++++++++----------------------------- package.json | 3 ++ 3 files changed, 71 insertions(+), 61 deletions(-) diff --git a/config/config_Global.lua b/config/config_Global.lua index c0247718..126b9d0a 100644 --- a/config/config_Global.lua +++ b/config/config_Global.lua @@ -199,4 +199,50 @@ Config.gasStation.Fuel = { gasoilplus = { price = "2" } +} + +--+------------------------------------------+ +--| Delivery System | +--+------------------------------------------+ + +Config.delivery.locationPrice = 2000 + +Config.delivery.locationRefoundPercentage = 0.8 + +Config.delivery.priceDivider = 250 + +Config.delivery.pricePerDivide = 15 + +Config.delivery.NPC = { + { + location = {-16925, -29058, 2200, -90}, + spawn = {-17450, -28600, 2060, -90} + }, + { + location = {-168301, -41499, 1192, 90}, + spawn = {-168233, -40914, 1146, 90} + }, + { + location = {146585, 211065, 1307, -90}, + spawn = {145692, 210574, 1307, 0} + } +} + +Config.delivery.point = { + {116691, 164243, 3028}, + {38964, 204516, 550}, + {182789, 186140, 1203}, + {211526, 176056, 1209}, + {42323, 137508, 1569}, + {122776, 207169, 1282}, + {209829, 92977, 1312}, + {176840, 10049, 10370}, + {198130, -49703, 1109}, + {130042, 78285, 1566}, + {203711, 190025, 1312}, + {170311, -161302, 1242}, + {152267, -143379, 1242}, + {-181677, -31627, 1148}, + {-179804, -66772, 1147}, + {182881, 148416, 5933} } \ No newline at end of file diff --git a/delivery/server.lua b/delivery/server.lua index e21701fb..52dbc8ae 100644 --- a/delivery/server.lua +++ b/delivery/server.lua @@ -1,54 +1,15 @@ local _ = function(k, ...) return ImportPackage("i18n").t(GetPackageName(), k, ...) end -local deliveryNpc = { - { - location = {-16925, -29058, 2200, -90}, - spawn = {-17450, -28600, 2060, -90} - }, - { - location = {-168301, -41499, 1192, 90}, - spawn = {-168233, -40914, 1146, 90} - }, - { - location = {146585, 211065, 1307, -90}, - spawn = {145692, 210574, 1307, 0} - } -} -local deliveryPoint = { - {116691, 164243, 3028}, - {38964, 204516, 550}, - {182789, 186140, 1203}, - {211526, 176056, 1209}, - {42323, 137508, 1569}, - {122776, 207169, 1282}, - {209829, 92977, 1312}, - {176840, 10049, 10370}, - {198130, -49703, 1109}, - {130042, 78285, 1566}, - {203711, 190025, 1312}, - {170311, -161302, 1242}, - {152267, -143379, 1242}, - {-181677, -31627, 1148}, - {-179804, -66772, 1147}, - {182881, 148416, 5933} -} - -local LOCATION_PRICE = 2000 -local LOCATION_REFUND_PERCENTAGE = 0.8 - -local PRICE_DIVIDER = 250 -local PRICE_PER_DIVIDE = 15 - local deliveryNpcCached = {} local playerDelivery = {} local trucksOnLocation = {} AddEvent("OnPackageStart", function() - for k, v in pairs(deliveryNpc) do - deliveryNpc[k].npc = CreateNPC(deliveryNpc[k].location[1], deliveryNpc[k].location[2], deliveryNpc[k].location[3], deliveryNpc[k].location[4]) - CreateText3D(_("delivery_job") .. "\n" .. _("press_e"), 18, deliveryNpc[k].location[1], deliveryNpc[k].location[2], deliveryNpc[k].location[3] + 120, 0, 0, 0) - table.insert(deliveryNpcCached, deliveryNpc[k].npc) + for k, v in pairs(Config.delivery.NPC) do + Config.delivery.NPC[k].npc = CreateNPC(Config.delivery.NPC[k].location[1], Config.delivery.NPC[k].location[2], Config.delivery.NPC[k].location[3], Config.delivery.NPC[k].location[4]) + CreateText3D(_("delivery_job") .. "\n" .. _("press_e"), 18, Config.delivery.NPC[k].location[1], Config.delivery.NPC[k].location[2], Config.delivery.NPC[k].location[3] + 120, 0, 0, 0) + table.insert(deliveryNpcCached, Config.delivery.NPC[k].npc) end end) @@ -59,13 +20,13 @@ AddEvent("OnPlayerQuit", function(player) end) AddEvent("OnPlayerJoin", function(player) - CallRemoteEvent(player, "SetupDelivery", deliveryNpcCached, LOCATION_PRICE) + CallRemoteEvent(player, "SetupDelivery", deliveryNpcCached, Config.delivery.locationPrice) end) AddRemoteEvent("StartStopDelivery", function(player) local nearestDelivery = GetNearestDelivery(player) - local useBank = PlayerData[player].bank_balance >= LOCATION_PRICE - local useCash = PlayerData[player].inventory['cash'] ~= nil and PlayerData[player].inventory['cash'] >= LOCATION_PRICE + local useBank = PlayerData[player].bank_balance >= Config.delivery.locationPrice + local useCash = PlayerData[player].inventory['cash'] ~= nil and PlayerData[player].inventory['cash'] >= Config.delivery.locationPrice if PlayerData[player].job == "" then if PlayerData[player].job_vehicle ~= nil then @@ -86,7 +47,7 @@ AddRemoteEvent("StartStopDelivery", function(player) end for k, v in pairs(GetAllVehicles()) do local x, y, z = GetVehicleLocation(v) - local dist2 = GetDistance3D(deliveryNpc[nearestDelivery].spawn[1], deliveryNpc[nearestDelivery].spawn[2], deliveryNpc[nearestDelivery].spawn[3], x, y, z) + local dist2 = GetDistance3D(Config.delivery.NPC[nearestDelivery].spawn[1], Config.delivery.NPC[nearestDelivery].spawn[2], Config.delivery.NPC[nearestDelivery].spawn[3], x, y, z) if dist2 < 500.0 then isSpawnable = false break @@ -95,15 +56,15 @@ AddRemoteEvent("StartStopDelivery", function(player) if isSpawnable then if useBank then - PlayerData[player].bank_balance = PlayerData[player].bank_balance - LOCATION_PRICE + PlayerData[player].bank_balance = PlayerData[player].bank_balance - Config.delivery.locationPrice elseif useCash then - RemovePlayerCash(player, LOCATION_PRICE) + RemovePlayerCash(player, Config.delivery.locationPrice) else - CallRemoteEvent(player, "MakeErrorNotification", _("delivery_not_enough_location_cash", LOCATION_PRICE)) + CallRemoteEvent(player, "MakeErrorNotification", _("delivery_not_enough_location_cash", Config.delivery.locationPrice)) return end - local vehicle = CreateVehicle(24, deliveryNpc[nearestDelivery].spawn[1], deliveryNpc[nearestDelivery].spawn[2], deliveryNpc[nearestDelivery].spawn[3], deliveryNpc[nearestDelivery].spawn[4]) + local vehicle = CreateVehicle(24, Config.delivery.NPC[nearestDelivery].spawn[1], Config.delivery.NPC[nearestDelivery].spawn[2], Config.delivery.NPC[nearestDelivery].spawn[3], Config.delivery.NPC[nearestDelivery].spawn[4]) PlayerData[player].job_vehicle = vehicle CreateVehicleData(player, vehicle, 24) SetVehicleRespawnParams(vehicle, false) @@ -122,7 +83,7 @@ AddRemoteEvent("StartStopDelivery", function(player) local x, y, z = GetVehicleLocation(PlayerData[player].job_vehicle) local IsNearby = false - for k, v in pairs(deliveryNpc) do -- For each location npc + for k, v in pairs(Config.delivery.NPC) do -- For each location npc local dist = GetDistance3D(x, y, z, v.location[1], v.location[2], v.location[3]) if dist <= 2000 then -- if vehicle is nearby IsNearby = true @@ -130,7 +91,7 @@ AddRemoteEvent("StartStopDelivery", function(player) end if IsNearby then - local refund = LOCATION_PRICE * LOCATION_REFUND_PERCENTAGE + local refund = Config.delivery.locationPrice * Config.delivery.locationRefoundPercentage PlayerData[player].bank_balance = PlayerData[player].bank_balance + refund CallRemoteEvent(player, "MakeNotification", _("delivery_location_price_refunded", refund), "linear-gradient(to right, #00b09b, #96c93d)") else @@ -162,12 +123,12 @@ AddRemoteEvent("NextDelivery", function(player) return CallRemoteEvent(player, "MakeNotification", _("finish_your_delivery"), "linear-gradient(to right, #ff5f6d, #ffc371)") end delivery = {} - delivery[1] = Random(1, #deliveryPoint) + delivery[1] = Random(1, #Config.delivery.point) local x, y, z = GetPlayerLocation(player) - local dist = GetDistance3D(x, y, z, deliveryPoint[delivery[1]][1], deliveryPoint[delivery[1]][2], deliveryPoint[delivery[1]][3]) - delivery[2] = ((dist / 100) / PRICE_DIVIDER) * PRICE_PER_DIVIDE + local dist = GetDistance3D(x, y, z, Config.delivery.point[delivery[1]][1], Config.delivery.point[delivery[1]][2], Config.delivery.point[delivery[1]][3]) + delivery[2] = ((dist / 100) / Config.delivery.priceDivider) * Config.delivery.pricePerDivide playerDelivery[player] = delivery - CallRemoteEvent(player, "ClientCreateWaypoint", _("delivery"), deliveryPoint[delivery[1]][1], deliveryPoint[delivery[1]][2], deliveryPoint[delivery[1]][3]) + CallRemoteEvent(player, "ClientCreateWaypoint", _("delivery"), Config.delivery.point[delivery[1]][1], Config.delivery.point[delivery[1]][2], Config.delivery.point[delivery[1]][3]) CallRemoteEvent(player, "MakeNotification", _("new_delivery"), "linear-gradient(to right, #00b09b, #96c93d)") end) @@ -181,7 +142,7 @@ AddRemoteEvent("FinishDelivery", function(player) local x, y, z = GetPlayerLocation(player) - local dist = GetDistance3D(x, y, z, deliveryPoint[delivery[1]][1], deliveryPoint[delivery[1]][2], deliveryPoint[delivery[1]][3]) + local dist = GetDistance3D(x, y, z, Config.delivery.point[delivery[1]][1], Config.delivery.point[delivery[1]][2], Config.delivery.point[delivery[1]][3]) if dist < 150.0 then if PlayerData[player].job_vehicle ~= GetPlayerVehicle(player) then @@ -189,9 +150,9 @@ AddRemoteEvent("FinishDelivery", function(player) return end - CallRemoteEvent(player, "MakeNotification", _("finished_delivery", math.ceil(delivery[2]) or PRICE_PER_DIVIDE, _("currency")), "linear-gradient(to right, #00b09b, #96c93d)") + CallRemoteEvent(player, "MakeNotification", _("finished_delivery", math.ceil(delivery[2]) or Config.delivery.pricePerDivide, _("currency")), "linear-gradient(to right, #00b09b, #96c93d)") - AddPlayerCash(player, math.ceil(delivery[2]) or PRICE_PER_DIVIDE) + AddPlayerCash(player, math.ceil(delivery[2]) or Config.delivery.pricePerDivide) playerDelivery[player] = nil CallRemoteEvent(player, "ClientDestroyCurrentWaypoint") else @@ -207,7 +168,7 @@ function GetNearestDelivery(player) local dist = GetDistance3D(x, y, z, x2, y2, z2) if dist < 250.0 then - for k, i in pairs(deliveryNpc) do + for k, i in pairs(Config.delivery.NPC) do if v == i.npc then return k end diff --git a/package.json b/package.json index 6f15a095..cac384ff 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,9 @@ "config/config_Global.lua", "config/config_Jobs.lua", "config/config_vehicle.lua", + "config/config_Licenses.lua", + "config/config_Clothing.lua", + "config/config_Gather.lua", "misc/s_database.lua", "accounts/server.lua", "chat/server.lua", From e8e26c0af16c29fa493e0fc0400a2e1848f2369e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Brossard?= Date: Wed, 26 Feb 2020 17:57:10 +0100 Subject: [PATCH 06/16] Update config_Global.lua --- config/config_Global.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/config/config_Global.lua b/config/config_Global.lua index 126b9d0a..0da120df 100644 --- a/config/config_Global.lua +++ b/config/config_Global.lua @@ -1,5 +1,11 @@ - +-- Var define DON'T TOUCH Config = {} +Config.db = {} +Config.gasStation = {} +Config.delivery = {} +Config.Gather = {} +Config.clothing = {} +-------------------------- --+------------------------------------------+ --| Global | From 876ab87b17d78166cc1a4cf1f805cbc621e54336 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Brossard?= Date: Wed, 26 Feb 2020 18:50:27 +0100 Subject: [PATCH 07/16] Fix some shit that i've maked --- config/config_Global.lua | 42 ++++++++++++++++++++++++++------------ config/config_Jobs.lua | 4 ++-- config/config_Licenses.lua | 4 ++-- fuel/server.lua | 9 ++++---- medic/s_medic.lua | 12 +++++------ police/s_police.lua | 2 +- worldtime/server.lua | 6 +++--- 7 files changed, 48 insertions(+), 31 deletions(-) diff --git a/config/config_Global.lua b/config/config_Global.lua index 0da120df..709ecad5 100644 --- a/config/config_Global.lua +++ b/config/config_Global.lua @@ -129,21 +129,37 @@ Config.kilometerPrice = 2 -- set all bus stop Config.busStop = { - { x= 43977, y= 134767, z= 1567, labelArret= _("old_town") }, --Vieille ville - { x= -23335, y= -12534, z= 2081, labelArret= _("desert_town") }, --Ville du desert - { x= -162541, y= 79023, z= 1545, labelArret= _("prison") }, --Ville du desert - { x= -181984, y= -44583, z= 1149, labelArret= _("town") }, --Village - { x= -165259, y= -37945, z= 1149, labelArret= _("town").." 2" }, --Village - { x= 178654, y= 210121, z= 1314, labelArret= _("city").." 1" }, -- Ville - { x= 210387, y= 194379, z= 1310, labelArret= _("city").." 2" }, -- Ville - { x= 194706, y= 211555, z= 1310, labelArret= _("city").." 3" }, -- Ville - { x= 196929, y= 200157, z= 1309, labelArret= _("city").." 4" }, -- Ville - { x= 179352, y= 195067, z= 1310, labelArret= _("city").." 5" }, -- Ville - { x= 182731, y= 198008, z= 1310, labelArret= _("city").." 6" }, -- Ville - { x= 157242, y= 210114, z= 1310, labelArret= _("city").." 7" }, -- Ville - { x= 204877, y= 187104, z= 1312, labelArret= _("city").." 8" }, -- Ville + { x= 43977, y= 134767, z= 1567, labelArret= "old_town" }, --Vieille ville + { x= -23335, y= -12534, z= 2081, labelArret= "desert_town" }, --Ville du desert + { x= -162541, y= 79023, z= 1545, labelArret= "prison" }, --Ville du desert + { x= -181984, y= -44583, z= 1149, labelArret= "town" }, --Village + { x= -165259, y= -37945, z= 1149, labelArret= "town".." 2" }, --Village + { x= 178654, y= 210121, z= 1314, labelArret= "city".." 1" }, -- Ville + { x= 210387, y= 194379, z= 1310, labelArret= "city".." 2" }, -- Ville + { x= 194706, y= 211555, z= 1310, labelArret= "city".." 3" }, -- Ville + { x= 196929, y= 200157, z= 1309, labelArret= "city".." 4" }, -- Ville + { x= 179352, y= 195067, z= 1310, labelArret= "city".." 5" }, -- Ville + { x= 182731, y= 198008, z= 1310, labelArret= "city".." 6" }, -- Ville + { x= 157242, y= 210114, z= 1310, labelArret= "city".." 7" }, -- Ville + { x= 204877, y= 187104, z= 1312, labelArret= "city".." 8" }, -- Ville } +--Config.busStop = { +-- { x= 43977, y= 134767, z= 1567, labelArret= _("old_town") }, --Vieille ville +-- { x= -23335, y= -12534, z= 2081, labelArret= _("desert_town") }, --Ville du desert +-- { x= -162541, y= 79023, z= 1545, labelArret= _("prison") }, --Ville du desert +-- { x= -181984, y= -44583, z= 1149, labelArret= _("town") }, --Village +-- { x= -165259, y= -37945, z= 1149, labelArret= _("town").." 2" }, --Village +-- { x= 178654, y= 210121, z= 1314, labelArret= _("city").." 1" }, -- Ville +-- { x= 210387, y= 194379, z= 1310, labelArret= _("city").." 2" }, -- Ville +-- { x= 194706, y= 211555, z= 1310, labelArret= _("city").." 3" }, -- Ville +-- { x= 196929, y= 200157, z= 1309, labelArret= _("city").." 4" }, -- Ville +-- { x= 179352, y= 195067, z= 1310, labelArret= _("city").." 5" }, -- Ville +-- { x= 182731, y= 198008, z= 1310, labelArret= _("city").." 6" }, -- Ville +-- { x= 157242, y= 210114, z= 1310, labelArret= _("city").." 7" }, -- Ville +-- { x= 204877, y= 187104, z= 1312, labelArret= _("city").." 8" }, -- Ville +--} + -- add bus stop props if not on the map Config.addProp = { { x= 44159, y= 134743, z= 1467, ry= -3 }, --Vieille ville diff --git a/config/config_Jobs.lua b/config/config_Jobs.lua index 5ef96b57..779828cb 100644 --- a/config/config_Jobs.lua +++ b/config/config_Jobs.lua @@ -44,7 +44,7 @@ Config.Police = { -- how many medic at the same time Config.MaxMedic = 30 -- time before respawn -config.waitbeforerespawn = 30*60 -- 30 minutes +Config.waitbeforerespawn = 30*60 -- 30 minutes -- percentage of success revive Config.revivePercentSuccess = 40 -- time needed to revive someone @@ -67,7 +67,7 @@ Config.Medic = { {item = "adrenaline_syringe", qty = 5}, {item = "bandage", qty = 5}, {item = "health_kit", qty = 3}, - } + }, vehiclespawnLocation = { {x = 213325, y = 161177, z = 1305, h = -90}, diff --git a/config/config_Licenses.lua b/config/config_Licenses.lua index 2155c90a..00a076ed 100644 --- a/config/config_Licenses.lua +++ b/config/config_Licenses.lua @@ -8,12 +8,12 @@ Config.LicensesNpcLocation = { x = 169336, y = 193430, z = 1307, h = 180 } Config.Licenses = { - driver_license { + driver_license = { displayName = "Permis de conduire", price = 1500, illegal = false }, - gun_license { + gun_license = { displayName = "Permis de port d'arme", price = 6000, illegal = false diff --git a/fuel/server.lua b/fuel/server.lua index 09a1bee8..ae62f2b4 100644 --- a/fuel/server.lua +++ b/fuel/server.lua @@ -1,12 +1,13 @@ local _ = function(k,...) return ImportPackage("i18n").t(GetPackageName(),k,...) end GasStationCached = {} +local pickup = {} AddEvent("OnPackageStart", function() - for i,j in pairs(Config.gasStation.location.location) do - Config.gasStation.location.pickup[i] = CreatePickup(2 , Config.gasStation.location.location[i][1], Config.gasStation.location.location[i][2], Config.gasStation.location.location[i][3]) - CreateText3D( _("refuel").."\n".._("press_e"), 18, Config.gasStation.location.location[i][1], Config.gasStation.location.location[i][2], Config.gasStation.location.location[i][3] + 120, 0, 0, 0) - table.insert(GasStationCached, Config.gasStation.location.pickup[i]) + for i,j in pairs(Config.gasStation.location) do + pickup[i] = CreatePickup(2 , Config.gasStation.location[i][1], Config.gasStation.location[i][2], Config.gasStation.location[i][3]) + CreateText3D( _("refuel").."\n".._("press_e"), 18, Config.gasStation.location[i][1], Config.gasStation.location[i][2], Config.gasStation.location[i][3] + 120, 0, 0, 0) + table.insert(GasStationCached, pickup[i]) end CreateTimer(function() diff --git a/medic/s_medic.lua b/medic/s_medic.lua index b4411000..00e4d517 100644 --- a/medic/s_medic.lua +++ b/medic/s_medic.lua @@ -433,13 +433,13 @@ end) function MedicUseItem(player, item) if item == "health_kit" then -- PERSONNAL HEALTH KIT (Dont need to be medic) if GetPlayerHealth(player) < Config.medkitMaxheal then - CallRemoteEvent(player, "loadingbar:show", _("medic_item_use", _("health_kit")), Config.ItemTimeToUse = 5)-- LOADING BAR + CallRemoteEvent(player, "loadingbar:show", _("medic_item_use", _("health_kit")), Config.ItemTimeToUse)-- LOADING BAR SetPlayerAnimation(player, "COMBINE") local timer = CreateTimer(function() SetPlayerAnimation(player, "COMBINE") end, 2000) - Delay(Config.ItemTimeToUse = 5 * 1000, function() + Delay(Config.ItemTimeToUse * 1000, function() DestroyTimer(timer) SetPlayerAnimation(player, "STOP") SetPlayerHealth(player, GetPlayerHealth(player) + Config.medkitHeal) @@ -467,13 +467,13 @@ function MedicUseItem(player, item) return end if GetPlayerHealth(nearestPlayer) < Config.adrSyringeHeal then - CallRemoteEvent(player, "loadingbar:show", _("medic_item_use", _("adrenaline_syringe")), Config.ItemTimeToUse = 5)-- LOADING BAR + CallRemoteEvent(player, "loadingbar:show", _("medic_item_use", _("adrenaline_syringe")), Config.ItemTimeToUse)-- LOADING BAR SetPlayerAnimation(player, "COMBINE") local timer = CreateTimer(function() SetPlayerAnimation(player, "COMBINE") end, 2000) - Delay(Config.ItemTimeToUse = 5 * 1000, function() + Delay(Config.ItemTimeToUse * 1000, function() DestroyTimer(timer) SetPlayerAnimation(player, "STOP") SetPlayerHealth(nearestPlayer, Config.adrSyringeHeal) @@ -493,13 +493,13 @@ function MedicUseItem(player, item) return end if IsPlayerBleeding(nearestPlayer) then - CallRemoteEvent(player, "loadingbar:show", _("medic_item_use", _("bandage")), Config.ItemTimeToUse = 5)-- LOADING BAR + CallRemoteEvent(player, "loadingbar:show", _("medic_item_use", _("bandage")), Config.ItemTimeToUse)-- LOADING BAR SetPlayerAnimation(player, "COMBINE") local timer = CreateTimer(function() SetPlayerAnimation(player, "COMBINE") end, 2000) - Delay(Config.ItemTimeToUse = 5 * 1000, function() + Delay(Config.ItemTimeToUse * 1000, function() DestroyTimer(timer) SetPlayerAnimation(player, "STOP") StopBleedingForPlayer(nearestPlayer) diff --git a/police/s_police.lua b/police/s_police.lua index 7851e142..4b0a59af 100644 --- a/police/s_police.lua +++ b/police/s_police.lua @@ -201,7 +201,7 @@ function SpawnPoliceCar(player) end -- #2 Check if the player has a job vehicle spawned then destroy it - if PlayerData[player].job_vehicle ~= nil and Config.AllowVehicleRespawn = false then + if PlayerData[player].job_vehicle ~= nil and Config.AllowVehicleRespawn == false then DestroyVehicle(PlayerData[player].job_vehicle) DestroyVehicleData(PlayerData[player].job_vehicle) PlayerData[player].job_vehicle = nil diff --git a/worldtime/server.lua b/worldtime/server.lua index b1162da2..a086bb95 100644 --- a/worldtime/server.lua +++ b/worldtime/server.lua @@ -6,10 +6,10 @@ function OnPackageStart() end -- edited by wasied - if Config.worldTime < morning or Config.worldTime > evening then -- night - Config.worldTime = Config.worldTime + nightTime + if Config.worldTime < Config.morning or Config.worldTime > Config.evening then -- night + Config.worldTime = Config.worldTime + Config.nightTime else -- day - Config.worldTime = Config.worldTime + dayTime + Config.worldTime = Config.worldTime + Config.dayTime end -- From bbf38c874aab8003193610fd2eb545e3095d3cc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Brossard?= Date: Wed, 26 Feb 2020 19:22:19 +0100 Subject: [PATCH 08/16] and other shit --- config/config_Global.lua | 45 ++++++++++++++-------------------------- medic/s_damage.lua | 4 ++-- 2 files changed, 17 insertions(+), 32 deletions(-) diff --git a/config/config_Global.lua b/config/config_Global.lua index 709ecad5..dbdbf378 100644 --- a/config/config_Global.lua +++ b/config/config_Global.lua @@ -5,6 +5,7 @@ Config.gasStation = {} Config.delivery = {} Config.Gather = {} Config.clothing = {} +local _ = function(k,...) return ImportPackage("i18n").t(GetPackageName(),k,...) end -------------------------- --+------------------------------------------+ @@ -95,7 +96,7 @@ Config.backpackSlotToAdd = 35 Config.bleedingChance = 40 Config.InitialDamageToBleed = 1.5 -Config.DmamgePerTick = 1 +Config.DamagePerTick = 1 Config.BlledingDamageInterval = 5000 Config.BleedEffectAmount = 70 Config.tazerLockDuration = 10000 @@ -129,37 +130,21 @@ Config.kilometerPrice = 2 -- set all bus stop Config.busStop = { - { x= 43977, y= 134767, z= 1567, labelArret= "old_town" }, --Vieille ville - { x= -23335, y= -12534, z= 2081, labelArret= "desert_town" }, --Ville du desert - { x= -162541, y= 79023, z= 1545, labelArret= "prison" }, --Ville du desert - { x= -181984, y= -44583, z= 1149, labelArret= "town" }, --Village - { x= -165259, y= -37945, z= 1149, labelArret= "town".." 2" }, --Village - { x= 178654, y= 210121, z= 1314, labelArret= "city".." 1" }, -- Ville - { x= 210387, y= 194379, z= 1310, labelArret= "city".." 2" }, -- Ville - { x= 194706, y= 211555, z= 1310, labelArret= "city".." 3" }, -- Ville - { x= 196929, y= 200157, z= 1309, labelArret= "city".." 4" }, -- Ville - { x= 179352, y= 195067, z= 1310, labelArret= "city".." 5" }, -- Ville - { x= 182731, y= 198008, z= 1310, labelArret= "city".." 6" }, -- Ville - { x= 157242, y= 210114, z= 1310, labelArret= "city".." 7" }, -- Ville - { x= 204877, y= 187104, z= 1312, labelArret= "city".." 8" }, -- Ville + { x= 43977, y= 134767, z= 1567, labelArret= _("old_town") }, --Vieille ville + { x= -23335, y= -12534, z= 2081, labelArret= _("desert_town") }, --Ville du desert + { x= -162541, y= 79023, z= 1545, labelArret= _("prison") }, --Ville du desert + { x= -181984, y= -44583, z= 1149, labelArret= _("town") }, --Village + { x= -165259, y= -37945, z= 1149, labelArret= _("town").." 2" }, --Village + { x= 178654, y= 210121, z= 1314, labelArret= _("city").." 1" }, -- Ville + { x= 210387, y= 194379, z= 1310, labelArret= _("city").." 2" }, -- Ville + { x= 194706, y= 211555, z= 1310, labelArret= _("city").." 3" }, -- Ville + { x= 196929, y= 200157, z= 1309, labelArret= _("city").." 4" }, -- Ville + { x= 179352, y= 195067, z= 1310, labelArret= _("city").." 5" }, -- Ville + { x= 182731, y= 198008, z= 1310, labelArret= _("city").." 6" }, -- Ville + { x= 157242, y= 210114, z= 1310, labelArret= _("city").." 7" }, -- Ville + { x= 204877, y= 187104, z= 1312, labelArret= _("city").." 8" }, -- Ville } ---Config.busStop = { --- { x= 43977, y= 134767, z= 1567, labelArret= _("old_town") }, --Vieille ville --- { x= -23335, y= -12534, z= 2081, labelArret= _("desert_town") }, --Ville du desert --- { x= -162541, y= 79023, z= 1545, labelArret= _("prison") }, --Ville du desert --- { x= -181984, y= -44583, z= 1149, labelArret= _("town") }, --Village --- { x= -165259, y= -37945, z= 1149, labelArret= _("town").." 2" }, --Village --- { x= 178654, y= 210121, z= 1314, labelArret= _("city").." 1" }, -- Ville --- { x= 210387, y= 194379, z= 1310, labelArret= _("city").." 2" }, -- Ville --- { x= 194706, y= 211555, z= 1310, labelArret= _("city").." 3" }, -- Ville --- { x= 196929, y= 200157, z= 1309, labelArret= _("city").." 4" }, -- Ville --- { x= 179352, y= 195067, z= 1310, labelArret= _("city").." 5" }, -- Ville --- { x= 182731, y= 198008, z= 1310, labelArret= _("city").." 6" }, -- Ville --- { x= 157242, y= 210114, z= 1310, labelArret= _("city").." 7" }, -- Ville --- { x= 204877, y= 187104, z= 1312, labelArret= _("city").." 8" }, -- Ville ---} - -- add bus stop props if not on the map Config.addProp = { { x= 44159, y= 134743, z= 1467, ry= -3 }, --Vieille ville diff --git a/medic/s_damage.lua b/medic/s_damage.lua index bb2a70d7..1e903800 100644 --- a/medic/s_damage.lua +++ b/medic/s_damage.lua @@ -65,7 +65,7 @@ end function ApplyBleeding(player, damageAmount) local damages = (tonumber(damageAmount) / Config.InitialDamageToBleed) - local bleedingTime = math.ceil(damages / Config.DmamgePerTick)-- calculate the amount of time while the player will bleed + local bleedingTime = math.ceil(damages / Config.DamagePerTick)-- calculate the amount of time while the player will bleed -- Reset timer if another bleed occur if bleedingTimers[player] ~= nil then @@ -86,7 +86,7 @@ function ApplyBleeding(player, damageAmount) return end i = i + 1 - SetPlayerHealth(player, GetPlayerHealth(player) - Config.DmamgePerTick) + SetPlayerHealth(player, GetPlayerHealth(player) - Config.DamagePerTick) CallRemoteEvent(player, "damage:bleed:tickeffect", Config.BleedEffectAmount) for k, v in pairs(GetStreamedPlayersForPlayer(player)) do if IsValidPlayer(v) then From 52b3750001ad360f72501cb6e366dd67b3b1177d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Brossard?= Date: Wed, 26 Feb 2020 19:27:33 +0100 Subject: [PATCH 09/16] Update server.lua --- salary/server.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/salary/server.lua b/salary/server.lua index 6fd90888..550ad6f8 100644 --- a/salary/server.lua +++ b/salary/server.lua @@ -9,15 +9,18 @@ CreateTimer(function() -- THOSE HAS TO BE ORDER BY WAGE AMOUNT (desc) if PlayerData[player].job == "medic" then PlayerData[player].bank_balance = PlayerData[player].bank_balance + Config.MedicSalary + CallRemoteEvent(player, "MakeSuccessNotification", _("salary_notification", _("price_in_currency", tostring(Config.MedicSalary)))) elseif PlayerData[player].job == "police" then PlayerData[player].bank_balance = PlayerData[player].bank_balance + Config.PoliceSalary + CallRemoteEvent(player, "MakeSuccessNotification", _("salary_notification", _("price_in_currency", tostring(Config.PoliceSalary)))) elseif PlayerData[player].job ~= nil then PlayerData[player].bank_balance = PlayerData[player].bank_balance + JOB_WAGE + CallRemoteEvent(player, "MakeSuccessNotification", _("salary_notification", _("price_in_currency", tostring(JOB_WAGE)))) else PlayerData[player].bank_balance = PlayerData[player].bank_balance + Config.defaultSalary + CallRemoteEvent(player, "MakeSuccessNotification", _("salary_notification", _("price_in_currency", tostring(Config.defaultSalary)))) end - PlayerData[player].bank_balance = PlayerData[player].bank_balance + salary - CallRemoteEvent(player, "MakeSuccessNotification", _("salary_notification", _("price_in_currency", tostring(salary)))) + end end end, Config.salaryTime * 60000) \ No newline at end of file From 80963bc4fa9db575e37ff2a4bd77e31e637b8a17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Brossard?= Date: Wed, 26 Feb 2020 19:59:03 +0100 Subject: [PATCH 10/16] Update client.lua --- welcome/client.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/welcome/client.lua b/welcome/client.lua index 9481d39d..f84bb05d 100644 --- a/welcome/client.lua +++ b/welcome/client.lua @@ -10,7 +10,7 @@ local screenWidth, screenHeight = GetScreenSize() AddEvent("OnPackageStart", function() welcomeUI = CreateWebUI(0.0, 0.0, 0.0, 0.0, 1, 60) SetWebAnchors(welcomeUI, 0.0, 0.0, 1.0, 1.0) - LoadWebFile(welcomeUI, 'http://asset/' .. GetPackageName() .. '/welcome/index_'..Config.lang..'.html') + LoadWebFile(welcomeUI, 'http://asset/' .. GetPackageName() .. '/welcome/index_en.html') SetWebVisibility(welcomeUI, WEB_VISIBLE) end) From 34b8e23e2b5f8c062c033ec5c3f439acf47cdc18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Brossard?= Date: Wed, 26 Feb 2020 22:01:33 +0100 Subject: [PATCH 11/16] fix some stuff for Tweaks vehicles (#170) commit --- config/config_vehicle.lua | 14 +++++++++++++- vehicle/server.lua | 4 ++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/config/config_vehicle.lua b/config/config_vehicle.lua index 83b24afa..8b1091cd 100644 --- a/config/config_vehicle.lua +++ b/config/config_vehicle.lua @@ -14,7 +14,19 @@ Config.VehiclesColor = { red = "FF0000", blue = "0000FF", green = "00FF00", - orange = "FF6600" + orange = "971900", + vert_bambou = "001F09", + marron = "391c00", + bleu_galaxie = "010026", + rouge_bordeau = "1f0000", + rose = "ff15b5", + jaune = "c9be00", + turquoise = "00a47c", + blanc = "ffffff", + gris_clair = "787878", + gris_fonce = "262626", + gris_titanium = "0b0f14", + violet_fonce = "140019" } } diff --git a/vehicle/server.lua b/vehicle/server.lua index 50e616bd..93c9d75e 100644 --- a/vehicle/server.lua +++ b/vehicle/server.lua @@ -323,7 +323,7 @@ function getVehicleName(modelid) end function getVehiclePrice(modelid, cardealerobject) - for k, v in pairs(CarDealerTable) do + for k, v in pairs(Config.CarDealers) do if v.npc == cardealerobject then return(v.vehicles[modelid]) end @@ -331,7 +331,7 @@ function getVehiclePrice(modelid, cardealerobject) end function getVehicleColor(color, cardealerobject) - for k, v in pairs(CarDealerTable) do + for k, v in pairs(Config.CarDealers) do if v.npc == cardealerobject then return(v.colors[color]) end From faf81a28e8d3dc96933bdbfe83475f4dbafd17d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Brossard?= Date: Wed, 26 Feb 2020 22:09:18 +0100 Subject: [PATCH 12/16] Update server.lua --- delivery/server.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/delivery/server.lua b/delivery/server.lua index 52dbc8ae..9c13355e 100644 --- a/delivery/server.lua +++ b/delivery/server.lua @@ -65,6 +65,7 @@ AddRemoteEvent("StartStopDelivery", function(player) end local vehicle = CreateVehicle(24, Config.delivery.NPC[nearestDelivery].spawn[1], Config.delivery.NPC[nearestDelivery].spawn[2], Config.delivery.NPC[nearestDelivery].spawn[3], Config.delivery.NPC[nearestDelivery].spawn[4]) + SetVehicleLicensePlate(vehicle, genLicensePlate()) PlayerData[player].job_vehicle = vehicle CreateVehicleData(player, vehicle, 24) SetVehicleRespawnParams(vehicle, false) From 2c4016e11121136efe544bcb89ef390f994617f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Brossard?= Date: Wed, 26 Feb 2020 22:58:48 +0100 Subject: [PATCH 13/16] some Fix --- config/config_Global.lua | 5 +++ config/config_Jobs.lua | 2 +- config/config_vehicle.lua | 75 ++++++++++++++++++++++++++------------- inventory/server.lua | 73 ++++++++++++++++++++++--------------- 4 files changed, 101 insertions(+), 54 deletions(-) diff --git a/config/config_Global.lua b/config/config_Global.lua index dbdbf378..9d53236c 100644 --- a/config/config_Global.lua +++ b/config/config_Global.lua @@ -89,6 +89,8 @@ Config.whitelist = true Config.inventoryBaseMaxSlots = 50 Config.backpackSlotToAdd = 35 +Config.repairKitHealth = 2500 +Config.repairKitTime = 15 --+------------------------------------------+ --| Damage system | @@ -166,6 +168,9 @@ Config.usewhilegathering = false --| Fuel System | --+------------------------------------------+ +Config.gasStation.jericanCapacity = 50 +Config.gasStation.jericanTime = 15 + Config.gasStation.location = { { 127810, 78431, 1568 }, { 127446, 78415, 1568 }, diff --git a/config/config_Jobs.lua b/config/config_Jobs.lua index 779828cb..15ee710d 100644 --- a/config/config_Jobs.lua +++ b/config/config_Jobs.lua @@ -70,7 +70,7 @@ Config.Medic = { }, vehiclespawnLocation = { - {x = 213325, y = 161177, z = 1305, h = -90}, + {x = 208760, y = 154374, z = 1305, h = 90}, }, serviceNPC = { {x = 212493, y = 157096, z = 2780, h = 180}, diff --git a/config/config_vehicle.lua b/config/config_vehicle.lua index 8b1091cd..4b4e9ae8 100644 --- a/config/config_vehicle.lua +++ b/config/config_vehicle.lua @@ -116,151 +116,176 @@ Config.Vehicles = { vehicle_1 = { itemSpace = 205, price = 144572, - fuel = "fuel_1" + fuel = "fuel_1", + fuelCapacity = 100 }, vehicle_2 = { itemSpace = 50, price = 144572, - fuel = "fuel_1" + fuel = "fuel_1", + fuelCapacity = 100 }, vehicle_3 = { itemSpace = 80, price = 144572, - fuel = "fuel_1" + fuel = "fuel_1", + fuelCapacity = 100 }, vehicle_4 = { itemSpace = 215, price = 144572, - fuel = "fuel_1" + fuel = "fuel_1", + fuelCapacity = 100 }, vehicle_5 = { itemSpace = 205, price = 144572, - fuel = "fuel_1" + fuel = "fuel_1", + fuelCapacity = 100 }, vehicle_6 = { itemSpace = 90, price = 144572, - fuel = "fuel_1" + fuel = "fuel_1", + fuelCapacity = 100 }, vehicle_7 = { itemSpace = 315, price = 144572, - fuel = "fuel_1" + fuel = "fuel_1", + fuelCapacity = 100 }, vehicle_8 = { itemSpace = 50, price = 144572, - fuel = "fuel_1" + fuel = "fuel_1", + fuelCapacity = 100 }, vehicle_9 = { itemSpace = 10, price = 144572, - fuel = "fuel_1" + fuel = "fuel_1", + fuelCapacity = 100 }, vehicle_10 = { itemSpace = 10, price = 144572, - fuel = "fuel_1" + fuel = "fuel_1", + fuelCapacity = 100 }, vehicle_11 = { itemSpace = 140, price = 144572, - fuel = "fuel_1" + fuel = "fuel_1", + fuelCapacity = 100 }, vehicle_12 = { itemSpace = 100, price = 144572, - fuel = "fuel_1" + fuel = "fuel_1", + fuelCapacity = 100 }, vehicle_13 = { itemSpace = 100, price = 144572, - fuel = "fuel_1" + fuel = "fuel_1", + fuelCapacity = 100 }, vehicle_14 = { itemSpace = 100, price = 144572, - fuel = "fuel_1" + fuel = "fuel_1", + fuelCapacity = 100 }, vehicle_15 = { itemSpace = 100, price = 144572, - fuel = "fuel_1" + fuel = "fuel_1", + fuelCapacity = 100 }, vehicle_16 = { itemSpace = 100, price = 144572, - fuel = "fuel_1" + fuel = "fuel_1", + fuelCapacity = 100 }, vehicle_17 = { itemSpace = 540, price = 144572, - fuel = "fuel_1" + fuel = "fuel_1", + fuelCapacity = 100 }, vehicle_18 = { itemSpace = 540, price = 144572, - fuel = "fuel_1" + fuel = "fuel_1", + fuelCapacity = 100 }, vehicle_19 = { itemSpace = 205, price = 144572, - fuel = "fuel_1" + fuel = "fuel_1", + fuelCapacity = 100 }, vehicle_20 = { itemSpace = 10, price = 144572, - fuel = "fuel_1" + fuel = "fuel_1", + fuelCapacity = 100 }, vehicle_21 = { itemSpace = 100, price = 144572, - fuel = "fuel_1" + fuel = "fuel_1", + fuelCapacity = 100 }, vehicle_22 = { itemSpace = 475, price = 144572, - fuel = "fuel_1" + fuel = "fuel_1", + fuelCapacity = 100 }, vehicle_23 = { itemSpace = 475, price = 144572, - fuel = "fuel_1" + fuel = "fuel_1", + fuelCapacity = 100 }, vehicle_24 = { itemSpace = 10, price = 144572, - fuel = "fuel_1" + fuel = "fuel_1", + fuelCapacity = 100 }, vehicle_25 = { itemSpace = 160, price = 144572, - fuel = "fuel_1" + fuel = "fuel_1", + fuelCapacity = 100 } } diff --git a/inventory/server.lua b/inventory/server.lua index 37521466..d8691da6 100644 --- a/inventory/server.lua +++ b/inventory/server.lua @@ -199,46 +199,63 @@ AddRemoteEvent("UseInventory", function(player, originInventory, itemName, amoun UseItem(player, originInventory, item, amount) end if itemName == "repair_kit" then + if GetPlayerVehicle(player) ~= 0 then + CallRemoteEvent(player, "MakeErrorNotification", _("cant_while_driving")) + return + end local nearestCar = GetNearestCar(player) + if not IsValidVehicle(nearestCar) then return end if nearestCar ~= 0 then - if GetVehicleHealth(nearestCar) > 4000 then + if GetVehicleHealth(nearestCar) >= 5000 then CallRemoteEvent(player, "MakeErrorNotification", _("dont_need_repair")) - elseif GetVehicleHoodRatio(nearestCar) < 5 and GetVehicleModel(nearestCar) ~= 10 and GetVehicleModel(nearestCar) ~= 24 then - CallRemoteEvent(player, "MakeErrorNotification", _("need_to_open_hood")) else + RemoveInventory(originInventory, itemName, amount) CallRemoteEvent(player, "LockControlMove", true) SetPlayerAnimation(player, "COMBINE") - Delay(4000, function() - RemoveInventory(originInventory, itemName, amount) - SetVehicleHealth(nearestCar, 5000) - for i = 1, 8 do - SetVehicleDamage(nearestCar, i, 0) - end + SetPlayerBusy(player) + CallRemoteEvent(player, "loadingbar:show", _("repairing"), Config.repairKitTime)-- LOADING BAR + Delay(Config.repairKitTime * 1000, function() + SetVehicleHealth(nearestCar, GetVehicleHealth(nearestCar) + Config.repairKitHealth) + local percentOfDamage = (1 - (GetVehicleHealth(nearestCar) / 5000)) or 0.5 + if percentOfDamage < 0 then percentOfDamage = 0 end + if percentOfDamage > 1 then percentOfDamage = 1 end + for j = 1, 8 do + SetVehicleDamage(nearestCar, j, percentOfDamage) + end + if GetVehicleHealth(nearestCar) > 5000 then SetVehicleHealth(nearestCar, 5000) end CallRemoteEvent(player, "LockControlMove", false) SetPlayerAnimation(player, "STOP") + SetPlayerNotBusy(player) + CallRemoteEvent(player, "MakeNotification", _("repair_kit_vehicle_repaired"), "linear-gradient(to right, #00b09b, #96c93d)") end) end end end if itemName == "jerican" then - if GetPlayerState(player) >= 2 then - CallRemoteEvent(player, "MakeSuccessNotification", _("cant_while_driving")) - else - local nearestCar = GetNearestCar(player) - if nearestCar ~= 0 then - if VehicleData[nearestCar].fuel >= 100 then - CallRemoteEvent(player, "MakeErrorNotification", _("car_full")) - else - CallRemoteEvent(player, "LockControlMove", true) - SetPlayerAnimation(player, "COMBINE") - Delay(4000, function() - RemoveInventory(originInventory, itemName, amount) - VehicleData[nearestCar].fuel = 100 - CallRemoteEvent(player, "MakeSuccessNotification", _("car_refuelled")) - CallRemoteEvent(player, "LockControlMove", false) - SetPlayerAnimation(player, "STOP") - end) - end + if GetPlayerVehicle(player) ~= 0 then + CallRemoteEvent(player, "MakeErrorNotification", _("cant_while_driving")) + return + end + local nearestCar = GetNearestCar(player) + if not IsValidVehicle(nearestCar) then return end + if nearestCar ~= 0 then + if VehicleData[nearestCar].fuel >= 100 then + CallRemoteEvent(player, "MakeErrorNotification", _("car_full")) + else + RemoveInventory(originInventory, itemName, amount) + CallRemoteEvent(player, "LockControlMove", true) + SetPlayerAnimation(player, "COMBINE") + SetPlayerBusy(player) + CallRemoteEvent(player, "loadingbar:show", _("refuel"), Config.gasStation.jericanTime)-- LOADING BAR + Delay(Config.gasStation.jericanTime * 1000, function() + VehicleData[nearestCar].fuel = VehicleData[nearestCar].fuel + Config.gasStation.jericanCapacity + if VehicleData[nearestCar].fuel > 100 then VehicleData[nearestCar].fuel = 100 end + SetVehiclePropertyValue(nearestCar, "fuel", VehicleData[nearestCar].fuel, true) + CallRemoteEvent(player, "LockControlMove", false) + SetPlayerAnimation(player, "STOP") + SetPlayerNotBusy(player) + CallRemoteEvent(player, "MakeNotification", _("car_refuelled_for", Config.gasStation.jericanCapacity, 'L'), "linear-gradient(to right, #00b09b, #96c93d)") + end) end end end @@ -723,4 +740,4 @@ AddFunctionExport("RemovePlayerCash", RemovePlayerCash) AddFunctionExport("GetPlayerBag", GetPlayerBag) AddFunctionExport("GetPlayerMaxSlots", GetPlayerMaxSlots) AddFunctionExport("GetPlayerUsedSlots", GetPlayerUsedSlots) -AddFunctionExport("DisplayPlayerBackpack", DisplayPlayerBackpack) +AddFunctionExport("DisplayPlayerBackpack", DisplayPlayerBackpack) \ No newline at end of file From 7e38a1a787489afe731531cae8c5242621b29224 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Brossard?= Date: Thu, 27 Feb 2020 23:27:59 +0100 Subject: [PATCH 14/16] Update server.lua --- admin/server.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/server.lua b/admin/server.lua index 2a7b90f8..bd5fb16e 100644 --- a/admin/server.lua +++ b/admin/server.lua @@ -357,7 +357,7 @@ function CleanInventoryAndTpPlayer(player) end end - SetPlayerLocation(player, PLAYER_SPAWN_POINT.x, PLAYER_SPAWN_POINT.y, PLAYER_SPAWN_POINT.z) + SetPlayerLocation(player, Config.playerSpawnLocation.x, Config.playerSpawnLocation.y, Config.playerSpawnLocation.z) end function UnstuckUnderWaterPlayer(player, height) From abaf2e85e0bea18446d2be25196be44c8a110ec4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Brossard?= Date: Wed, 4 Mar 2020 15:04:30 +0100 Subject: [PATCH 15/16] Update config_Global.lua --- config/config_Global.lua | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/config/config_Global.lua b/config/config_Global.lua index 9d53236c..f951128e 100644 --- a/config/config_Global.lua +++ b/config/config_Global.lua @@ -112,13 +112,15 @@ Config.TazerEffectDuration = 20000 Config.radioBaseVolume = 0.2 -- set all radios available on the server Config.radioList = { - {label = "NCS #1", url = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://51.15.152.81:8947/listen.pls?sid=1&t=.pls"}, - {label = "NCS #2", url = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://91.121.113.129:9115/listen.pls?sid=1&t=.pls"}, - {label = "Metal", url = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://5.135.154.69:11590/listen.pls?sid=1&t=.pls"}, - {label = "Reggae", url = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://us5.internet-radio.com:8487/listen.pls&t=.pls"}, - {label = "Dance", url = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://pulseedm.cdnstream1.com:8124/1373_128.m3u&t=.pls"}, - {label = "Jazz", url = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://199.180.72.2:8015/listen.pls?sid=1&t=.pls"}, - {label = "Rap", url = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://192.211.51.158:8010/listen.pls?sid=1&t=.pls"}, + {label = "NoCopyrightSound Radio", url = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://51.15.152.81:8947/listen.pls?sid=1&t=.pls"}, + {label = "BELQC RADIO by Raph & Jeanmi (OnsetRP-FR Community)", url = "https://manager2.creativradio.com:2220/raphaelgonay/1/itunes.pls"}, + {label = "Metal - Idobi Howl", url = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://69.46.88.26:80/listen.pls&t=.pls"}, + {label = "Reggae - 24-7 Reggae", url = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://146.71.124.10:8200/listen.pls?sid=1&t=.pls"}, + {label = "House - BLUE MARLIN IBIZA RADIO", url = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://95.211.3.65:8635/listen.pls?sid=1&t=.pls"}, + {label = "Jazz - BEST SMOOTH JAZZ - UK (LONDON) HOST ROD LUCAS", url = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://64.95.243.43:8002/listen.pls?sid=1&t=.pls"}, + {label = "Latino - El Metro Salsero", url = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://198.178.123.14:7516/listen.pls?sid=1&t=.pls"}, + {label = "Hip Hop - FMHiphop.com", url = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://149.56.175.167:5708/listen.pls?sid=1&t=.pls"}, + {label = "Psytrance - psyradio * fm - progressive", url = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://81.88.36.42:8010/listen.pls?sid=1&t=.pls"} } --+------------------------------------------+ From 3a21d1d885c7ff3fe74ccdd8b247b942a83c4981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Brossard?= Date: Wed, 4 Mar 2020 16:02:05 +0100 Subject: [PATCH 16/16] Update server.lua --- admin/server.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/server.lua b/admin/server.lua index 5f1388f1..042dcbbc 100644 --- a/admin/server.lua +++ b/admin/server.lua @@ -119,7 +119,7 @@ function OnLogListLoadd(player, playersName) local action = result["action"] logList[tostring(id)] = action end - + CallRemoteEvent(player, "OpenAdminMenu", teleportPlace, playersNames, weaponList, vehicleList, logList) end