1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

help mt_rand

Discussion in 'Facepalm' started by Levi, Sep 18, 2017.

Thread Status:
Not open for further replies.
  1. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    Code:
    Error:
    
    [22:41:42] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\player\PlayerLoginEvent' to 'Main v1.0.0': mt_rand(): max(-1227) is smaller than min(-1193) on Main\Main
    [22:41:42] [Server thread/CRITICAL]: ErrorException: "mt_rand(): max(-1227) is smaller than min(-1193)" (EXCEPTION) in "/MainP/src/Main/Main" at line 552
    Code;

    PHP:
    public function onPlayerLogin(PlayerLoginEvent $event) {
            
    $player $event->getPlayer();  
            
    $m1 = -1193;
            
    $m2 = -1227;      
            
    $m3 57;
            
    $m4 58;
            
    $m5 = -973;
            
    $m6 = -1107;
            
    $x mt_rand($m1,$m2);
            
    $y mt_rand($m3,$m4);
            
    $z mt_rand($m5,$m6);
            
    $player->teleport(new Vector3($x,$y,$z$this->getServer()->getDefaultLevel()));
        }
     
  2. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    Read the message.
    Or ask your maths teacher: is -1227 or -1193 larger?
     
Thread Status:
Not open for further replies.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.