Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Random

Comments in 'Plugin Development' started by Kripak, Sep 22, 2015.

  1. Kripak
    Offline

    Kripak New Member

    Joined:
    Jul 17, 2015
    Posts:
    45
    Minecraft User:
    Kripak
    How to use random function ?
  2. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    PHP:
    public function myFunction(){
        echo 
    "Hello!";
    }

    //and e.g. in a join event:

    public function onJoin(PlayerJoinEvent $e){
        
    $this->myFunction(); //this calls myFunction
    }
    :D
  3. Jelly9912
    Offline

    Jelly9912 Active Member

    Joined:
    Aug 8, 2015
    Posts:
    118
    Minecraft User:
    Jelly9912
    I think he thinks on random teleport
  4. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    hm or function mt_rand()
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Creeperface and Taha_The_Hacker like this.
  6. Kripak
    Offline

    Kripak New Member

    Joined:
    Jul 17, 2015
    Posts:
    45
    Minecraft User:
    Kripak
    How to use this code for the random particles ?
  7. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    i don't understand
  8. Artide
    Offline

    Artide Active Member

    Joined:
    Apr 20, 2015
    Posts:
    214
    Minecraft User:
    Artide5
  9. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
  10. TheMaks
    Offline

    TheMaks Active Member

    Joined:
    Jul 19, 2015
    Posts:
    58
    Minecraft User:
    TheMaks
    PHP:
    <?php
    public function getRandomFunction($num1,$num2){
    $rand mt_rand($num1,$num2);
    }
    public function 
    onJoin(PlayerJoinEvent $e){
    $rand $this->getRandomFunction(1,5);
    switch(
    $rand){
    case 
    1:
    //code
    break;
    case 
    2:
    //2 code
    break;
    /* etc... */
    }
    }
  11. Artide
    Offline

    Artide Active Member

    Joined:
    Apr 20, 2015
    Posts:
    214
    Minecraft User:
    Artide5
    PHP:
    public function getRandomFunction($num1,$num2){
    $rand mt_rand($num1,$num2);
    return 
    $rand;//gotta return to make the function run
    }
    PEMapModder likes this.

Share This Page

Advertisement