Fix: force player verif

This commit is contained in:
Linventif 2024-09-15 16:57:26 +00:00
parent 6dbc88911d
commit 9919559b63
2 changed files with 15 additions and 6 deletions

View File

@ -29,10 +29,8 @@ function gmInte.openVerifPopup()
local button = vgui.Create("DButton") local button = vgui.Create("DButton")
button:SetText("Refresh Verification") button:SetText("Refresh Verification")
button.DoClick = function() button.DoClick = function()
gmInte.http.get("/users?steamID64" .. LocalPlayer():SteamID64(), function(code, body) gmInte.SendNet("verifyMe")
gmInte.SendNet("verifyMe") frame:Close()
frame:Close()
end, function(code, body) LocalPlayer():ChatPrint("Failed to refresh verification: " .. code) end)
end end
button:SetSize(buttonGrid:GetColWide() - 10, buttonGrid:GetRowHeight()) button:SetSize(buttonGrid:GetColWide() - 10, buttonGrid:GetRowHeight())

View File

@ -1,6 +1,6 @@
function gmInte.verifyPlayer(ply) function gmInte.verifyPlayer(ply)
if !ply:IsValid() || !ply:IsPlayer(ply) then return end if !ply:IsValid() || !ply:IsPlayer(ply) then return end
gmInte.http.get("/user?steamID64=" .. ply:SteamID64(), function(code, data) gmInte.http.get("/users?steamID64=" .. ply:SteamID64(), function(code, data)
if data && data.discordID then ply.gmIntVerified = true end if data && data.discordID then ply.gmIntVerified = true end
if !gmInte.config.forcePlayerLink || !ply.gmIntIsReady then return end if !gmInte.config.forcePlayerLink || !ply.gmIntIsReady then return end
if ply:gmIntIsVerified() then if ply:gmIntIsVerified() then
@ -15,7 +15,7 @@ function gmInte.verifyPlayer(ply)
else else
gmInte.SendNet("chatColorMessage", { gmInte.SendNet("chatColorMessage", {
[1] = { [1] = {
["text"] = "You are not verified", ["text"] = "Failed to verify you",
["color"] = Color(255, 0, 0) ["color"] = Color(255, 0, 0)
} }
}, ply) }, ply)
@ -23,11 +23,22 @@ function gmInte.verifyPlayer(ply)
ply:Freeze(true) ply:Freeze(true)
gmInte.SendNet("openVerifPopup", nil, ply) gmInte.SendNet("openVerifPopup", nil, ply)
end end
end, function(code, data)
ply:Freeze(true)
gmInte.SendNet("chatColorMessage", {
[1] = {
["text"] = "This server requires you to link your Discord account to play",
["color"] = Color(255, 0, 0)
}
}, ply)
gmInte.SendNet("openVerifPopup", nil, ply)
end) end)
end 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
if !gmInte.config.forcePlayerLink then return end if !gmInte.config.forcePlayerLink then return end
ply:Freeze(true)
gmInte.verifyPlayer(ply) gmInte.verifyPlayer(ply)
end) end)