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

could not be converted to string Please help me

Discussion in 'Plugin Help' started by MrSolik123, Aug 30, 2019.

  1. MrSolik123

    MrSolik123 Spider

    Messages:
    14
    "Object of class ThisCrazyPl\MainClassPl could not be converted to string" (EXCEPTION) in "plugins/new Player/src/ThisCrazyPl/MainClassPl" at line 95

    public function FirstJoin(PlayerJoinEvent $e){
    $p = $e->getPlayer();
    $names = $p->getName();




    if(!$p->hasPlayedBefore()){

    $rand1 = mt_rand(1,10);
    $rand = mt_rand(1,10);
    if($rand == 1){
    $name = ('Nicolas');
    }
    if($rand == 2){
    $name = ('Drake');
    }
    if($rand == 3){
    $name = ('Carl');
    }
    if($rand == 4){
    $name = ('Daniel');
    }
    if($rand == 5){
    $name = ('Jhon');
    }
    if($rand == 6){
    $name = ('Clyde');
    }
    if($rand == 7){
    $name = ('Nicolay');
    }
    if($rand == 8){
    $name = ('Max');
    }
    if($rand == 9){
    $name = ('Tommy');
    }
    if($rand == 10){
    $name = ('Gay');
    }

    if($rand1 == 1){
    $surname = ('Nicolas');
    }
    if($rand1 == 2){
    $surname = ('Caroletti');
    }
    if($rand1 == 3){
    $surname = ('Dicker');
    }
    if($rand1 == 4){
    $surname = ('Bale');
    }
    if($rand1 == 5){
    $surname = ('Nalogov');
    }
    if($rand1 == 6){
    $surname = ('Thompson');
    }
    if($rand1 == 7){
    $surname = ('Crybek');
    }
    if($rand1 == 8){
    $surname = ('Max');
    }
    if($rand1 == 9){
    $surname = ('Smith');
    }
    if($rand1 == 10){
    $surname = ('Versetti');
    }
    $nick = ("".$name."_".$surname."");
    $p->$this->getAPI()->setNick($p, $nick);
     
  2. Zade

    Zade Spider

    Messages:
    11
    Primus likes this.
  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.