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

Var error?

Comments in 'Plugin Development' started by Legoboy0215, Jun 21, 2015.

  1. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Code:
    16:46:23 [CRITICAL] Unhandled exception executing command '**' in hg: Undefined variable: worldsel
    Here is the code:
    PHP:
    $worldsel array_mt_rand($wconfig);
    }
    $this->getServer()->broadcastMessage("****** *****! World: ".$worldsel."!!");
    What is the problem?
    Last edited: Jun 21, 2015
  2. Xenturio
    Offline

    Xenturio Active Member

    Joined:
    Sep 19, 2014
    Posts:
    333
    Minecraft User:
    Xenturio
    $rand = array_rand($values, 10);
    or
    $a = mt_rand(1, count($one));
    $get = $one[$a];
    or
    $k = array_rand($array);
    $v = $array[$k]

    this is what i found on google...
    Legoboy0215 likes this.
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    What is the code above? Is it an if? If the if condition is false, $worldsel would not be defined.
    Legoboy0215 and EvolSoft like this.
  4. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Sorry for not placing the full code above. It is a if and the condition is false.
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    So if the condition is false, it won't initialize your $worldsel variable. What do you expect $worldsel to be if the condition is false?

Share This Page

Advertisement