From 4caed5845f641d1a7ff4b8f22927fd7835d5eea4 Mon Sep 17 00:00:00 2001 From: Linventif Date: Thu, 28 Nov 2024 17:24:59 +0000 Subject: [PATCH] Feat: add familly verification --- lua/autorun/gmod_integration.lua | 2 +- lua/gmod_integration/client/cl_gui_admin.lua | 15 ++++++++++++--- lua/gmod_integration/server/sv_players_verif.lua | 8 ++++++++ lua/gmod_integration/shared/languages/sh_de.lua | 3 +++ lua/gmod_integration/shared/languages/sh_en.lua | 3 +++ lua/gmod_integration/shared/languages/sh_es.lua | 3 +++ lua/gmod_integration/shared/languages/sh_fr.lua | 3 +++ lua/gmod_integration/shared/languages/sh_it.lua | 3 +++ lua/gmod_integration/shared/languages/sh_pl.lua | 5 ++++- lua/gmod_integration/shared/languages/sh_ru.lua | 3 +++ lua/gmod_integration/shared/languages/sh_tr.lua | 3 +++ lua/gmod_integration/shared/sh_player_meta.lua | 4 +++- lua/gmod_integration/sv_config.lua | 1 + 13 files changed, 50 insertions(+), 6 deletions(-) diff --git a/lua/autorun/gmod_integration.lua b/lua/autorun/gmod_integration.lua index 599c7ae..8b2a875 100644 --- a/lua/autorun/gmod_integration.lua +++ b/lua/autorun/gmod_integration.lua @@ -1,6 +1,6 @@ if game.SinglePlayer() then return print("Gmod Integration is not supported in Singleplayer!") end gmInte = gmInte || {} -gmInte.version = "0.4.5" +gmInte.version = "0.4.6" gmInte.config = {} gmInte.materials = {} local function loadServerConfig() diff --git a/lua/gmod_integration/client/cl_gui_admin.lua b/lua/gmod_integration/client/cl_gui_admin.lua index 72ad4e0..406d98f 100644 --- a/lua/gmod_integration/client/cl_gui_admin.lua +++ b/lua/gmod_integration/client/cl_gui_admin.lua @@ -99,11 +99,12 @@ function gmInte.openConfigMenu(data) ["reloadOnEdit"] = true, ["category"] = gmInte.getTranslation("admin.main", "Main"), ["values"] = { - ["en"] = "English", - ["fr"] = "Français", ["de"] = "Deutsch", + ["en"] = "English", ["es"] = "Español", + ["fr"] = "Français", ["it"] = "Italiano", + ["pl"] = "Polski", ["ru"] = "Русский", ["tr"] = "Türkçe", } @@ -137,6 +138,15 @@ function gmInte.openConfigMenu(data) ["onEditDelay"] = 0.5, ["category"] = gmInte.getTranslation("admin.trust_safety", "Trust & Safety") }, + { + ["id"] = "verifyFamilySharing", + ["label"] = gmInte.getTranslation("admin.verifyFamilySharing", "Block Family Sharing"), + ["description"] = gmInte.getTranslation("admin.verifyFamilySharing_description", "Block family sharing players."), + ["type"] = "checkbox", + ["value"] = function(setting, value) return value end, + ["onEdit"] = function(setting, value) saveConfig(setting, value) end, + ["category"] = gmInte.getTranslation("admin.trust_safety", "Trust & Safety") + }, { ["id"] = "verifyOnJoin", ["label"] = gmInte.getTranslation("admin.verify_on_join", "Verify on Join"), @@ -162,7 +172,6 @@ function gmInte.openConfigMenu(data) ["label"] = gmInte.getTranslation("admin.client_force_branch", "Client Force Branch"), ["description"] = gmInte.getTranslation("admin.client_force_branch_description", "The branch of the addon that the clients should use."), ["type"] = "combo", - ["condition"] = function(data) return data.forcePlayerLink end, ["value"] = function(setting, value) return value end, ["onEdit"] = function(setting, value) saveConfig(setting, value) end, ["category"] = gmInte.getTranslation("admin.trust_safety", "Trust & Safety"), diff --git a/lua/gmod_integration/server/sv_players_verif.lua b/lua/gmod_integration/server/sv_players_verif.lua index abc5cac..2ba64de 100644 --- a/lua/gmod_integration/server/sv_players_verif.lua +++ b/lua/gmod_integration/server/sv_players_verif.lua @@ -50,10 +50,18 @@ function gmInte.verifyPlayerBranch(ply) gmInte.plyInVerifBranchQueue[ply:SteamID64()] = ply end +function gmInte.blockFamilySharing(ply) + if !gmInte.config.verifyFamilySharing then return end + if !ply:IsValid() || !ply:IsPlayer(ply) || ply:IsBot() || !ply:IsFullyAuthenticated() then return end + if ply:OwnerSteamID64() == ply:SteamID64() then return end + ply:Kick(gmInte.getTranslation("verification.family_sharing", "This server does not allow family sharing")) +end + hook.Add("gmInte:PlayerReady", "gmInte:Verif:PlayerReady", function(ply) ply.gmIntIsReady = true gmInte.verifyPlayer(ply) gmInte.verifyPlayerBranch(ply) + gmInte.blockFamilySharing(ply) end) // Routine to check the verification of players and kick them if they don't verify diff --git a/lua/gmod_integration/shared/languages/sh_de.lua b/lua/gmod_integration/shared/languages/sh_de.lua index f09af51..e861ba9 100644 --- a/lua/gmod_integration/shared/languages/sh_de.lua +++ b/lua/gmod_integration/shared/languages/sh_de.lua @@ -99,4 +99,7 @@ return { ["verification.kick"] = "Du wurdest gekickt, weil du dich nicht verifiziert hast. Verifiziere dein Konto auf {1}", ["verification.kick_in_branch"] = "Wenn du deinen Branch nicht innerhalb von {1} Sekunden änderst, wirst du gekickt", ["verification.kick_branch"] = "Du wurdest gekickt, weil du deinen Branch nicht auf {1} geändert hast", + ["verification.family_sharing"] = "Dieser Server erlaubt kein Family Sharing", + ["verification.verifyFamilySharing"] = "Family Sharing blockieren", + ["verification.verifyFamilySharing_description"] = "Blockiere Spieler, die Family Sharing verwenden." } \ No newline at end of file diff --git a/lua/gmod_integration/shared/languages/sh_en.lua b/lua/gmod_integration/shared/languages/sh_en.lua index fb35445..5632db1 100644 --- a/lua/gmod_integration/shared/languages/sh_en.lua +++ b/lua/gmod_integration/shared/languages/sh_en.lua @@ -99,4 +99,7 @@ return { ["verification.kick"] = "You have been kicked for not verifying, verify your account on {1}", ["verification.kick_in_branch"] = "If you don't change your branch in {1} seconds you will be kicked", ["verification.kick_branch"] = "You have been kicked for not changing your branch to {1}", + ["verification.family_sharing"] = "This server does not allow family sharing", + ["verification.verifyFamilySharing"] = "Block Family Sharing", + ["verification.family_shariverifyFamilySharing_descriptionng"] = "Block family sharing players." } \ No newline at end of file diff --git a/lua/gmod_integration/shared/languages/sh_es.lua b/lua/gmod_integration/shared/languages/sh_es.lua index e964e11..784f75d 100644 --- a/lua/gmod_integration/shared/languages/sh_es.lua +++ b/lua/gmod_integration/shared/languages/sh_es.lua @@ -99,4 +99,7 @@ return { ["verification.kick"] = "Has sido expulsado por no verificar, verifica tu cuenta en {1}", ["verification.kick_in_branch"] = "Si no cambias tu rama en {1} segundos serás expulsado", ["verification.kick_branch"] = "Has sido expulsado por no cambiar tu rama a {1}", + ["verification.family_sharing"] = "Este servidor no permite el uso compartido familiar", + ["verification.verifyFamilySharing"] = "Bloquear Uso Compartido Familiar", + ["verification.family_sharing_description"] = "Bloquear jugadores que usan el uso compartido familiar." } \ No newline at end of file diff --git a/lua/gmod_integration/shared/languages/sh_fr.lua b/lua/gmod_integration/shared/languages/sh_fr.lua index 7ff7636..8073f9a 100644 --- a/lua/gmod_integration/shared/languages/sh_fr.lua +++ b/lua/gmod_integration/shared/languages/sh_fr.lua @@ -99,4 +99,7 @@ return { ["verification.kick"] = "Vous avez été expulsé pour ne pas avoir vérifié, vérifiez votre compte sur {1}", ["verification.kick_in_branch"] = "Si vous ne changez pas de branche dans {1} secondes, vous serez expulsé", ["verification.kick_branch"] = "Vous avez été expulsé pour ne pas avoir changé votre branche en {1}", + ["verification.family_sharing"] = "Ce serveur n'autorise pas le partage familial", + ["verification.verifyFamilySharing"] = "Bloquer le partage familial", + ["verification.verifyFamilySharing_description"] = "Bloquer les joueurs utilisant le partage familial." } \ No newline at end of file diff --git a/lua/gmod_integration/shared/languages/sh_it.lua b/lua/gmod_integration/shared/languages/sh_it.lua index 94eff05..d88cef2 100644 --- a/lua/gmod_integration/shared/languages/sh_it.lua +++ b/lua/gmod_integration/shared/languages/sh_it.lua @@ -99,4 +99,7 @@ return { ["verification.kick"] = "Sei stato espulso per non aver verificato, verifica il tuo account su {1}", ["verification.kick_in_branch"] = "Se non cambi il tuo branch entro {1} secondi sarai espulso", ["verification.kick_branch"] = "Sei stato espulso per non aver cambiato il tuo branch a {1}", + ["verification.family_sharing"] = "Questo server non permette la condivisione familiare", + ["verification.verifyFamilySharing"] = "Blocca Condivisione Familiare", + ["verification.verifyFamilySharing_description"] = "Blocca i giocatori che utilizzano la condivisione familiare." } \ No newline at end of file diff --git a/lua/gmod_integration/shared/languages/sh_pl.lua b/lua/gmod_integration/shared/languages/sh_pl.lua index c0a0ea6..1120440 100644 --- a/lua/gmod_integration/shared/languages/sh_pl.lua +++ b/lua/gmod_integration/shared/languages/sh_pl.lua @@ -99,4 +99,7 @@ return { ["verification.kick"] = "Zostałeś wyrzucony za brak weryfikacji, zweryfikuj swoje konto na {1}", ["verification.kick_in_branch"] = "Jeśli nie zmienisz swojej gałęzi w ciągu {1} sekund, zostaniesz wyrzucony", ["verification.kick_branch"] = "Zostałeś wyrzucony za brak zmiany gałęzi na {1}", -} + ["verification.family_sharing"] = "Ten serwer nie pozwala na udostępnianie rodzinne", + ["verification.verisfyFamilySharing"] = "Blokuj Udostępnianie Rodzinne", + ["verification.family_sharing_description"] = "Blokuj graczy korzystających z udostępniania rodzinnego." +} \ No newline at end of file diff --git a/lua/gmod_integration/shared/languages/sh_ru.lua b/lua/gmod_integration/shared/languages/sh_ru.lua index eaee0c8..77d5aa3 100644 --- a/lua/gmod_integration/shared/languages/sh_ru.lua +++ b/lua/gmod_integration/shared/languages/sh_ru.lua @@ -99,4 +99,7 @@ return { ["verification.kick"] = "Вы были кикнуты за отсутствие верификации, верифицируйте свою учетную запись на {1}", ["verification.kick_in_branch"] = "Если вы не смените ветку в течение {1} секунд, вас кикнут", ["verification.kick_branch"] = "Вы были кикнуты за несмену ветки на {1}", + ["verification.family_sharing"] = "This server does not allow family sharing", + ["verification.verifyFamilySharing"] = "Блокировать семейный доступ", + ["verification.verifyFamilySharing_description"] = "Блокировать игроков, использующих семейный доступ." } \ No newline at end of file diff --git a/lua/gmod_integration/shared/languages/sh_tr.lua b/lua/gmod_integration/shared/languages/sh_tr.lua index 34aa609..780cdcd 100644 --- a/lua/gmod_integration/shared/languages/sh_tr.lua +++ b/lua/gmod_integration/shared/languages/sh_tr.lua @@ -99,4 +99,7 @@ return { ["verification.kick"] = "Doğrulamadığınız için atıldınız, hesabınızı {1} üzerinde doğrulayın", ["verification.kick_in_branch"] = "{1} saniye içinde dalınızı değiştirmezseniz atılacaksınız", ["verification.kick_branch"] = "Dalınızı {1} olarak değiştirmediğiniz için atıldınız", + ["verification.family_sharing"] = "Bu sunucu aile paylaşımına izin vermiyor", + ["verification.verifyFamilySharing"] = "Aile Paylaşımını Engelle", + ["verification.family_sharing_description"] = "Aile paylaşımı yapan oyuncuları engelle." } \ No newline at end of file diff --git a/lua/gmod_integration/shared/sh_player_meta.lua b/lua/gmod_integration/shared/sh_player_meta.lua index b2d27f5..b9ed024 100644 --- a/lua/gmod_integration/shared/sh_player_meta.lua +++ b/lua/gmod_integration/shared/sh_player_meta.lua @@ -76,6 +76,7 @@ end gmInte.restoreFileCache = gmInte.restoreFileCache || {} function ply:getAdjustedTime() + if gmInte.restoreFileCache.sysTime == nil || gmInte.restoreFileCache.playersList == nil then return 0 end if SERVER then if table.IsEmpty(gmInte.restoreFileCache) then if file.Exists("gm_integration/player_before_map_change.json", "DATA") then @@ -96,8 +97,9 @@ function ply:getAdjustedTime() end end + if !gmInte.restoreFileCache.sysTime || !gmInte.restoreFileCache.playersList then return 0 end if (gmInte.restoreFileCache.sysTime + 60 * 5) < (os.time() - self:gmIntGetConnectTime()) then return 0 end - if !gmInte.restoreFileCache.playersList || !gmInte.restoreFileCache.playersList[self:SteamID()] then return 0 end + if !gmInte.restoreFileCache.playersList[self:SteamID()] then return 0 end return gmInte.restoreFileCache.playersList[self:SteamID()].connectTime || 0 end diff --git a/lua/gmod_integration/sv_config.lua b/lua/gmod_integration/sv_config.lua index 55bdab0..b4b06ab 100644 --- a/lua/gmod_integration/sv_config.lua +++ b/lua/gmod_integration/sv_config.lua @@ -32,6 +32,7 @@ gmInte.config.debug = false // If true, the addon will show debug informations i gmInte.config.forcePlayerLink = false // If true, the addon will force the players to link their discord account to their steam account before playing gmInte.config.verifyOnJoin = false // If true, the addon will verify the players when they join the server or on player ready gmInte.config.verifyOnReadyKickTime = 600 // The time in seconds before kicking a player that is not verified (0 to disable) +gmInte.config.verifyFamilySharing = false // If true, the addon will verify the family sharing of the players gmInte.config.clientBranch = "any" // The branch of the addon that the clients should use (none, dev, prerelease, x86-64) // Other gmInte.config.supportLink = "" // The link of your support (shown when a player do not have the requiments to join the server)