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

How to these things

Comments in 'Plugin Development' started by CaptainKenji17, Oct 19, 2015.

  1. CaptainKenji17
    Offline

    CaptainKenji17 Active Member

    Joined:
    Apr 22, 2014
    Posts:
    252
    Minecraft User:
    CaptainKenji17
    1. How do you set health of player in-game? like adding hearts? (with Katana) like LegionPE?

    2. How do you send a message to public? not only in 1 player?

    3. how to mute player with timer?
    ItsMegaMCPE likes this.
  2. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    second's answer :
    PHP:
    $this->getServer()->broadcastMessage("TROLOLOLOL");
    Last edited: Oct 19, 2015
    SeifValkierks and CaptainKenji17 like this.
  3. CaptainKenji17
    Offline

    CaptainKenji17 Active Member

    Joined:
    Apr 22, 2014
    Posts:
    252
    Minecraft User:
    CaptainKenji17
    whats the first?

    $p->setHealth(40);
    $p->getMaxHealth(40); Don't work
  4. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    I supose it's broken.
    Third's answer: if(in_array($player->getName(), $this->muted, true)) $e->setCancelled();
  5. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    You're making it hard...
    PHP:
    public function onChat(PlayerChatEvent $event){
    $muted = array("MutedPlayer1""MutedPlayer2"); //etc..

    if($event->getPlayer()->getName() == in_array($muted){
    $event->setCancelled(true);
    }
    }
  6. CaptainKenji17
    Offline

    CaptainKenji17 Active Member

    Joined:
    Apr 22, 2014
    Posts:
    252
    Minecraft User:
    CaptainKenji17
    HOw do u add 10 seconds of mute?
  7. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    Check EssentialsPE's Code :p
  8. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    http://php.net/manual/en/function.in-array.php
  9. CaptainKenji17
    Offline

    CaptainKenji17 Active Member

    Joined:
    Apr 22, 2014
    Posts:
    252
    Minecraft User:
    CaptainKenji17
    PHP:
        public function onChat(PlayerChatEvent $ev){
        
    $p $ev->getPlayer();
        
    $pl $ev->$getPlayer()->getName();
        
    $badwords = array("fuck","pussy","bitch","nigga","cunt","whore","asshole","dick","pene""penis","cock","hoe","stfu","kys","sma","smd","asshole","ass","fuckboi","fuckboy","cocksucker","dick","dicksucker","penissucker");
        
    $msg explode(" ",$ev->getMessage());
        foreach(
    $msg as $word){
        foreach(
    $badwords as $m){
        if(
    strtolower($word) === $m){
        
    $this->getServer()->BroadcastMessage("§e-§c§lCalm down§a" $pl);
        
    $p->sendMessage("§cYou have been muted for 10 seconds");
    I just wanted to add a 10 seconds time muter on this
  10. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    use time()
    CaptainKenji17 likes this.
  11. CaptainKenji17
    Offline

    CaptainKenji17 Active Member

    Joined:
    Apr 22, 2014
    Posts:
    252
    Minecraft User:
    CaptainKenji17
    how lol cant u copy the code and add it and send here?
  12. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    PHP:
    if(isset($this->history[$player->getName()])){
       if(
    $this->history[$player->getName()] >= time()){
          
    // Calm down time has been expired
          
    $this->history[$player->getName()] = time() + 10;
       }else{
          
    $player->sendMessage('Dont chat so fast.');
       }
    } else {
       
    $this->history[$player->getName()] = time() + 10;
    }
    CaptainKenji17 likes this.
  13. CaptainKenji17
    Offline

    CaptainKenji17 Active Member

    Joined:
    Apr 22, 2014
    Posts:
    252
    Minecraft User:
    CaptainKenji17
    PHP:
        public function onChat(PlayerChatEvent $ev){
        
    $p $ev->getPlayer();
        
    $pl $ev->$getPlayer()->getName();
        
    $badwords = array("fuck","pussy","bitch","nigga","cunt","whore","asshole","dick","pene""penis","cock","hoe","stfu","kys","sma","smd","asshole","ass","fuckboi","fuckboy","cocksucker","dick","dicksucker","penissucker");
        
    $msg explode(" ",$ev->getMessage());
        foreach(
    $msg as $word){
        foreach(
    $badwords as $m){
        if(
    strtolower($word) === $m){
        
    $this->getServer()->BroadcastMessage("§e-§c§lCalm down§a" $pl);
        
    $p->sendMessage("§cYou have been muted for 10 seconds");
        if(isset(
    $this->history[$p->getName()])){
       if(
    $this->history[$p->getName()] >= time()){
          
    // Calm down time has been expired
          
    $this->history[$p->getName()] = time() + 10;
    } else {
       
    $this->history[$player->getName()] = time() + 10;
    wil that work now?

    shh ik im bad at coding Im just trying to learn by this
  14. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Side notes:
    LegionPE uses Katana. It does some backs with the Attribute manager, which does not work with PocketMine.

    LegionPE uses a complex method of muting. There is a kind of Hormone called MuteHormone, which will tell receptor servers to block chat from players of that IP or username until a certain timestamp. You can look at http://lgpe.co/tsrc for reference.
    CaptainKenji17 likes this.
  15. TryoneLegendZzz
    Offline

    TryoneLegendZzz Active Member

    Joined:
    May 31, 2015
    Posts:
    201
    Minecraft User:
    SavionLegendZzz
    love the fact that you used my code :D
  16. CaptainKenji17
    Offline

    CaptainKenji17 Active Member

    Joined:
    Apr 22, 2014
    Posts:
    252
    Minecraft User:
    CaptainKenji17
    is your code that really looks 'Amazing' to you? I Don't think so
  17. CavinMiana
    Offline

    CavinMiana Active Member

    Joined:
    Aug 26, 2015
    Posts:
    101
    Minecraft User:
    CavinMiana
    Ehh you kinda did use his code
  18. CaptainKenji17
    Offline

    CaptainKenji17 Active Member

    Joined:
    Apr 22, 2014
    Posts:
    252
    Minecraft User:
    CaptainKenji17
    I didn't steal it or what, I've tried to update it if possible with some helps by these developers. It was the plugin from BearGames which needs to be updated because of the poor idea and code. yes, it's his code, Any problem?
  19. CavinMiana
    Offline

    CavinMiana Active Member

    Joined:
    Aug 26, 2015
    Posts:
    101
    Minecraft User:
    CavinMiana
    Nah I was just saying...
  20. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    I never understood where all those LegionPE's 'Hormones' go to...
    TryoneLegendZzz likes this.

Share This Page

Advertisement