Config
Custom Name Town, Custom Job!
Lua Config
The Lua configuration file is where the server defines the town and job mappings. This configuration should also ensure that the town name and job name are tied together, so the server can perform actions based on these names (like fetching supplies, updating records, etc.).
CodexSupplies = {
--========================= Key Configuration =========================
Keys = {
-- Letter Keys
["A"] = 0x7065027D, ["B"] = 0x4CC0E2FE, ["C"] = 0x9959A6F0, ["D"] = 0xB4E465B4,
["E"] = 0xCEFD9220, ["F"] = 0xB2F377E8, ["G"] = 0x760A9C6F, ["H"] = 0x24978A28,
["I"] = 0xC1989F95, ["J"] = 0xF3830D8E, ["K"] = nil, ["L"] = 0x80F28E95,
["M"] = 0xE31C6A41, ["N"] = 0x4BC9DABB, ["O"] = 0xF1301666, ["P"] = 0xD82E0BD2,
["Q"] = 0xDE794E3E, ["R"] = 0xE30CD707, ["S"] = 0xD27782E3, ["T"] = nil,
["U"] = 0xD8F73058, ["V"] = 0x7F8D09B8, ["W"] = 0x8FD015D8, ["X"] = 0x8CC9CD42,
["Y"] = nil, ["Z"] = 0x26E9DC00,
-- Symbol Keys
["RIGHTBRACKET"] = 0xA5BDCD3C, ["LEFTBRACKET"] = 0x430593AA,
-- Mouse Buttons
["MOUSE1"] = 0x07CE1E61, ["MOUSE2"] = 0xF84FA74F, ["MOUSE3"] = 0xCEE12B50, ["MWUP"] = 0x3076E97C,
-- Modifier Keys
["CTRL"] = 0xDB096B85, ["TAB"] = 0xB238FE0B, ["SHIFT"] = 0x8FFC75D6, ["SPACEBAR"] = 0xD9D0E1C0,
["ENTER"] = 0xC7B5340A, ["BACKSPACE"] = 0x156F7119, ["LALT"] = 0x8AAA0AD4, ["DEL"] = 0x4AF4D473,
["PGUP"] = 0x446258B6, ["PGDN"] = 0x3C3DD371,
-- Function Keys
["F1"] = 0xA8E3F467, ["F4"] = 0x1F6D95E5, ["F6"] = 0x3C0A40F2,
-- Number Keys
["1"] = 0xE6F612E4, ["2"] = 0x1CE6D9EB, ["3"] = 0x4F49CC4C, ["4"] = 0x8F9F9E58,
["5"] = 0xAB62E997, ["6"] = 0xA1FDE2A6, ["7"] = 0xB03A913B, ["8"] = 0x42385422,
-- Arrow Keys
["DOWN"] = 0x05CA7C52, ["UP"] = 0x6319DB71, ["LEFT"] = 0xA65EBAB4, ["RIGHT"] = 0xDEB34313,
},
--========================= Global Configuration Settings =========================
-- Database connection configuration. Choose the SQL resource your server uses.
SQLResource = "ghmattimysql", -- Options: "ghmattimysql", "mysql-async", "oxmysql" (Recommended: "ghmattimysql") ๐พ -- CodexCore.ExecuteSql(query, params)
-- Whether or not to respond with errors when there is an issue with SQL operations
SQL_RespondError = 0, -- Set to 1 to show SQL error responses, set to 0 to disable error display
-- Enable/Disable developer mode (for debugging and development purposes)
DeveloperMode = true, -- Set to true if the server is in development mode โ๏ธ
-- Framework type your server is using
FrameWork = "VORP", -- Specify the framework for your server (e.g., "VORP" or others) ๐ ๏ธ
-- Menu configuration (change based on the menu system you are using)
MenuData = "menu_base", -- Options: "menu_base", "rsg-menubase", "menuapi" ๐
-- Blip for NPCs (used on the map to display NPC locations)
BlipSpriteIcon_npcs = 819673798, -- Icon for NPC blips on the map ๐
-- Whether resupplies are enabled for the game (this can be toggled on or off)
ReSupplier = true, -- Set to true to enable resupplies ๐ผ
-- Item name for resupplying (the item used to resupply the town)
ResupplierItem = "resupply_wood", -- Item used to resupply (e.g., "resupply_wood") ๐ฒ
-- NPC model for the resupply NPC
ResupplyNPC_Model = "amsp_robsdgunsmith_males_01", -- NPC model used for resupply missions ๐ค
-- Interaction button (the key that players must press to interact with the resupply mission)
InteractionButton = "G", -- Set to "G" for the 'G' key interaction ๐ค
-- NPC heading direction (the starting heading for the NPC at spawn)
NPCHeading = 319.46, -- The direction in which the NPC faces upon spawning ๐
-- Resupply multiplier (used to scale the resupply amounts)
ResupplyMultiplyer = 1, -- Multiplier for the resupply amount (default is 1) ๐
-- Minimum check for resupply (used to determine the minimum amount of supplies before resupplying)
ResupplyMinimumCheck = 25, -- Minimum number of supplies required before resupplying ๐งฎ
-- Maximum interaction distance (how close the player needs to be to interact with the resupply NPC)
MaxInteractDistance = 3, -- Maximum distance for NPC interaction (default is 3 meters) ๐
-- Resupply amount for a single interaction
ResupplySingle = 1, -- Amount of supplies given per interaction (default is 1) ๐
-- Amount of supplies removed per purchase
RemoveSuppliesPerBuy = 1, -- Number of supplies removed per purchase (default is 1) ๐
-- Disable headshot feature (if set to true, headshots will be disabled)
DisableHeadshot = true, -- Set to true to disable headshots ๐ซ
-- Job roles for town presidents (specific jobs that are allowed to manage the supplies)
TownJobMap = {
["Valentine"] = "valentinepresi",
["VanHorn"] = "vanhornpresi",
["TambleWeed"] = "tambleweedpresi",
["Strawberry"] = "strawberrypresi",
["Saint Denis"] = "sdpresi",
["Rhodes"] = "rhodespresi",
["BlackWater"] = "blackwaterpresi",
["Armadilo"] = "armadilopresi",
["AnnessBurg"] = "annessburgpresi"
},
-- Text that appears in 3D when interacting with the NPC
Text3D = "Press [G] to Manage Supplies", -- Prompt for players when near the resupply NPC ๐ฒ
-- Resupply position coordinates (where the resupply NPCs are located across the map)
ResupplyPos = {
["Coords"] = {
-- Position 1: Annesburg
[1] = {x = 2976.52, y = 1429.84, z = 44.62 , allowedjob = "annessburgpresi"},
-- Position 2: Saint Denis
[2] = {x = 2630.94, y = -1489.62, z = 45.87, allowedjob = "sdpresi"},
-- Position 3: Rhodes
[3] = {x = 1431.56, y = -1371.45, z = 81.65, allowedjob = "rhodespresi"},
-- Position 4: Blackwater
[4] = {x = -754.4, y = -1354.31, z = 43.41, allowedjob = "blackwaterpresi"},
-- Position 5: Strawberry
[5] = {x = -1833.77, y = -440.53, z = 159.72, allowedjob = "strawberrypresi"},
-- Position 6: Armadillo
[6] = {x = -3647.02, y = -2602.21, z = -13.06, allowedjob = "armadilopresi"},
-- Position 7: Tumbleweed
[7] = {x = -5499.3, y = -2339.61, z = 0.45, allowedjob = "tambleweedpresi"},
-- Position 8: Valentine
[8] = {x = -2720.92, y = -1666.0, z = 187.51, allowedjob = "valentinepresi"},
-- Position 9: VanHorn
[9] = {x = -2589.02, y = -1237.18, z = 86.91, allowedjob = "vanhornpresi"},
},
},
--======================== End of Configuration ========================
}
JS Config (Frontend)
The JS Config will contain the town names and job names that players can interact with. These values need to be dynamically updated or loaded from the server to ensure they stay consistent with the Lua configuration and SQL database.
const townAccessConfig = {
"Valentine": ["valentinepresi","president"],
"Saint Denis": ["sdpresi","president"],
"BlackWater": ["blackwaterpresi","president"],
"Rhodes": ["rhodespresi","president"],
"VanHorn": ["vanhornpresi","president"],
"AnnessBurg": ["annessburgpresi","president"],
"Armadilo": ["armadilopresi","president"],
"Strawberry": ["strawberrypresi","president"],
"TambleWeed": ["tambleweedpresi","president"]
};
How It All Works Together
JS Config: Defines the town and job that the player is interacting with.
Lua Config: Stores the logic and mappings, ensuring the job and town names match for functionality (e.g., fetching supplies).
SQL Database: Stores the actual data (supplies, jobs, towns) in a table, and the server queries this table based on the town and job names.
By ensuring the town name and job name are the same across all three components:
The JS Config (Frontend) provides the necessary data to interact with the server.
The Lua Config (Server-side) defines and enforces the rules around town-job mappings.
The SQL Tables store the real data that is tied to the town and job.
This synchronization ensures that all components work together correctly, and you don't run into any mismatches or errors.
Summary
JS Config: Defines which town and job the player is working with.
Lua Config: Ensures that the town and job names match, and enforces game logic for town supplies, etc.
SQL Tables: Stores and retrieves town and job-specific data, ensuring consistency between the other components.
Last updated
Was this helpful?