mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-28 17:01:14 +00:00
feat(esx_lib): add isEnhanced game edition detection
xLib.isEnhanced() returns whether the game runs GTA V Enhanced (server: gamename convar, client: IsGameEnhancedVersion native). es_extended reads it once and requires OneSync Infinity on Legacy only, since Enhanced runs OneSync natively.
This commit is contained in:
@@ -2,6 +2,7 @@ SetMapName("San Andreas")
|
||||
SetGameType("ESX Legacy")
|
||||
|
||||
local oneSyncState = GetConvar("onesync", "off")
|
||||
local isEnhanced = xLib.isEnhanced()
|
||||
local newPlayer = "INSERT INTO `users` SET `accounts` = ?, `identifier` = ?, `ssn` = ?, `group` = ?"
|
||||
local loadPlayer = "SELECT `accounts`, `ssn`, `job`, `job_grade`, `group`, `position`, `inventory`, `skin`, `loadout`, `metadata`"
|
||||
|
||||
@@ -151,7 +152,7 @@ if not Config.Multichar then
|
||||
return deferrals.done(("[ESX] ESX Requires a minimum Artifact version of 10188, Please update your server."))
|
||||
end
|
||||
|
||||
if oneSyncState == "off" or oneSyncState == "legacy" then
|
||||
if not isEnhanced and (oneSyncState == "off" or oneSyncState == "legacy") then
|
||||
return deferrals.done(("[ESX] ESX Requires Onesync Infinity to work. This server currently has Onesync set to: %s"):format(oneSyncState))
|
||||
end
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
local ENHANCED_GAME_NAMES <const> = {
|
||||
["gta5enhanced"] = true,
|
||||
["gta5_enhanced"] = true
|
||||
}
|
||||
|
||||
local isEnhanced
|
||||
|
||||
if IsDuplicityVersion() then
|
||||
isEnhanced = ENHANCED_GAME_NAMES[GetConvar("gamename", "gta5")] == true
|
||||
else
|
||||
isEnhanced = type(IsGameEnhancedVersion) == "function" and IsGameEnhancedVersion() == true
|
||||
end
|
||||
|
||||
---@return boolean
|
||||
return function()
|
||||
return isEnhanced
|
||||
end
|
||||
Reference in New Issue
Block a user