Skip to content

feat(es_extended): Dynamic Settings to replace Configs#1611

Closed
Mycroft-Studios wants to merge 12 commits intoesx-framework:devfrom
Mycroft-Studios:server-management
Closed

feat(es_extended): Dynamic Settings to replace Configs#1611
Mycroft-Studios wants to merge 12 commits intoesx-framework:devfrom
Mycroft-Studios:server-management

Conversation

@Mycroft-Studios
Copy link
Copy Markdown
Contributor

@Mycroft-Studios Mycroft-Studios commented Feb 10, 2025

Description

This PR replaces static lua configs, with Dynamic Settings, that can be changed in game, allowing for much easier setup
This will integrate into the Pause Menu and other upcoming features in projects


Motivation

Making ESX easier to use, for all users.


Implementation Details

  • Adds a Settings Handler to the Server
  • Adds a Settings Handler to the Client
  • Syncs changes to the client, from the server
  • Stores Settings in a JSON, for those that wish to still edit the files
  • Allows Getting Other Resources settings, but only setting your own.

Usage Example

Client

local useAimAssist = ESX.GetSetting("AimAssist") -- for same resource Settings
local UIColour = ESX.GetResourceSetting("es_extended", "UIColour") -- for other resources Settings

AddEventHandler("es_extended:settingChanged", function(resource, category, key, value)
     print(("Setting changed: ^5%s^7, ^5%s^7, ^5%s^7, ^5%s^7"):format(resource, category, key, value))
end)

Server

ESX.RegisterSetting("Key", "Label", "Category",  false) -- Register a Setting
local useAimAssist = ESX.GetSetting("AimAssist") -- for same resource Settings
local UIColour = ESX.GetResourceSetting("es_extended", "UIColour") -- for other resources Settings
ESX.SetSetting("AimAssist", false) -- Set your own Resources settings

AddEventHandler("es_extended:settingChanged", function(resource, category, key, value)
     print(("Setting changed: ^5%s^7, ^5%s^7, ^5%s^7, ^5%s^7"):format(resource, category, key, value))
end)

Commands

  • /changeSetting resource settingKey value
    • Example: /changeSetting es_extended AimAssist false
    • Output: [Info] Setting AimAssist changed to false for es_extended
  • /checkSetting resource settingKey
    • Example: /checkSetting es_extended AimAssist
    • Output: [Info] Setting es_extended - AimAssist: false

PR Checklist

  • My commit messages and PR title follow the Conventional Commits standard.
  • My changes have been tested locally and function as expected.
  • My PR does not introduce any breaking changes.
  • I have provided a clear explanation of what my PR does, including the reasoning behind the changes and any relevant context.

@Kenshiin13 Kenshiin13 marked this pull request as draft March 9, 2025 22:16
@Kenshiin13
Copy link
Copy Markdown
Contributor

Stale PR

@Kenshiin13 Kenshiin13 closed this Jun 11, 2025
@github-project-automation github-project-automation bot moved this from In-Development to Recycle Bin in ESX Roadmap Jun 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Recycle Bin

Development

Successfully merging this pull request may close these issues.

2 participants