diff --git a/lua/autorun/gmod_integration.lua b/lua/autorun/gmod_integration.lua index f949d39..7996893 100644 --- a/lua/autorun/gmod_integration.lua +++ b/lua/autorun/gmod_integration.lua @@ -1,8 +1,13 @@ if game.SinglePlayer() then return print("Gmod Integration is not supported in Singleplayer!") end local alreadyLoadGMI = gmInte +local function dllInstalled() + return file.Exists("lua/bin/gmsv_gmod_integration_loader_linux.dll", "GAME") || file.Exists("gmsv_gmod_integration_loader_linux64.dll", "GAME") || file.Exists("lua/bin/gmsv_gmod_integration_loader_win32.dll", "GAME") || file.Exists("gmsv_gmod_integration_loader_win64.dll", "GAME") +end + local isLatest = debug.getinfo(1, "S").source == "@addons/_gmod_integration_latest/lua/autorun/_gmod_integration_latest.lua" +local isLatestExist = file.Exists("addons/_gmod_integration_latest/lua/autorun/_gmod_integration_latest.lua", "LUA") if !alreadyLoadGMI then - if file.Exists("lua/bin/gmsv_gmod_integration_loader_linux.dll", "GAME") then + if dllInstalled() then if !file.Exists("gm_integration", "DATA") || !file.Exists("gm_integration/tmp.json", "DATA") then file.CreateDir("gm_integration") end file.Write("gm_integration/tmp.json", util.TableToJSON({ gmod_integration_latest_updated = false, @@ -24,13 +29,14 @@ if !alreadyLoadGMI then if !isLatest then return end end else - if !isLatest then return end + if !isLatest && isLatestExist then return end end gmInte = gmInte || {} gmInte.version = "5.0.6" // This will be automatically updated by GitHub Actions gmInte.config = {} gmInte.useDataConfig = true +gmInte.dllInstalled = dllInstalled function gmInte.log(msg, onlyOndebug) if onlyOndebug && !gmInte.config.debug then return end print(" | " .. os.date(gmInte.config.logTimestamp || "%Y-%m-%d %H:%M:%S") .. " | Gmod Integration | " .. msg) @@ -139,7 +145,7 @@ else print(" ") end -gmInte.execFolder = debug.getinfo(1, "S").source:match("/(.+)/(.+)/(.+)/") || "gmod_integration" +gmInte.execFolder = debug.getinfo(1, "S").source:match("([^/\\]+)$"):gsub("%.lua$", "") || "gmod_integration" loadFile(gmInte.execFolder, "sv_config.lua") loadFolder(gmInte.execFolder .. "/languages") loadFolder(gmInte.execFolder .. "/core/utils") diff --git a/lua/gmod_integration/core/config/cl_admin_menu.lua b/lua/gmod_integration/core/config/cl_admin_menu.lua index aa0f4ec..55b3fc2 100644 --- a/lua/gmod_integration/core/config/cl_admin_menu.lua +++ b/lua/gmod_integration/core/config/cl_admin_menu.lua @@ -447,6 +447,42 @@ function gmInte.openConfigMenu(data) end end +local alreadySkipDll = false +function gmInte.openDllInstall() + if !LocalPlayer():gmIntIsAdmin() then return end + if alreadySkipDll then return end + alreadySkipDll = true + local frame = vgui.Create("DFrame") + frame:SetSize(400, 250) + frame:Center() + frame:SetTitle(gmInte.getFrameName(gmInte.getTranslation("admin.dll_install", "DLL Install"))) + frame:SetDraggable(true) + frame:ShowCloseButton(true) + frame:MakePopup() + gmInte.applyPaint(frame) + local messageLabel = vgui.Create("DLabel", frame) + messageLabel:Dock(FILL) + messageLabel:SetText(gmInte.getTranslation("admin.dll_install_problem", "The Gmod Integration DLL is missing!\n\nWithout this DLL, some features will not work correctly, including authentication and advanced integration.") .. "\n\n" .. gmInte.getTranslation("admin.dll_install_description", "Install:\n1. Download 'gmsv_gmod_integration_loader_{1}.dll' from: {2}\n2. Move it to the 'garrysmod/lua/bin' folder.\n3. Restart your server.", gmInte.serverOS, "https://github.com/gmod-integration/auto-loader/releases")) + messageLabel:SetContentAlignment(5) + messageLabel:SetWrap(true) + local buttonGrid = vgui.Create("DGrid", frame) + buttonGrid:Dock(BOTTOM) + buttonGrid:DockMargin(5, 10, 5, 5) + buttonGrid:SetCols(1) + buttonGrid:SetColWide(frame:GetWide() - 10) + buttonGrid:SetRowHeight(35) + local button = vgui.Create("DButton") + button:SetText(gmInte.getTranslation("admin.dll_install_button", "Install DLL")) + button.DoClick = function() + frame:Close() + gui.OpenURL("https://github.com/gmod-integration/auto-loader/releases") + end + + button:SetSize(buttonGrid:GetColWide() - 10, buttonGrid:GetRowHeight()) + gmInte.applyPaint(button) + buttonGrid:AddItem(button) +end + function gmInte.openAdminConfig() if !LocalPlayer():gmIntIsAdmin() then gmInte.chatAddText(Color(228, 81, 81), gmInte.getTranslation("chat.missing_permissions", "You do not have permission to do this action.")) diff --git a/lua/gmod_integration/core/config/sv_settings.lua b/lua/gmod_integration/core/config/sv_settings.lua index 577a490..3716997 100644 --- a/lua/gmod_integration/core/config/sv_settings.lua +++ b/lua/gmod_integration/core/config/sv_settings.lua @@ -73,6 +73,8 @@ function gmInte.publicGetConfig(ply) ["other"] = { ["aprovedCredentials"] = gmInte.aprovedCredentials, ["version"] = gmInte.version, + ["dllExists"] = gmInte.dllInstalled(), + ["serverOS"] = gmInte.detectOS(), } }, ply) end diff --git a/lua/gmod_integration/core/net/cl_net.lua b/lua/gmod_integration/core/net/cl_net.lua index 17a78c8..24260f0 100644 --- a/lua/gmod_integration/core/net/cl_net.lua +++ b/lua/gmod_integration/core/net/cl_net.lua @@ -13,6 +13,8 @@ local netReceive = { ["publicConfig"] = function(data) gmInte.config = table.Merge(gmInte.config, data.config) gmInte.version = data.other.version + gmInte.serverOS = data.other.serverOS + if !gmInte.dllExists then gmInte.openDllInstall() end gmInte.loadTranslations() if gmInte.config.clientBranch != "any" && gmInte.config.clientBranch != BRANCH then gmInte.openWrongBranchPopup() end if !data.other.aprovedCredentials then RunConsoleCommand("gmod_integration_admin") end diff --git a/lua/gmod_integration/core/utils/sv_main.lua b/lua/gmod_integration/core/utils/sv_main.lua new file mode 100644 index 0000000..2b1ad1b --- /dev/null +++ b/lua/gmod_integration/core/utils/sv_main.lua @@ -0,0 +1,17 @@ +function gmInte.detectOS() + if system.IsWindows() then + return "win" .. (jit && jit.arch == "x64" && "64" || "") + elseif system.IsLinux() then + return "linux" .. (jit && jit.arch == "x64" && "64" || "") + else + return "unknown" + end +end + +timer.Create("gmInte:CheckDLL", 30, 0, function() + if !gmInte.dllInstalled() && !gmInte.debug then + print(" ") + print(gmInte.getTranslation("admin.dll_install_problem", "The Gmod Integration DLL is missing!\n\nWithout this DLL, some features will not work correctly, including authentication and advanced integration.") .. "\n\n" .. gmInte.getTranslation("admin.dll_install_description", "Install:\n1. Download 'gmsv_gmod_integration_loader_{1}.dll' from: {2}\n2. Move it to the 'garrysmod/lua/bin' folder.\n3. Restart your server.", gmInte.detectOS(), "https://github.com/gmod-integration/auto-loader/releases")) + print(" ") + end +end) \ No newline at end of file diff --git a/lua/gmod_integration/languages/sh_de.lua b/lua/gmod_integration/languages/sh_de.lua index 818cb66..769522c 100644 --- a/lua/gmod_integration/languages/sh_de.lua +++ b/lua/gmod_integration/languages/sh_de.lua @@ -104,5 +104,6 @@ return { ["verification.verifyFamilySharing_description"] = "Blockiere Spieler, die Family Sharing verwenden.", ["admin.config_disabled_description"] = "Die Konfiguration wurde deaktiviert, da die Standarddatei sv_config.lua bearbeitet wurde.\nBitte stelle die Standarddatei sv_config.lua wieder her, um die Konfiguration erneut zu aktivieren.", ["admin.config_disabled"] = "Konfiguration Deaktiviert", + ["admin.dll_install_problem"] = "Die Gmod Integration DLL fehlt!\n\nOhne diese DLL funktionieren einige Funktionen nicht korrekt, einschließlich Authentifizierung und erweiterte Integration.", ["chat.error.rate_limit"] = "Diese Interaktion wird durch Geschwindigkeitsbegrenzung eingeschränkt, bitte versuchen Sie es später erneut." } \ No newline at end of file diff --git a/lua/gmod_integration/languages/sh_en.lua b/lua/gmod_integration/languages/sh_en.lua index b58766a..159a066 100644 --- a/lua/gmod_integration/languages/sh_en.lua +++ b/lua/gmod_integration/languages/sh_en.lua @@ -104,5 +104,6 @@ return { ["verification.verifyFamilySharing"] = "Block Family Sharing", ["verification.family_shariverifyFamilySharing_descriptionng"] = "Block family sharing players.", ["admin.config_disabled_description"] = "The config has been disabled because the default sv_config.lua has been edited.\nPlease restore the default sv_config.lua to enable the config again.", - ["admin.config_disabled"] = "Config Disabled" + ["admin.config_disabled"] = "Config Disabled", + ["admin.dll_install_problem"] = "The Gmod Integration DLL is missing!\n\nWithout this DLL, some features will not work correctly, including authentication and advanced integration." } \ No newline at end of file diff --git a/lua/gmod_integration/languages/sh_es.lua b/lua/gmod_integration/languages/sh_es.lua index 8c9d4a2..0725bd4 100644 --- a/lua/gmod_integration/languages/sh_es.lua +++ b/lua/gmod_integration/languages/sh_es.lua @@ -104,5 +104,6 @@ return { ["verification.family_sharing_description"] = "Bloquear jugadores que usan el uso compartido familiar.", ["admin.config_disabled_description"] = "La configuración ha sido deshabilitada porque el archivo sv_config.lua predeterminado ha sido editado.\nPor favor, restaura el archivo sv_config.lua predeterminado para habilitar la configuración nuevamente.", ["admin.config_disabled"] = "Configuración Deshabilitada", + ["admin.dll_install_problem"] = "¡Falta la DLL de Gmod Integration!\n\nSin esta DLL, algunas características no funcionarán correctamente, incluyendo la autenticación y la integración avanzada.", ["chat.error.rate_limit"] = "Esta interacción está limitada por velocidad, por favor inténtalo más tarde." } \ No newline at end of file diff --git a/lua/gmod_integration/languages/sh_fr.lua b/lua/gmod_integration/languages/sh_fr.lua index ac95704..044a846 100644 --- a/lua/gmod_integration/languages/sh_fr.lua +++ b/lua/gmod_integration/languages/sh_fr.lua @@ -104,5 +104,6 @@ return { ["verification.verifyFamilySharing_description"] = "Bloquer les joueurs utilisant le partage familial.", ["admin.config_disabled_description"] = "La configuration a été désactivée car le fichier sv_config.lua par défaut a été modifié.\nVeuillez restaurer le fichier sv_config.lua par défaut pour réactiver la configuration.", ["admin.config_disabled"] = "Configuration Désactivée", + ["admin.dll_install_problem"] = "La DLL Gmod Integration est manquante !\n\nSans cette DLL, certaines fonctionnalités ne fonctionneront pas correctement, y compris l'authentification et l'intégration avancée.", ["chat.error.rate_limit"] = "Cette interaction est limitée par la vitesse, veuillez réessayer plus tard." } \ No newline at end of file diff --git a/lua/gmod_integration/languages/sh_it.lua b/lua/gmod_integration/languages/sh_it.lua index 3c02a5e..58df891 100644 --- a/lua/gmod_integration/languages/sh_it.lua +++ b/lua/gmod_integration/languages/sh_it.lua @@ -104,5 +104,6 @@ return { ["verification.verifyFamilySharing_description"] = "Blocca i giocatori che utilizzano la condivisione familiare.", ["admin.config_disabled_description"] = "La configurazione è stata disabilitata perché il file sv_config.lua predefinito è stato modificato.\nRipristina il file sv_config.lua predefinito per abilitare nuovamente la configurazione.", ["admin.config_disabled"] = "Configurazione Disabilitata", + ["admin.dll_install_problem"] = "La DLL di Gmod Integration è mancante!\n\nSenza questa DLL, alcune funzionalità non funzioneranno correttamente, inclusa l'autenticazione e l'integrazione avanzata.", ["chat.error.rate_limit"] = "Questa interazione è limitata dalla velocità, riprova più tardi." } \ No newline at end of file diff --git a/lua/gmod_integration/languages/sh_nl.lua b/lua/gmod_integration/languages/sh_nl.lua index aea982d..af74534 100644 --- a/lua/gmod_integration/languages/sh_nl.lua +++ b/lua/gmod_integration/languages/sh_nl.lua @@ -104,5 +104,6 @@ return { ["verification.family_sharing_description"] = "Blokkeer spelers die gezinsdeling gebruiken.", ["admin.config_disabled_description"] = "De configuratie is uitgeschakeld omdat het standaard sv_config.lua-bestand is bewerkt.\nHerstel het standaard sv_config.lua-bestand om de configuratie opnieuw in te schakelen.", ["admin.config_disabled"] = "Configuratie Uitgeschakeld", + ["admin.dll_install_problem"] = "De Gmod Integration DLL ontbreekt!\n\nZonder deze DLL zullen sommige functies niet correct werken, inclusief authenticatie en geavanceerde integratie.", ["chat.error.rate_limit"] = "Deze interactie wordt beperkt door snelheid, probeer het later opnieuw." } \ No newline at end of file diff --git a/lua/gmod_integration/languages/sh_pl.lua b/lua/gmod_integration/languages/sh_pl.lua index 39f81f4..c3757dc 100644 --- a/lua/gmod_integration/languages/sh_pl.lua +++ b/lua/gmod_integration/languages/sh_pl.lua @@ -104,5 +104,6 @@ return { ["verification.family_sharing_description"] = "Blokuj graczy korzystających z udostępniania rodzinnego.", ["admin.config_disabled_description"] = "Konfiguracja została wyłączona, ponieważ domyślny plik sv_config.lua został zmieniony.\nPrzywróć domyślny plik sv_config.lua, aby ponownie włączyć konfigurację.", ["admin.config_disabled"] = "Konfiguracja Wyłączona", + ["admin.dll_install_problem"] = "Brakuje DLL Gmod Integration!\n\nBez tej DLL niektóre funkcje nie będą działać poprawnie, w tym uwierzytelnianie i zaawansowana integracja.", ["chat.error.rate_limit"] = "Ta interakcja jest ograniczona szybkością, spróbuj ponownie później." } \ No newline at end of file diff --git a/lua/gmod_integration/languages/sh_ru.lua b/lua/gmod_integration/languages/sh_ru.lua index 37bf853..2805075 100644 --- a/lua/gmod_integration/languages/sh_ru.lua +++ b/lua/gmod_integration/languages/sh_ru.lua @@ -104,5 +104,6 @@ return { ["verification.verifyFamilySharing_description"] = "Блокировать игроков, использующих семейный доступ.", ["admin.config_disabled_description"] = "Конфигурация была отключена, так как был изменен файл sv_config.lua.\nПожалуйста, восстановите исходный sv_config.lua, чтобы снова включить конфигурацию.", ["admin.config_disabled"] = "Конфигурация Отключена", + ["admin.dll_install_problem"] = "DLL Gmod Integration отсутствует!\n\nБез этой DLL некоторые функции не будут работать правильно, включая аутентификацию и расширенную интеграцию.", ["chat.error.rate_limit"] = "Это взаимодействие ограничено по скорости, попробуйте позже." } \ No newline at end of file diff --git a/lua/gmod_integration/languages/sh_tr.lua b/lua/gmod_integration/languages/sh_tr.lua index abc69e0..9cbb8fc 100644 --- a/lua/gmod_integration/languages/sh_tr.lua +++ b/lua/gmod_integration/languages/sh_tr.lua @@ -103,5 +103,6 @@ return { ["verification.verifyFamilySharing"] = "Aile Paylaşımını Engelle", ["verification.family_sharing_description"] = "Aile paylaşımı yapan oyuncuları engelle.", ["admin.config_disabled_description"] = "Varsayılan sv_config.lua dosyası düzenlendiği için yapılandırma devre dışı bırakıldı.\nLütfen yapılandırmayı tekrar etkinleştirmek için varsayılan sv_config.lua dosyasını geri yükleyin.", - ["admin.config_disabled"] = "Yapılandırma Devre Dışı" + ["admin.config_disabled"] = "Yapılandırma Devre Dışı", + ["admin.dll_install_problem"] = "Gmod Integration DLL dosyası eksik!\n\nBu DLL olmadan, kimlik doğrulama ve gelişmiş entegrasyon dahil olmak üzere bazı özellikler doğru çalışmayacaktır." } \ No newline at end of file