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

Help with Capture the flag plugin

Comments in 'Plugin Development' started by mclab, Jan 11, 2015.

  1. mclab
    Offline

    mclab Active Member

    Joined:
    Dec 24, 2014
    Posts:
    49
    Minecraft User:
    Dragonflex
    Plugin (zip) : http://www.mediafire.com/download/116j3axw9xxh7b6/mcg76_CTF_v1.2.1.zip

    How to do that players from the same team could not kill each other? (Sorry for my english)

    Or, if someone want to make for me plugin....
    I want to make simple Team PvP plugin. To this end, I would like to redo the CTF.
    I think it would be easier to add the missing code to that plugin, than do new...
    But it's not up to me depends

    Thanks! (I hope that you will help me ^^)

    Per obtained help, I am able to do the graphics. I am graphics designer.
    One of my works: http://4mweb.pl/uu.jpg (not finished)
    Last edited: Jan 11, 2015
  2. KnightRider
    Offline

    KnightRider New Member

    Joined:
    Sep 2, 2013
    Posts:
    13
    Minecraft User:
    KnightRider
    Pretty sure you can't use that plugin at all.
    It looks like it was made for PM 1.3

    For 1.4 you will need a complete re-write I believe.
  3. mclab
    Offline

    mclab Active Member

    Joined:
    Dec 24, 2014
    Posts:
    49
    Minecraft User:
    Dragonflex
    It works perfectly, but "How to do that players from the same team could not kill each other? (Sorry for my english)"

    Thanks for your reply!

    PHP:
    public function onEntityDamage (EntityDamageEvent $event) {
    if (????){
    $event->setCancelled(true);
    }else{
    return 
    true;
    }
    }
    Last edited: Jan 11, 2015
  4. Praxthisnovcht
    Offline

    Praxthisnovcht Notable Member Plugin Developer

    Joined:
    Mar 10, 2014
    Posts:
    702
    Plugins:
    4
    Minecraft User:
    PraxHellTag
    look in FactionsPro you will find your answer
  5. TonyDroidd
    Offline

    TonyDroidd Active Member

    Joined:
    Sep 6, 2014
    Posts:
    180
    Minecraft User:
    TonyDroidd
    contact the plugin developer, send mail to MinecraftGenius96!
  6. Angelo Vidrio
    Offline

    Angelo Vidrio Active Member Plugin Developer

    Joined:
    Jan 16, 2014
    Posts:
    123
    Plugins:
    5
    Minecraft User:
    LilCrispy45
    Create a team1.yml and team2.yml, then create a function that will be
    PHP:
    public function getSameTeam ($player1$player2) {
    if (
    $this->team1->get($player1) && $this->team1->get($player2) ) {
         return 
    true;
    }elseif (
    $this->team2->get($player1) && $this->team2->get($player2) ) {
         return 
    true;
    }else{
         return 
    false;
    Now for the listener just use:
    PHP:
    public function onEntityDamage (EntityDamageEvent $event) {
    $player $event->getEntity();
    $damager $event->getDamager();
    if (
    $this->getSameTeam($player$damager){
    $event->setCancelled(true);
    }else{
    return 
    true;
    }
    }
    xFlare likes this.
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    That is VERY slow. You don't want to create a file for each team in each tournament.
    iksaku, Tuff and iJoshuaHD like this.
  8. Angelo Vidrio
    Offline

    Angelo Vidrio Active Member Plugin Developer

    Joined:
    Jan 16, 2014
    Posts:
    123
    Plugins:
    5
    Minecraft User:
    LilCrispy45
    But after the match you can delete it.
  9. PluginMastered
    Offline

    PluginMastered Active Member

    Joined:
    Mar 1, 2014
    Posts:
    161
    Minecraft User:
    Flexa33
    That would also be slow can't we just overwrite .yml teams File each time a tournament has ended? If not he would have to have scheduled Events like CTF at 5 PM ect.
  10. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,132
    Plugins:
    4
    Minecraft User:
    iksaku
    How so you separate them currently? Use a sessioning system for that, it's faster and easier to use
  11. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    That is not the point. It is that while you could just use an array, why must you use a Config object, whether you save it or not?
  12. mclab
    Offline

    mclab Active Member

    Joined:
    Dec 24, 2014
    Posts:
    49
    Minecraft User:
    Dragonflex
    Very thanks all for help!

    I want to make Battlefield plugin, not CTF, i wanted rebuild CTF plugin :)
    Idea @Angelo Vidrio is very good, but maybe better is Sqlite?
    I thinking about 2 options.

    1. 2 teams, white and red
    2. Everyone can make team (Limit players in 1 team = 3) for coins. Coins can be gained, when you killed someone. :)

    I think... I will choose second option :)

    Topic can be closed and MANY THANKS!
  13. Junhua
    Offline

    Junhua Active Member

    Joined:
    Dec 2, 2014
    Posts:
    103
    Minecraft User:
    Pro1000

    Good luck with the plugin!!
  14. mclab
    Offline

    mclab Active Member

    Joined:
    Dec 24, 2014
    Posts:
    49
    Minecraft User:
    Dragonflex
  15. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,132
    Plugins:
    4
    Minecraft User:
    iksaku
    Don't save temporal data inside files, that will make your server slow :( it's better to use objects, properties or arrays to store that data and keep it as long as needed ;)
    PEMapModder and Junhua like this.

Share This Page

Advertisement