fix: force player link

This commit is contained in:
Linventif 2024-02-09 23:36:11 +01:00
parent 92635144b5
commit d55e160320
2 changed files with 7 additions and 5 deletions

View File

@ -78,7 +78,10 @@ end
function gmInte.verifyPlayer(ply) function gmInte.verifyPlayer(ply)
if (!gmInte.plyValid(ply)) then return end if (!gmInte.plyValid(ply)) then return end
gmInte.http.get("/players/" .. ply:SteamID64(), function(code, data) gmInte.http.get("/players/" .. ply:SteamID64(), function(code, data)
if ((data && data.steam_id && ply.gmIntUnVerified) || !gmInte.config.forcePlayerLink) then if (!gmInte.config.forcePlayerLink) then return end
if (data && data.steamID64) then
if (ply.gmIntVerified) then return end
gmInte.SendNet(6, { gmInte.SendNet(6, {
[1] = { [1] = {
["text"] = "You have been verified", ["text"] = "You have been verified",
@ -86,7 +89,7 @@ function gmInte.verifyPlayer(ply)
} }
}, ply) }, ply)
ply:Freeze(false) ply:Freeze(false)
ply.gmIntUnVerified = false ply.gmIntVerified = true
else else
gmInte.SendNet(6, { gmInte.SendNet(6, {
[1] = { [1] = {
@ -95,7 +98,6 @@ function gmInte.verifyPlayer(ply)
} }
}, ply) }, ply)
ply:Freeze(true) ply:Freeze(true)
ply.gmIntUnVerified = true
gmInte.SendNet(7, nil, ply) gmInte.SendNet(7, nil, ply)
end end
end) end)

View File

@ -69,11 +69,11 @@ function gmInte.http.requestAPI(params)
return failed({ ["error"] = "Invalid Content-Type" }, code, headers) return failed({ ["error"] = "Invalid Content-Type" }, code, headers)
end end
// Tableify the body if it's JSON // Parse body
body = util.JSONToTable(body || "{}") body = util.JSONToTable(body || "{}")
// Return success // Return success
return success(body) return success(code, body)
end, end,
["failed"] = function(error) ["failed"] = function(error)
gmInte.logError(error) gmInte.logError(error)