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

[PhP] Factions code

Comments in 'Plugin Development' started by PolskiTHEPLAYER, Feb 17, 2016.

  1. PolskiTHEPLAYER
    Offline

    PolskiTHEPLAYER New Member

    Joined:
    Apr 1, 2015
    Posts:
    55
    Minecraft User:
    Flsmers
    PHP:
     if($args[0] == "create") {
                            if(!isset(
    $args[1])) {
                                
    $sender->sendMessage($this->plugin->formatMessage("§c • Wpisz komende - /f create <nazwa gildi> • "));
                                return 
    true;
                            }
                            if(!(
    ctype_alnum($args[1]))) {
                                
    $sender->sendMessage($this->plugin->formatMessage(""));
                                return 
    true;
                            }
                            if(
    $this->plugin->isNameBanned($args[1])) {
                                
    $sender->sendMessage($this->plugin->formatMessage("§c • Nazwa gildi jest niedozwolona • "));
                                return 
    true;
                            }
                            if(
    $this->plugin->factionExists($args[1]) == true ) {
                                
    $sender->sendMessage($this->plugin->formatMessage("§c • Taka gildia już jest • "));
                                return 
    true;
                            }
                            if(
    strlen($args[1]) > $this->plugin->prefs->get("MaxFactionNameLength")) {
                                
    $sender->sendMessage($this->plugin->formatMessage("§c • Nazwa gildi jest za długa • "));
                                return 
    true;
                            }
                            if(
    $this->plugin->isInFaction($sender->getName())) {
                                
    $sender->sendMessage($this->plugin->formatMessage("§c • Opuść gildie aby stworzyć nową • "));
                                return 
    true;
                            } else {
        }                  
    if(
    /*MONEY*/ true){  
                                    if(
    $this->owner->fmanager->createFaction($factionName)){                                    /*MONEY*/                                    $faction $this->owner->getFaction($factionName);                                  
    $faction->addPlayer($sender'Leader'null);                                  
    $sender->sendTip($this->owner->mformatter->formatMessage('Paid - './*MONEY*/null.''));                  
    $sender->sendMessage($this->owner->mformatter->formatMessage('You\'ve sucessfully created new faction: '.$faction.''MessageFormat::SUCCESS));
            return 
    true;  
                                }
                                }else{  
                                       }
            
    $sender->sendMessage($this->owner->mformatter->formatMessage('You dont have enough money to create new Faction'));                                         return true;
                                    }
                                      }else{
                                            }
    Plzz editi this code for me Help!
    Last edited: Feb 17, 2016
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    What kind of edit do you want? Please specify.
    PocketKiller likes this.
  3. PolskiTHEPLAYER
    Offline

    PolskiTHEPLAYER New Member

    Joined:
    Apr 1, 2015
    Posts:
    55
    Minecraft User:
    Flsmers
    That code no work :(
  4. KubixQ
    Offline

    KubixQ Active Member

    Joined:
    Sep 13, 2015
    Posts:
    85
    Minecraft User:
    KubixQ
    Really??
    You know pm-mp api / php ?
    BTW ARE YOU READING MY REPLIES? Is it hard to post code in [PHP]&[/PHP] tags?
  5. PolskiTHEPLAYER
    Offline

    PolskiTHEPLAYER New Member

    Joined:
    Apr 1, 2015
    Posts:
    55
    Minecraft User:
    Flsmers
  6. KubixQ
    Offline

    KubixQ Active Member

    Joined:
    Sep 13, 2015
    Posts:
    85
    Minecraft User:
    KubixQ
    already*
  7. KubixQ
    Offline

    KubixQ Active Member

    Joined:
    Sep 13, 2015
    Posts:
    85
    Minecraft User:
    KubixQ
    What is mformatter & what is "/*MONEY*/" ?
  8. PolskiTHEPLAYER
    Offline

    PolskiTHEPLAYER New Member

    Joined:
    Apr 1, 2015
    Posts:
    55
    Minecraft User:
    Flsmers
    Money economyapi
  9. KubixQ
    Offline

    KubixQ Active Member

    Joined:
    Sep 13, 2015
    Posts:
    85
    Minecraft User:
    KubixQ
    Nope, can you see EconomyAPI documentation?
  10. AndrewBit
    Offline

    AndrewBit Notable Member

    Joined:
    Jun 18, 2015
    Posts:
    435
    Minecraft User:
    AndrewBit4
    Well, first of all:
    Why are you publishing by second time the same post? I suggest you bump your old post the next time. You'll be helping PocketMine to be cleaner.

    And now, I predicted that you're trying to make factionspro create command a pay command, if the answer is yes, I never learn EconomyAPI source, but I'm pretty sure that getMoney($player) and setMoney($player, $money) functions exists
    You can try this:
    PHP:
    if(($current_money EconomyAPI::getInstance()->getMoney($player)) == /* This should be a integer, the min money that the player should have.*/ 10){
    EconomyAPI::getInstance()->setMoney($player$current_money /* price*/ 10);
    }
    PocketKiller likes this.
  11. PolskiTHEPLAYER
    Offline

    PolskiTHEPLAYER New Member

    Joined:
    Apr 1, 2015
    Posts:
    55
    Minecraft User:
    Flsmers
    What past that code?
  12. AndrewBit
    Offline

    AndrewBit Notable Member

    Joined:
    Jun 18, 2015
    Posts:
    435
    Minecraft User:
    AndrewBit4
    Uhm, can you explain your question? I didn't understand you.
    PocketKiller and KubixQ like this.
  13. KubixQ
    Offline

    KubixQ Active Member

    Joined:
    Sep 13, 2015
    Posts:
    85
    Minecraft User:
    KubixQ
    Probably he asking you where paste your code in FactionsPro code... -,-
  14. AndrewBit
    Offline

    AndrewBit Notable Member

    Joined:
    Jun 18, 2015
    Posts:
    435
    Minecraft User:
    AndrewBit4
    Oh...
    He's a PHP programmer? He should know where "paste" it...
    IcePL likes this.
  15. KubixQ
    Offline

    KubixQ Active Member

    Joined:
    Sep 13, 2015
    Posts:
    85
    Minecraft User:
    KubixQ
    He's king of PHP! XDD
    PocketKiller, IcePL and AndrewBit like this.
  16. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I think you are getting confusion here.
    php tag.PNG

    Now, back to the topic, @PolskiTHEPLAYER please, your question is unclear. PocketMine Forums are not a magic cleaner where you put some code in and you would get an automatically fixed version two days here. Please, provide as much information as possible, for example, how it is not working.
    KubixQ, Vaivez66 and PocketKiller like this.

Share This Page

Advertisement