I want to block players from accessing my server if more than half of the pixels in their skin are transparent. Here is the code I’m using at the moment: PHP: public static function isInvisibleSkin(Skin $skin) : bool { $data = $skin->getSkinData(); $length = strlen($data); $halfSkin = false; $totalSkin = $data === str_repeat("\x00", $length); $c = 0; for ($i = 0; $i < $length; $i++) { if ($c >= ($length / 2) + 3400) { $halfSkin = true; var_dump($length); var_dump($c); //DEBUG: I want to see if happens again. break; } if ($data[$i] === "\x00") { $c++; } }return $halfSkin || $totalSkin;} It hasn’t exactly worked for some players - it’s even blocked some players because they have a second layer. How would I fix my code to achieve what I want?
First, Try to count what's the length of skin without layers to stop it from kicking Players with second layer.
i trying learn new language (php) when i cany use engis now i never make pmmp fork in scratch i cri everytime