grublox/assets/renders/user/headshot.php

54 lines
1.8 KiB
PHP

<?php
// this file is entirely made by nolanwhy, no skid pls
require_once '../../../core/classes.php';
require_once '../../../core/config.php';
$id = (int)$_GET["userId"] ?? 0;
$stmt = $con->prepare("SELECT * FROM users WHERE id = :id");
$stmt->bindParam(':id',$id,PDO::PARAM_INT);
$stmt->execute();
$ruser = $stmt->fetch();
if(!$ruser) {
exit;
}
function renderUser($id, $times = 1) {
global $RCCServiceSoap;
global $site;
// times is the like, if you rendered 2 times or shit.
$newtime = (int)$times + 1; // if rendered again, to retry.
$id = (int)$id;
$charapp = $site["url"].'/v1.1/avatar-fetch?userId='.$id.'&placeId=0';
$script = 'game:GetService("ContentProvider"):SetBaseUrl("'.$site["url"].'/")
game:GetService("ScriptContext").ScriptsDisabled = true
local plr = game.Players:CreateLocalPlayer(0)
plr.CharacterAppearance = "'.$charapp.'"
plr:LoadCharacter(false)
for i,v in pairs(plr.Character:GetChildren()) do
print(v)
if v:IsA("Tool") then
plr.Character.Torso["Right Shoulder"].CurrentAngle = math.pi / 2
end
end
local result = game:GetService("ThumbnailGenerator"):Click("PNG", 420, 420, true)
return result';
$joby = new Roblox\Grid\Rcc\Job("RENDER".rand(1,getrandmax()), 15);
$scripty = new Roblox\Grid\Rcc\ScriptExecution("Script", $script);
$result = $RCCServiceSoap->BatchJob($joby, $scripty);
if(empty($result)) {
if($times <= 1) {
return renderUser($id, $newtime);
}
}
}
if(empty($ruser["headshot"])) {
$new = renderUser($ruser["id"]);
$stmt = $con->prepare("UPDATE users SET headshot = :new WHERE id = :id");
$stmt->bindParam(':id',$id,PDO::PARAM_INT);
$stmt->bindParam(':new',$new,PDO::PARAM_STR);
$stmt->execute();
echo base64_decode($new);
} else {
echo base64_decode($ruser["headshot"]);
}