1
0
Fork 0
forked from Simnation/Main
This commit is contained in:
Nordi98 2025-07-14 18:34:49 +02:00
parent 19fb68f805
commit 01d047b3cc
53 changed files with 3222 additions and 5 deletions

View file

@ -0,0 +1,44 @@
local resourcePath = GetResourcePath(cache.resource):gsub('//', '/') .. '/'
local utils = {}
function utils.getFilesInDirectory(path, pattern)
local files = {}
local fileCount = 0
local system = os.getenv('OS')
local command = system and system:match('Windows') and 'dir "' or 'ls "'
local suffix = command == 'dir "' and '/" /b' or '/"'
local dir = io.popen(command .. resourcePath .. path .. suffix)
if dir then
for line in dir:lines() do
if line:match(pattern) then
fileCount += 1
files[fileCount] = line:gsub(pattern, '')
end
end
dir:close()
end
return files, fileCount
end
local frameworks = { 'es_extended', 'ND_Core', 'ox_core', 'qb-core' }
local sucess = false
for i = 1, #frameworks do
local framework = frameworks[i]
if GetResourceState(framework):find('start') then
require(('server.framework.%s'):format(framework:lower()))
sucess = true
break
end
end
if not sucess then
warn('no compatible framework was loaded, most features will not work')
end
return utils