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

How to get random theme and save to variable

Discussion in 'Facepalm' started by Kabluinc, Feb 8, 2017.

  1. Kabluinc

    Kabluinc Baby Zombie

    Messages:
    129
    So I would like to get a random theme from config and save it on a variable then send that theme as a popup to player.

    Iv tried putting
    Code:
    public $theme = [];
    in the main.php file

    then
    Code:
    $themes = array_rand($config->get("themes"));
    $theme = $config->get("themes")[$themes];
    $this->main->theme == $theme
    then
    Code:
    $p->sendPopup($this->main->theme);
    Anything I'm doing wrong or could correct as this does not work
     
  2. wolfdale

    wolfdale Zombie Pigman

    Messages:
    535
    GitHub:
    diamond-gold
    PHP:
    $this->main->theme array_rand($config->get("themes"));
     
  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.