Users\Render PendingRender update
This commit is contained in:
parent
919ba89b38
commit
d79bf18f37
|
|
@ -67,7 +67,7 @@ namespace Alphaland\Users {
|
||||||
else if (Outfit::UserOutfitCount($userid) >= 24) {
|
else if (Outfit::UserOutfitCount($userid) >= 24) {
|
||||||
throw new Exception('Limit of 24 outfits');
|
throw new Exception('Limit of 24 outfits');
|
||||||
}
|
}
|
||||||
else if (Render::PendingRendering($userid)) {
|
else if (Render::PendingRender($userid)) {
|
||||||
throw new Exception('Please wait for the current render');
|
throw new Exception('Please wait for the current render');
|
||||||
} else {
|
} else {
|
||||||
//queries
|
//queries
|
||||||
|
|
@ -140,7 +140,7 @@ namespace Alphaland\Users {
|
||||||
throw new Exception('Name too long, must be less than 50 characters 1');
|
throw new Exception('Name too long, must be less than 50 characters 1');
|
||||||
} else if (!Outfit::UserOwnsOutfit($userid, $outfitid)) {
|
} else if (!Outfit::UserOwnsOutfit($userid, $outfitid)) {
|
||||||
throw new Exception('Error occurred');
|
throw new Exception('Error occurred');
|
||||||
} else if (Render::PendingRendering($userid)) {
|
} else if (Render::PendingRender($userid)) {
|
||||||
throw new Exception('Please wait for the current render');
|
throw new Exception('Please wait for the current render');
|
||||||
} else if (!Outfit::DeleteOutfit($userid, $outfitid)) {
|
} else if (!Outfit::DeleteOutfit($userid, $outfitid)) {
|
||||||
throw new Exception('Failed to update outfit, contact an Administrator');
|
throw new Exception('Failed to update outfit, contact an Administrator');
|
||||||
|
|
@ -155,7 +155,7 @@ namespace Alphaland\Users {
|
||||||
{
|
{
|
||||||
if (!Outfit::UserOwnsOutfit($userid, $outfitid)) {
|
if (!Outfit::UserOwnsOutfit($userid, $outfitid)) {
|
||||||
throw new Exception('Error occurred');
|
throw new Exception('Error occurred');
|
||||||
} else if (Render::PendingRendering($userid)) {
|
} else if (Render::PendingRender($userid)) {
|
||||||
throw new Exception('Please wait for the current render');
|
throw new Exception('Please wait for the current render');
|
||||||
} else {
|
} else {
|
||||||
$outfit = $GLOBALS['pdo']->prepare('SELECT * FROM user_outfits WHERE userid = :uid AND id = :id');
|
$outfit = $GLOBALS['pdo']->prepare('SELECT * FROM user_outfits WHERE userid = :uid AND id = :id');
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ namespace Alphaland\Users {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function PendingRendering(int $userid)
|
public static function PendingRender(int $userid)
|
||||||
{
|
{
|
||||||
$pending = $GLOBALS['pdo']->prepare("SELECT * FROM users WHERE id = :u");
|
$pending = $GLOBALS['pdo']->prepare("SELECT * FROM users WHERE id = :u");
|
||||||
$pending->bindParam(":u", $userid, PDO::PARAM_INT);
|
$pending->bindParam(":u", $userid, PDO::PARAM_INT);
|
||||||
|
|
|
||||||
|
|
@ -1440,46 +1440,6 @@ function rerenderutility()
|
||||||
UsersRender::RenderPlayer($localplayer);
|
UsersRender::RenderPlayer($localplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkUserPendingRender($player)
|
|
||||||
{
|
|
||||||
$check = $GLOBALS['pdo']->prepare("SELECT * FROM users WHERE id = :u");
|
|
||||||
$check->bindParam(":u", $player, PDO::PARAM_INT);
|
|
||||||
$check->execute();
|
|
||||||
$checkdata = $check->fetch(PDO::FETCH_OBJ);
|
|
||||||
|
|
||||||
$waspendingrender = false;
|
|
||||||
|
|
||||||
if ($checkdata->pendingRender == true) //render pending
|
|
||||||
{
|
|
||||||
if (($checkdata->lastRender + 15) < time()) //last render still pending after 15 seconds
|
|
||||||
{
|
|
||||||
$update = $GLOBALS['pdo']->prepare("UPDATE users SET pendingRender = 0 WHERE id = :u");
|
|
||||||
$update->bindParam(":u", $player, PDO::PARAM_INT);
|
|
||||||
$update->execute();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$waspendingrender = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($checkdata->pendingHeadshotRender == true) //headshot render pending
|
|
||||||
{
|
|
||||||
if (($checkdata->lastHeadshotRender + 15) < time()) //last render still pending after 15 seconds
|
|
||||||
{
|
|
||||||
$update = $GLOBALS['pdo']->prepare("UPDATE users SET pendingHeadshotRender = 0 WHERE id = :u");
|
|
||||||
$update->bindParam(":u", $player, PDO::PARAM_INT);
|
|
||||||
$update->execute();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$waspendingrender = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $waspendingrender;
|
|
||||||
}
|
|
||||||
|
|
||||||
//end local user render utility functions
|
//end local user render utility functions
|
||||||
|
|
||||||
//asset functions
|
//asset functions
|
||||||
|
|
@ -3008,7 +2968,7 @@ function getImageFromAsset($id)
|
||||||
function getPlayerRender($uid, $headshot=false)
|
function getPlayerRender($uid, $headshot=false)
|
||||||
{
|
{
|
||||||
//check if the user has a stalled render
|
//check if the user has a stalled render
|
||||||
checkUserPendingRender($uid);
|
UsersRender::PendingRender($uid);
|
||||||
|
|
||||||
$player = userInfo($uid);
|
$player = userInfo($uid);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (checkUserPendingRender($user->id))
|
use Alphaland\Users\Render;
|
||||||
|
|
||||||
|
if (Render::PendingRender($user->id))
|
||||||
{
|
{
|
||||||
echo 'pending';
|
echo 'pending';
|
||||||
}
|
}
|
||||||
|
|
@ -5,7 +5,9 @@
|
||||||
Alphaland 2021
|
Alphaland 2021
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (checkUserPendingRender($user->id))
|
use Alphaland\Users\Render;
|
||||||
|
|
||||||
|
if (Render::PendingRender($user->id))
|
||||||
{
|
{
|
||||||
echo 'pending';
|
echo 'pending';
|
||||||
}
|
}
|
||||||
|
|
@ -24,7 +24,7 @@ else
|
||||||
{
|
{
|
||||||
$alert = false;
|
$alert = false;
|
||||||
|
|
||||||
if (!checkUserPendingRender($user->id))
|
if (!Render::PendingRender($user->id))
|
||||||
{
|
{
|
||||||
if ($angleRight) {
|
if ($angleRight) {
|
||||||
if (setHeadshotAngleRight($user->id)) {
|
if (setHeadshotAngleRight($user->id)) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue