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

[Help] I need help with my spleef code!

Comments in 'Plugin Development' started by iiDeathStrokeii, Apr 15, 2015.

  1. iiDeathStrokeii
    Offline

    iiDeathStrokeii Active Member

    Joined:
    Mar 30, 2015
    Posts:
    111
    Minecraft User:
    iiDeathstrokeii
    (In advance I know Pemapmodder will say to use array which I will do once this issue is resolved lol, as he has said before :p)

    PHP:
    private $SpleefOnePlayerOne;
    private 
    $SpleefOnePlayerTwo;
    PHP:
    if (!isset($SpleefOnePlayerOne or $this->getServer()->getPlayer($this->SpleefOnePlayerOne)->isOnline() == false)) {
                  
                                            
    $this->SpleefOnePlayerOne $event->getPlayer()->getName();//This specific line of code sets the player as a Spleef player.
                                            
    $event->getPlayer()->teleport(new Vector3(-120626280));//This line of code teleports the player to the game spawn point.
                                            
    $player->sendMessage("[Spleef] Please Wait. (Player One)");//Sends the player a message to wait.
                                            
    $item Item::get(256,0,1);//$item is set to a iron shovel.
                                            
    $player->getInventory()->addItem($item);//This adds $item to the players inventory.
                          
                                        
    }
                                      
                                        
    //      THIS ALLOCATES THE PLAYER TO PLAYER TWO FOR SPLEEF LOBBY ONE ALSO KNOWN AS $SpleefOnePlayer[1]
                                        
    elseif (!isset($SpleefOnePlayerTwo) or $this->getServer()->getPlayer($this->SpleefOnePlayerTwo)->isOnline() == false){
                  
                                            
    $this->SpleefOnePlayerTwo $event->getPlayer()->getName();//This specific lineof code sets the player as a Spleef player.
                                            
    $event->getPlayer()->teleport(new Vector3(-122126273));//This line of code teleports the player to the game spawn point.
                                            
    $player->sendMessage("[Spleef] Please Wait.  (Player Two)");//Sends the player a message to wait.
                                            
    $item Item::get(256,0,1);//$item is set to a iron shovel.
                                            
    $player->getInventory()->addItem($item);//This adds $item to the players inventory.
                                         
                                        
    }

    Why is it that all players are set to $SpleefOnePlayerOne im just stuck help would be much appreciated :(:confused:
  2. iiDeathStrokeii
    Offline

    iiDeathStrokeii Active Member

    Joined:
    Mar 30, 2015
    Posts:
    111
    Minecraft User:
    iiDeathstrokeii
  3. iiDeathStrokeii
    Offline

    iiDeathStrokeii Active Member

    Joined:
    Mar 30, 2015
    Posts:
    111
    Minecraft User:
    iiDeathstrokeii
  4. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,397
    Plugins:
    14
    PHP:
    if (!isset($SpleefOnePlayerOne or $this->getServer()->getPlayer($this->SpleefOnePlayerOne)->isOnline() == false)) {
    Should be:
    PHP:
    if (!isset($SpleefOnePlayerOne) or $this->getServer()->getPlayer($this->SpleefOnePlayerOne)->isOnline() == false) {
    HotFireyDeath likes this.
  5. iiDeathStrokeii
    Offline

    iiDeathStrokeii Active Member

    Joined:
    Mar 30, 2015
    Posts:
    111
    Minecraft User:
    iiDeathstrokeii
    um lol sorry that was a typo because while i was making this thread i accidently deleted that part so i wrote my self in the wrong bracket lol
    ugh

    PHP:
    if (!isset($SpleefOnePlayerOne)) {
                  
                                            
    $this->SpleefOnePlayerOne $event->getPlayer()->getName();//This specific line of code sets the player as a Spleef player.
                                            
    $event->getPlayer()->teleport(new Vector3(-120626280));//This line of code teleports the player to the game spawn point.
                                            
    $player->sendMessage("[Spleef] Please Wait. (Player One)");//Sends the player a message to wait.
                                            
    $item Item::get(256,0,1);//$item is set to a iron shovel.
                                            
    $player->getInventory()->addItem($item);//This adds $item to the players inventory.
                          
                                        
    }
                                      
                                        
    //      THIS ALLOCATES THE PLAYER TO PLAYER TWO FOR SPLEEF LOBBY ONE ALSO KNOWN AS $SpleefOnePlayer[1]
                                        
    elseif (!isset($SpleefOnePlayerTwo) or $this->getServer()->getPlayer($this->SpleefOnePlayerTwo)->isOnline() == false){
                  
                                            
    $this->SpleefOnePlayerTwo $event->getPlayer()->getName();//This specific lineof code sets the player as a Spleef player.
                                            
    $event->getPlayer()->teleport(new Vector3(-122126273));//This line of code teleports the player to the game spawn point.
                                            
    $player->sendMessage("[Spleef] Please Wait.  (Player Two)");//Sends the player a message to wait.
                                            
    $item Item::get(256,0,1);//$item is set to a iron shovel.
                                            
    $player->getInventory()->addItem($item);//This adds $item to the players inventory.
                                         
                                        
    }
  6. iiDeathStrokeii
    Offline

    iiDeathStrokeii Active Member

    Joined:
    Mar 30, 2015
    Posts:
    111
    Minecraft User:
    iiDeathstrokeii
    I took out the online check because I was testing with one device by logging with different users, still all players are set to $SpleefOnePlayerOne :mad:
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    jojoe77777 and LDX like this.

Share This Page

Advertisement