diff --git a/admin/server.lua b/admin/server.lua index a984e529..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 @@ -359,7 +359,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) 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 new file mode 100644 index 00000000..f951128e --- /dev/null +++ b/config/config_Global.lua @@ -0,0 +1,262 @@ +-- Var define DON'T TOUCH +Config = {} +Config.db = {} +Config.gasStation = {} +Config.delivery = {} +Config.Gather = {} +Config.clothing = {} +local _ = function(k,...) return ImportPackage("i18n").t(GetPackageName(),k,...) end +-------------------------- + +--+------------------------------------------+ +--| 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, "", "", "" } +} + +--+------------------------------------------+ +--| 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 | +--+------------------------------------------+ + +-- 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 + + +--+------------------------------------------+ +--| Inventory System | +--+------------------------------------------+ + +Config.inventoryBaseMaxSlots = 50 +Config.backpackSlotToAdd = 35 +Config.repairKitHealth = 2500 +Config.repairKitTime = 15 + +--+------------------------------------------+ +--| Damage system | +--+------------------------------------------+ + +Config.bleedingChance = 40 +Config.InitialDamageToBleed = 1.5 +Config.DamagePerTick = 1 +Config.BlledingDamageInterval = 5000 +Config.BleedEffectAmount = 70 +Config.tazerLockDuration = 10000 +Config.TazerEffectDuration = 20000 + +--+------------------------------------------+ +--| Radios | +--+------------------------------------------+ + +-- Base volume for radio +Config.radioBaseVolume = 0.2 +-- set all radios available on the server +Config.radioList = { + {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"} +} + +--+------------------------------------------+ +--| 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 +} + +--+------------------------------------------+ +--| 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.jericanCapacity = 50 +Config.gasStation.jericanTime = 15 + +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" + } +} + +--+------------------------------------------+ +--| 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/config/config_Jobs.lua b/config/config_Jobs.lua new file mode 100644 index 00000000..15ee710d --- /dev/null +++ b/config/config_Jobs.lua @@ -0,0 +1,90 @@ +--+------------------------------------------+ +--| 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 | +--+------------------------------------------+ + +-- how many policemens at the same time +Config.MaxPolice = 30 +-- Number of handcuffs per players +Config.nbHandcuffs = 3 + +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}, + } +} + +--+------------------------------------------+ +--| 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 = 208760, y = 154374, 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..00a076ed --- /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 new file mode 100644 index 00000000..4b4e9ae8 --- /dev/null +++ b/config/config_vehicle.lua @@ -0,0 +1,291 @@ +--+------------------------------------------+ +--| 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 = "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" + } +} + +-- 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 = 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 = 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 = 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 + } +} + +-- 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 | +--+------------------------------------------+ + +Config.Vehicles = { + vehicle_1 = { + itemSpace = 205, + price = 144572, + fuel = "fuel_1", + fuelCapacity = 100 + }, + + vehicle_2 = { + itemSpace = 50, + price = 144572, + fuel = "fuel_1", + fuelCapacity = 100 + }, + + vehicle_3 = { + itemSpace = 80, + price = 144572, + fuel = "fuel_1", + fuelCapacity = 100 + }, + + vehicle_4 = { + itemSpace = 215, + price = 144572, + fuel = "fuel_1", + fuelCapacity = 100 + }, + + vehicle_5 = { + itemSpace = 205, + price = 144572, + fuel = "fuel_1", + fuelCapacity = 100 + }, + + vehicle_6 = { + itemSpace = 90, + price = 144572, + fuel = "fuel_1", + fuelCapacity = 100 + }, + + vehicle_7 = { + itemSpace = 315, + price = 144572, + fuel = "fuel_1", + fuelCapacity = 100 + }, + + vehicle_8 = { + itemSpace = 50, + price = 144572, + fuel = "fuel_1", + fuelCapacity = 100 + }, + + vehicle_9 = { + itemSpace = 10, + price = 144572, + fuel = "fuel_1", + fuelCapacity = 100 + }, + + vehicle_10 = { + itemSpace = 10, + price = 144572, + fuel = "fuel_1", + fuelCapacity = 100 + }, + + vehicle_11 = { + itemSpace = 140, + price = 144572, + fuel = "fuel_1", + fuelCapacity = 100 + }, + + vehicle_12 = { + itemSpace = 100, + price = 144572, + fuel = "fuel_1", + fuelCapacity = 100 + }, + + vehicle_13 = { + itemSpace = 100, + price = 144572, + fuel = "fuel_1", + fuelCapacity = 100 + }, + + vehicle_14 = { + itemSpace = 100, + price = 144572, + fuel = "fuel_1", + fuelCapacity = 100 + }, + + vehicle_15 = { + itemSpace = 100, + price = 144572, + fuel = "fuel_1", + fuelCapacity = 100 + }, + + vehicle_16 = { + itemSpace = 100, + price = 144572, + fuel = "fuel_1", + fuelCapacity = 100 + }, + + vehicle_17 = { + itemSpace = 540, + price = 144572, + fuel = "fuel_1", + fuelCapacity = 100 + }, + + vehicle_18 = { + itemSpace = 540, + price = 144572, + fuel = "fuel_1", + fuelCapacity = 100 + }, + + vehicle_19 = { + itemSpace = 205, + price = 144572, + fuel = "fuel_1", + fuelCapacity = 100 + }, + + vehicle_20 = { + itemSpace = 10, + price = 144572, + fuel = "fuel_1", + fuelCapacity = 100 + }, + + vehicle_21 = { + itemSpace = 100, + price = 144572, + fuel = "fuel_1", + fuelCapacity = 100 + }, + + vehicle_22 = { + itemSpace = 475, + price = 144572, + fuel = "fuel_1", + fuelCapacity = 100 + }, + + vehicle_23 = { + itemSpace = 475, + price = 144572, + fuel = "fuel_1", + fuelCapacity = 100 + }, + + vehicle_24 = { + itemSpace = 10, + price = 144572, + fuel = "fuel_1", + fuelCapacity = 100 + }, + + vehicle_25 = { + itemSpace = 160, + price = 144572, + fuel = "fuel_1", + fuelCapacity = 100 + } +} + diff --git a/delivery/server.lua b/delivery/server.lua index fab9216c..79e203bb 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,16 +56,16 @@ 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]) - SetVehicleLicensePlate(vehicle, genLicensePlate()) + 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) @@ -123,7 +84,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 @@ -131,7 +92,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 @@ -163,12 +124,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) @@ -182,7 +143,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 < 200.0 then if PlayerData[player].job_vehicle ~= GetPlayerVehicle(player) then @@ -190,9 +151,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 @@ -208,7 +169,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/fuel/server.lua b/fuel/server.lua index 6310967f..3ac7b25c 100644 --- a/fuel/server.lua +++ b/fuel/server.lua @@ -1,53 +1,13 @@ 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 = {} +local pickup = {} 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) 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() @@ -99,12 +59,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 e4894744..ec2a2015 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) @@ -178,7 +142,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 d766de5b..6ee5e10c 100644 --- a/gathering/s_gathering.lua +++ b/gathering/s_gathering.lua @@ -1,142 +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 = 30, 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 = -88620, y = -117082, z = 2396} - }, - gather_item = "coca_leaf", - gather_time = 7, - process_steps = { - { - step_zone = {x = -223006, y = 78605, z = 1625}, - step_require = "coca_leaf", - step_require_number = 3, - step_processed_item = "cocaine", - step_processed_item_number = 1, - step_process_time = 15, - } - }, - require_knowledge = true, - }, - {-- CANNABIBIL - gather_zone = { - {x = -98038, y = -66277, z = 4634} - }, - gather_item = "weed", - gather_time = 10, - require_knowledge = true, - gather_rp_props = { - {model = 64, x = -98290, y = -66618, z = 4598}, - {model = 65, x = -98019, y = -66558, z = 4591}, - {model = 64, x = -98197, y = -66257, z = 4542}, - {model = 65, x = -97982, y = -66069, z = 4508}, - {model = 64, x = -98420, y = -66071, z = 4592}, - {model = 65, x = -98544, y = -66525, z = 4600}, - {model = 64, x = -98158, y = -66921, z = 4660}, - {model = 65, x = -97786, y = -67232, z = 4772}, - {model = 64, x = -97533, y = -66824, z = 4696}, - } - }, - {-- 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 = 7, 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 = {} @@ -146,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 @@ -211,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)") @@ -219,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) @@ -243,9 +106,9 @@ end) function DoGathering(player, gather, antiglitchKey) local ableToGather = false - for k, v in pairs(gatherTable[gather].gatherPickup) do - local x, y, z = GetPickupLocation(v) - local x2, y2, z2 = GetPlayerLocation(player) + 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 ableToGather = true end @@ -256,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)") @@ -289,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 @@ -298,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) @@ -310,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 @@ -329,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) @@ -412,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 @@ -441,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 @@ -451,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 @@ -463,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 879b7353..a6d0b37b 100644 --- a/inventory/server.lua +++ b/inventory/server.lua @@ -1,14 +1,7 @@ local _ = function(k, ...) return ImportPackage("i18n").t(GetPackageName(), k, ...) end -local inventory_base_max_slots = 50 -local backpack_slot_to_add = 35 - -local REPAIR_KIT_HEALTH = 2500 -local REPAIR_KIT_TIME = 20 - local JERICAN_FUEL_AMOUNT = 50 local JERICAN_TIME = 15 - local droppedObjectsPickups = {} AddRemoteEvent("ServerPersonalMenu", function(player, inVehicle, vehiclSpeed) @@ -222,9 +215,9 @@ AddRemoteEvent("UseInventory", function(player, originInventory, itemName, amoun CallRemoteEvent(player, "LockControlMove", true) SetPlayerAnimation(player, "COMBINE") SetPlayerBusy(player) - CallRemoteEvent(player, "loadingbar:show", _("repairing"), REPAIR_KIT_TIME)-- LOADING BAR - Delay(REPAIR_KIT_TIME * 1000, function() - SetVehicleHealth(nearestCar, GetVehicleHealth(nearestCar) + REPAIR_KIT_HEALTH) + 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 @@ -255,15 +248,15 @@ AddRemoteEvent("UseInventory", function(player, originInventory, itemName, amoun CallRemoteEvent(player, "LockControlMove", true) SetPlayerAnimation(player, "COMBINE") SetPlayerBusy(player) - CallRemoteEvent(player, "loadingbar:show", _("refuel"), JERICAN_TIME)-- LOADING BAR - Delay(JERICAN_TIME * 1000, function() - VehicleData[nearestCar].fuel = VehicleData[nearestCar].fuel + JERICAN_FUEL_AMOUNT + 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", JERICAN_FUEL_AMOUNT, 'L'), "linear-gradient(to right, #00b09b, #96c93d)") + CallRemoteEvent(player, "MakeNotification", _("car_refuelled_for", Config.gasStation.jericanCapacity, 'L'), "linear-gradient(to right, #00b09b, #96c93d)") end) end end @@ -734,9 +727,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 @@ -787,4 +780,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 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..1e903800 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.DamagePerTick)-- 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.DamagePerTick) + 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 a9f8c7e9..7528353c 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 = 208760, y = 154374, 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) @@ -256,7 +209,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 @@ -347,13 +300,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") @@ -363,7 +316,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) @@ -409,13 +362,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") @@ -437,13 +390,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 @@ -480,18 +433,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)-- LOADING BAR SetPlayerAnimation(player, "COMBINE") local timer = CreateTimer(function() SetPlayerAnimation(player, "COMBINE") end, 2000) - Delay(ITEM_TIME_TO_USE * 1000, function() + Delay(Config.ItemTimeToUse * 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) @@ -514,17 +467,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)-- LOADING BAR SetPlayerAnimation(player, "COMBINE") local timer = CreateTimer(function() SetPlayerAnimation(player, "COMBINE") end, 2000) - Delay(ITEM_TIME_TO_USE * 1000, function() + Delay(Config.ItemTimeToUse * 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)") @@ -541,13 +494,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)-- LOADING BAR SetPlayerAnimation(player, "COMBINE") local timer = CreateTimer(function() SetPlayerAnimation(player, "COMBINE") end, 2000) - Delay(ITEM_TIME_TO_USE * 1000, function() + Delay(Config.ItemTimeToUse * 1000, function() DestroyTimer(timer) SetPlayerAnimation(player, "STOP") StopBleedingForPlayer(nearestPlayer) @@ -569,7 +522,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 <= 10000 then closestSpawnPoint = k @@ -591,7 +544,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) diff --git a/package.json b/package.json index dd06a2bb..468809b5 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,12 @@ "author": "Frédéric C. - Frederic2ec", "version": "1.0", "server_scripts": [ + "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", diff --git a/police/s_police.lua b/police/s_police.lua index 20f6278a..8ba45c72 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,30 @@ 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 +86,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 +135,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 +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 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 +209,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) @@ -277,7 +248,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) @@ -543,7 +514,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 f9191ac6..393bd51a 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 = 20 - -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,19 +8,19 @@ 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 - CallRemoteEvent(player, "MakeSuccessNotification", _("salary_notification", _("price_in_currency", tostring(MEDIC_WAGE)))) + 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 + POLICE_WAGE - CallRemoteEvent(player, "MakeSuccessNotification", _("salary_notification", _("price_in_currency", tostring(POLICE_WAGE)))) + 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 + MINIMUM_WAGE - CallRemoteEvent(player, "MakeSuccessNotification", _("salary_notification", _("price_in_currency", tostring(MINIMUM_WAGE)))) + PlayerData[player].bank_balance = PlayerData[player].bank_balance + Config.defaultSalary + CallRemoteEvent(player, "MakeSuccessNotification", _("salary_notification", _("price_in_currency", tostring(Config.defaultSalary)))) end end end -end, minutes * 60000) +end, Config.salaryTime * 60000) 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 95013600..ab519ffa 100644 --- a/stylist/server.lua +++ b/stylist/server.lua @@ -7,9 +7,6 @@ StylistNPCTable = { } -- location = { 180845, 182506, 1290, 180} -- } -- } - -PLAYER_SPAWN_POINT = { x = 204094, y = 180846, z = 1500 } - -- Event ---------------------------------------------------- AddEvent("OnPackageStart", function() @@ -103,7 +100,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 2a2d3701..f5b60192 100644 --- a/vehicle/server.lua +++ b/vehicle/server.lua @@ -235,7 +235,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 }) @@ -333,7 +333,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 @@ -341,7 +341,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 @@ -353,7 +353,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 a96bd32b..36e40fa1 100644 --- a/vehicle_dealer/server.lua +++ b/vehicle_dealer/server.lua @@ -2,65 +2,8 @@ local _ = function(k,...) return ImportPackage("i18n").t(GetPackageName(),k,...) CarDealerObjectsCached = { } -CarDefaultColors = { - black = "0000", - red = "FF0000", - blue = "0000FF", - green = "00FF00", - 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" -} - -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) @@ -82,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 @@ -96,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 @@ -132,7 +75,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 36b773d1..d5594def 100644 --- a/vehicle_radio/s_vehicleradio.lua +++ b/vehicle_radio/s_vehicleradio.lua @@ -1,23 +1,10 @@ sr = ImportPackage("soundstreamer") local _ = function(k, ...) return ImportPackage("i18n").t(GetPackageName(), k, ...) end -local Radios = { - {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"} -} - 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() @@ -51,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 @@ -80,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 @@ -92,13 +79,14 @@ 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) + Delay(500, function() - 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..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_fr.html') + LoadWebFile(welcomeUI, 'http://asset/' .. GetPackageName() .. '/welcome/index_en.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..a086bb95 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 < Config.morning or Config.worldTime > Config.evening then -- night + Config.worldTime = Config.worldTime + Config.nightTime else -- day - worldTime = worldTime + dayTime + Config.worldTime = Config.worldTime + Config.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)