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

Player name with space

Discussion in 'Development' started by sdsd16, Mar 3, 2019.

  1. sdsd16

    sdsd16 Spider Jockey

    Messages:
    41
    GitHub:
    Danding1314
    i have an plugin of level,when player updated to next level,the server will touch off consolecommand but

    $this->getServer()->dispatchCommand(new ConsoleCommandSender(), "key lv".$name." 1");
    when sky sky 870 updated Lv2 the console will touch off the command
    but the player name have space cause the command wiil not give the player key carefully.
    how to change space to __?
     
  2. A354-PH

    A354-PH Baby Zombie

    Messages:
    186
    GitHub:
    Kizu
    What is $name?
     
  3. sdsd16

    sdsd16 Spider Jockey

    Messages:
    41
    GitHub:
    Danding1314
    $name = $event->getPlayer();
     
  4. A354-PH

    A354-PH Baby Zombie

    Messages:
    186
    GitHub:
    Kizu
    PHP:
    $player $event->getPlayer();
    $name $player->getName();
    Try this
     
  5. sdsd16

    sdsd16 Spider Jockey

    Messages:
    41
    GitHub:
    Danding1314
    i mean changer player name with space
     
  6. A354-PH

    A354-PH Baby Zombie

    Messages:
    186
    GitHub:
    Kizu
    sdsd16 likes this.
  7. MalakasPlayzMCPE

    MalakasPlayzMCPE Zombie Pigman

    Messages:
    667
    PHP:
    $this->getServer()->dispatchCommand(new ConsoleCommandSender(), 'key lv "'.$name.'" 1'); 
    Your welcome
     
    sdsd16 and A354-PH like 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.