Feat: add familly verification

This commit is contained in:
Linventif 2024-11-28 17:24:59 +00:00
parent 5c78fae9a6
commit 4caed5845f
13 changed files with 50 additions and 6 deletions

View File

@ -1,6 +1,6 @@
if game.SinglePlayer() then return print("Gmod Integration is not supported in Singleplayer!") end if game.SinglePlayer() then return print("Gmod Integration is not supported in Singleplayer!") end
gmInte = gmInte || {} gmInte = gmInte || {}
gmInte.version = "0.4.5" gmInte.version = "0.4.6"
gmInte.config = {} gmInte.config = {}
gmInte.materials = {} gmInte.materials = {}
local function loadServerConfig() local function loadServerConfig()

View File

@ -99,11 +99,12 @@ function gmInte.openConfigMenu(data)
["reloadOnEdit"] = true, ["reloadOnEdit"] = true,
["category"] = gmInte.getTranslation("admin.main", "Main"), ["category"] = gmInte.getTranslation("admin.main", "Main"),
["values"] = { ["values"] = {
["en"] = "English",
["fr"] = "Français",
["de"] = "Deutsch", ["de"] = "Deutsch",
["en"] = "English",
["es"] = "Español", ["es"] = "Español",
["fr"] = "Français",
["it"] = "Italiano", ["it"] = "Italiano",
["pl"] = "Polski",
["ru"] = "Русский", ["ru"] = "Русский",
["tr"] = "Türkçe", ["tr"] = "Türkçe",
} }
@ -137,6 +138,15 @@ function gmInte.openConfigMenu(data)
["onEditDelay"] = 0.5, ["onEditDelay"] = 0.5,
["category"] = gmInte.getTranslation("admin.trust_safety", "Trust & Safety") ["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", ["id"] = "verifyOnJoin",
["label"] = gmInte.getTranslation("admin.verify_on_join", "Verify on Join"), ["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"), ["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."), ["description"] = gmInte.getTranslation("admin.client_force_branch_description", "The branch of the addon that the clients should use."),
["type"] = "combo", ["type"] = "combo",
["condition"] = function(data) return data.forcePlayerLink end,
["value"] = function(setting, value) return value end, ["value"] = function(setting, value) return value end,
["onEdit"] = function(setting, value) saveConfig(setting, value) end, ["onEdit"] = function(setting, value) saveConfig(setting, value) end,
["category"] = gmInte.getTranslation("admin.trust_safety", "Trust & Safety"), ["category"] = gmInte.getTranslation("admin.trust_safety", "Trust & Safety"),

View File

@ -50,10 +50,18 @@ function gmInte.verifyPlayerBranch(ply)
gmInte.plyInVerifBranchQueue[ply:SteamID64()] = ply gmInte.plyInVerifBranchQueue[ply:SteamID64()] = ply
end 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) hook.Add("gmInte:PlayerReady", "gmInte:Verif:PlayerReady", function(ply)
ply.gmIntIsReady = true ply.gmIntIsReady = true
gmInte.verifyPlayer(ply) gmInte.verifyPlayer(ply)
gmInte.verifyPlayerBranch(ply) gmInte.verifyPlayerBranch(ply)
gmInte.blockFamilySharing(ply)
end) end)
// Routine to check the verification of players and kick them if they don't verify // Routine to check the verification of players and kick them if they don't verify

View File

@ -99,4 +99,7 @@ return {
["verification.kick"] = "Du wurdest gekickt, weil du dich nicht verifiziert hast. Verifiziere dein Konto auf {1}", ["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_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.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."
} }

View File

@ -99,4 +99,7 @@ return {
["verification.kick"] = "You have been kicked for not verifying, verify your account on {1}", ["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_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.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."
} }

View File

@ -99,4 +99,7 @@ return {
["verification.kick"] = "Has sido expulsado por no verificar, verifica tu cuenta en {1}", ["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_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.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."
} }

View File

@ -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"] = "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_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.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."
} }

View File

@ -99,4 +99,7 @@ return {
["verification.kick"] = "Sei stato espulso per non aver verificato, verifica il tuo account su {1}", ["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_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.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."
} }

View File

@ -99,4 +99,7 @@ return {
["verification.kick"] = "Zostałeś wyrzucony za brak weryfikacji, zweryfikuj swoje konto na {1}", ["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_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.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."
} }

View File

@ -99,4 +99,7 @@ return {
["verification.kick"] = "Вы были кикнуты за отсутствие верификации, верифицируйте свою учетную запись на {1}", ["verification.kick"] = "Вы были кикнуты за отсутствие верификации, верифицируйте свою учетную запись на {1}",
["verification.kick_in_branch"] = "Если вы не смените ветку в течение {1} секунд, вас кикнут", ["verification.kick_in_branch"] = "Если вы не смените ветку в течение {1} секунд, вас кикнут",
["verification.kick_branch"] = "Вы были кикнуты за несмену ветки на {1}", ["verification.kick_branch"] = "Вы были кикнуты за несмену ветки на {1}",
["verification.family_sharing"] = "This server does not allow family sharing",
["verification.verifyFamilySharing"] = "Блокировать семейный доступ",
["verification.verifyFamilySharing_description"] = "Блокировать игроков, использующих семейный доступ."
} }

View File

@ -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"] = "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_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.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."
} }

View File

@ -76,6 +76,7 @@ end
gmInte.restoreFileCache = gmInte.restoreFileCache || {} gmInte.restoreFileCache = gmInte.restoreFileCache || {}
function ply:getAdjustedTime() function ply:getAdjustedTime()
if gmInte.restoreFileCache.sysTime == nil || gmInte.restoreFileCache.playersList == nil then return 0 end
if SERVER then if SERVER then
if table.IsEmpty(gmInte.restoreFileCache) then if table.IsEmpty(gmInte.restoreFileCache) then
if file.Exists("gm_integration/player_before_map_change.json", "DATA") then if file.Exists("gm_integration/player_before_map_change.json", "DATA") then
@ -96,8 +97,9 @@ function ply:getAdjustedTime()
end end
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.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 return gmInte.restoreFileCache.playersList[self:SteamID()].connectTime || 0
end end

View File

@ -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.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.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.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) gmInte.config.clientBranch = "any" // The branch of the addon that the clients should use (none, dev, prerelease, x86-64)
// Other // Other
gmInte.config.supportLink = "" // The link of your support (shown when a player do not have the requiments to join the server) gmInte.config.supportLink = "" // The link of your support (shown when a player do not have the requiments to join the server)