mirror of
https://github.com/gmod-integration/lua.git
synced 2025-03-15 14:57:33 +00:00
Fix: force player verif
This commit is contained in:
parent
6dbc88911d
commit
9919559b63
|
@ -29,10 +29,8 @@ function gmInte.openVerifPopup()
|
|||
local button = vgui.Create("DButton")
|
||||
button:SetText("Refresh Verification")
|
||||
button.DoClick = function()
|
||||
gmInte.http.get("/users?steamID64" .. LocalPlayer():SteamID64(), function(code, body)
|
||||
gmInte.SendNet("verifyMe")
|
||||
frame:Close()
|
||||
end, function(code, body) LocalPlayer():ChatPrint("Failed to refresh verification: " .. code) end)
|
||||
gmInte.SendNet("verifyMe")
|
||||
frame:Close()
|
||||
end
|
||||
|
||||
button:SetSize(buttonGrid:GetColWide() - 10, buttonGrid:GetRowHeight())
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
function gmInte.verifyPlayer(ply)
|
||||
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 !gmInte.config.forcePlayerLink || !ply.gmIntIsReady then return end
|
||||
if ply:gmIntIsVerified() then
|
||||
|
@ -15,7 +15,7 @@ function gmInte.verifyPlayer(ply)
|
|||
else
|
||||
gmInte.SendNet("chatColorMessage", {
|
||||
[1] = {
|
||||
["text"] = "You are not verified",
|
||||
["text"] = "Failed to verify you",
|
||||
["color"] = Color(255, 0, 0)
|
||||
}
|
||||
}, ply)
|
||||
|
@ -23,11 +23,22 @@ function gmInte.verifyPlayer(ply)
|
|||
ply:Freeze(true)
|
||||
gmInte.SendNet("openVerifPopup", nil, ply)
|
||||
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
|
||||
|
||||
hook.Add("gmInte:PlayerReady", "gmInte:Verif:PlayerReady", function(ply)
|
||||
ply.gmIntIsReady = true
|
||||
if !gmInte.config.forcePlayerLink then return end
|
||||
ply:Freeze(true)
|
||||
gmInte.verifyPlayer(ply)
|
||||
end)
|
Loading…
Reference in New Issue
Block a user