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

TeamPvp i try create. Or have u got plugin teampvp? Errors...

Comments in 'Plugin Development' started by Valeron, Nov 5, 2015.

  1. Valeron
    Offline

    Valeron New Member

    Joined:
    Aug 26, 2015
    Posts:
    111
    Minecraft User:
    DarkSpive
    After function copy funtction getTeam() errors....
    ItsSuka likes this.
  2. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    This should fix your problems:
    PHP:
     public function isEnemy($player1$player2){
      if(
    in_array($player1$this->red) && in_array($player2$this->blue)) {
      return 
    true;
      }
    }
    That's all. The other code was unnecessary.
    PEMapModder likes this.
  3. Valeron
    Offline

    Valeron New Member

    Joined:
    Aug 26, 2015
    Posts:
    111
    Minecraft User:
    DarkSpive
    $player1 = victim (in function)
    $player2 = attacker...

    But if will be $player1 = attacker
    $player2 = victim

    Code wont work
  4. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    It will work either way.
    And no one ever said you have to make $player1 = victim and $player2 = attacker.
    It's your choice on how you use the code, and as I said before it will work either way.
  5. Valeron
    Offline

    Valeron New Member

    Joined:
    Aug 26, 2015
    Posts:
    111
    Minecraft User:
    DarkSpive
    Error: syntax error, unexpected '$this' (T_VARIABLE)
    File: /CastleFlags/src/cas/main
    Line: 90
    Type: E_PARSE

    THIS CRASH WAS CAUSED BY A PLUGIN

    Code:
    [81] break;
    [82] }
    [83] break;
    [84] }
    [85] return true;
    [86] }
    [87] }
    [88]
    [89] function isEnemy($player1,$player2){
    [90] if(in_array($player1, $this->red) && in_array($player2, $this->blue)) {
    [91] return false;
    [92] } elseif(in_array($player1, $this->red) && in_array($player2, $this->blue)) {
    [93] return false;
    [94] } else {
    [95] return true;
    [96] }
    [97]
    [98] public function onEntityDamageByEntity(EntityDamageEvent $event){
    [99] if($event instanceof EntityDamageByEntityEvent){
    [100] $victim = $event->getEntity();

    Backtrace:
    #0 (): pocketmine\Server->crashDump(boolean)
  6. Valeron
    Offline

    Valeron New Member

    Joined:
    Aug 26, 2015
    Posts:
    111
    Minecraft User:
    DarkSpive
    Crashdamp
  7. Valeron
    Offline

    Valeron New Member

    Joined:
    Aug 26, 2015
    Posts:
    111
    Minecraft User:
    DarkSpive
    Also i tried
    PHP:
    PocketMine-Mechanic Crash Dump Sat Nov 7 13:49:40 UTC 2015

    Error
    syntax errorunexpected '$red' (T_VARIABLE)
    File: /CastleFlags/src/cas/main
    Line
    90
    Type
    E_PARSE

    THIS CRASH WAS CAUSED BY A PLUGIN

    Code
    :
    [
    81]                         break;
    [
    82]                 }
    [
    83]                 break;
    [
    84]         }
    [
    85]        return true;
    [
    86]     }
    [
    87]     }
    [
    88]      
    [
    89]       function isEnemy($player1,$player2){
    [
    90]       if(in_array($player1$red) && in_array($player2$blue)) {
    [
    91]          return false;
    [
    92]        } elseif(in_array($player2$red) && in_array($player1$blue)) {
    [
    93]          return false;
    [
    94]        } else {
    [
    95]          return true;
    [
    96]          }
    [
    97
    [
    98]      public function onEntityDamageByEntity(EntityDamageEvent $event){ 
    [
    99]      if($event instanceof EntityDamageByEntityEvent){ 
    [
    100]         $victim $event->getEntity();
  8. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    Did you even define $red and $blue? Anyways, you are adding a bunch of uncessary else statements. This is all you need:
    PHP:
     function isEnemy($player1,$player2) {
         if(
    in_array($player1$this->red) && in_array($player2$this->blue)) {
         return 
    true;
       }
    }
  9. Valeron
    Offline

    Valeron New Member

    Joined:
    Aug 26, 2015
    Posts:
    111
    Minecraft User:
    DarkSpive
    PocketMine-Mechanic Crash Dump Sat Nov 7 13:57:53 UTC 2015

    Error: syntax error, unexpected ' ' (T_STRING)
    File: /CastleFlags/src/cas/main
    Line: 89
    Type: E_PARSE

    THIS CRASH WAS CAUSED BY A PLUGIN

    Code:
    [80] $player->sendMessage("Синие: {$countR} Красные: {$countB}");
    [81] break;
    [82] }
    [83] break;
    [84] }
    [85] return true;
    [86] }
    [87] }
    [88]
    [89] function isEnemy($player1,$player2) {
    [90] if(in_array($player1, $this->red) && in_array($player2, $this->blue)) {
    [91] return true;
    [92] }
    [93] }
    [94]
    [95] public function onEntityDamageByEntity(EntityDamageEvent $event){
    [96] if($event instanceof EntityDamageByEntityEvent){
    [97] $victim = $event->getEntity();
    [98] $attacker = $event->getDamager();
    [99] if($victim instanceof Player && $attacker instanceof Player){

    Backtrace:
  10. Valeron
    Offline

    Valeron New Member

    Joined:
    Aug 26, 2015
    Posts:
    111
    Minecraft User:
    DarkSpive
    Crash
  11. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Do you even know how to code? You seem to not know what you are doing.

    $hi = 2
    $ph = "john cena";

    Will result an unexpected '$ph' error. #ReadTheErrors
    iDirtPlayzMC likes this.
  12. Valeron
    Offline

    Valeron New Member

    Joined:
    Aug 26, 2015
    Posts:
    111
    Minecraft User:
    DarkSpive
    ; is right in my code
  13. Valeron
    Offline

    Valeron New Member

    Joined:
    Aug 26, 2015
    Posts:
    111
    Minecraft User:
    DarkSpive
    Can u help me? Not say to me staff
  14. Valeron
    Offline

    Valeron New Member

    Joined:
    Aug 26, 2015
    Posts:
    111
    Minecraft User:
    DarkSpive
  15. Valeron
    Offline

    Valeron New Member

    Joined:
    Aug 26, 2015
    Posts:
    111
    Minecraft User:
    DarkSpive

Share This Page

Advertisement