Here are my validating functions : (Picked in your SSM but simplified)
function Master:AttemptValidate(player,pid,uid,name,attempt)
local req = urlfmt("http://crymp.net/api/validate.php?prof=%s&uid=%s",pid,uid);
local result = Master.RequestHTTP(req);
if result then
local err=string.find(result,"%Validation:Failed%",nil,true);
if err then
printf("Validation error: %s",tostring(err));
player.profile=math.random(800000,1000000);
else
printf("Validation success for %s/%s",name or "<unknown>",player:GetName() or "<unknown>");
player.profile=pid;
g_gameRules.game:RenamePlayer(player.id, name);
_G["ValidIds"]=_G["ValidIds"] or {};
_G["ValidIds"][uid]=pid;
end
else
if attempt<4 then
printf("Validation warning: %s , attempt: %d",tostring(error),attempt+1);
AttemptValidate(player,pid,uid,name,attempt+1);
else
printf("Validation error: %s",tostring(error));
player.profile=math.random(800000,1000000);
end
end
end
AddChatCommand("validate", {args={"pid", "uid", "name"}, info="Used by sfwcl to login"}, function (player, pid, uid, name)
Script.SetTimer(1,function()
if pid and uid and name then
local numpr=tonumber(pid);
if numpr and uid=="200000" and numpr>=800000 and numpr<=1000000 then
player.profile=pid;
g_gameRules.game:RenamePlayer(player.id,name)
return;
end
if _G["ValidIds"] and _G["ValidIds"][uid]==pid then
player.profile=pid;
g_gameRules.game:RenamePlayer(player.id,name)
return;
end
Master:AttemptValidate(player,pid,uid,name,0);
end
end);
end);
❤️ 0