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

Can an array run a command?

Comments in 'Plugin Development' started by Legomite, Mar 17, 2014.

  1. Legomite
    Offline

    Legomite Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    470
    Plugins:
    2
    Minecraft User:
    Legomite
    If you want to run different commands randomly would it work with a array? If it does,how do you do it?
    array =array(/fart,fard)
  2. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,706
    Plugins:
    22
    Minecraft User:
    Falkirknh
    I think this should work:
    PHP:
    $foo = array("cmd1","cmd2");
    $this->api->console->run($foo[array_rand($foo)]);
  3. Legomite
    Offline

    Legomite Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    470
    Plugins:
    2
    Minecraft User:
    Legomite
    Thanks! I will test it.

Share This Page

Advertisement