Thread: [PI] YellTag, Easier Yell, Yellcolors!

Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1 [PI] YellTag, Easier Yell, Yellcolors! 
    Registered Member
    Join Date
    May 2012
    Posts
    32
    Thanks given
    0
    Thanks received
    1
    Rep Power
    11
    Decided to release my version of yell. There's an option to reset the yelltag/color.

    Look at code, to see how you reset.

    TO DO: Add playerSave yelltag/color.

    TAG:

    Code:
    if (playerCommand.startsWith("yelltag") && playerCommand.length() > 8) { 
         
        if (c.playerRights > 0 && c.playerRights < 6) { 
             
            String tempTag = playerCommand.substring(8); 
            
      if (tempTag.toLowerCase().equals("reset")) {
       c.customYellTag = "";
       c.sendMessage("Yell tag reset.");
       return;
      }
      
            if (c.playerRights != 2) { 
                 
                if (tempTag.length() < 3 || tempTag.length() > 12) {
                    c.sendMessage("Custom yell tags may only be 3-12 characters long!"); 
                    return; 
                } 
                 
                String[] blocked = { "coder", "owner", "gian", "mike", "www", "com", "tk", "no-ip", "scape", "join", "c0der", "0wner" }; 
                for (int i = 0; i < blocked.length; i++) { 
                    if (tempTag.toLowerCase().contains(blocked[i])) { 
                        c.sendMessage("The yell tag you have tried using contains words which arent allowed..."); 
                        c.sendMessage("If you abuse the custom yell tag system your donator rights will be taken away."); 
                        return; 
                    } 
                } 
            } 
             
            c.customYellTag = tempTag; 
            c.sendMessage("Your custom yell tag is now: " + tempTag); 
            c.sendMessage("If you abuse the custom yell tag system, your donator rights will be taken away."); 
             
        } else { 
            c.sendMessage("Only special donators may use this feature."); 
        } 
         
    }
    Color:

    Code:
    if (playerCommand.startsWith("yellcolor")) {
     
     if (c.playerRights > 0 && c.playerRights < 6) {
      
      String tempColor = playerCommand.substring(10);
      if (tempColor.length() > 6 || tempColor.length() < 18) { 
      
       if (tempColor.toLowerCase().startsWith("col=") || tempColor.toLowerCase().startsWith("shad=")) {
        
        try {
         
         int color = Integer.parseInt(tempColor.split("=")[1]);
         c.customYellColor = "<" + tempColor + ">";
         
        } catch (Exception ex) {
         c.sendMessage("Error setting color: " + ex.getMessage());
        }
        
       } else if (tempColor.toLowerCase().equals("blue")
        || tempColor.toLowerCase().equals("purple")
        || tempColor.toLowerCase().equals("green")
        || tempColor.toLowerCase().equals("black")
        || tempColor.toLowerCase().equals("orange")
        || tempColor.toLowerCase().equals("yellow")
        || tempColor.toLowerCase().equals("red")
        || tempColor.toLowerCase().equals("white")
        || tempColor.toLowerCase().equals("reset")) {
        
        if (tempColor.toLowerCase().equals("blue")) {
         c.customYellColor = "<" + "col=255" + ">";
        } else if (tempColor.toLowerCase().equals("purple")) {
         c.customYellColor = "<" + "col=20451204" + ">";
        } else if (tempColor.toLowerCase().equals("green")) {
         c.customYellColor = "<" + "col=255125000" + ">";
        } else if (tempColor.toLowerCase().equals("black")) {
         c.customYellColor = "<" + "col=330000" + ">";
        } else if (tempColor.toLowerCase().equals("orange")) {
         c.customYellColor = "<" + "col=616582400" + ">";
        } else if (tempColor.toLowerCase().equals("yellow")) {
         c.customYellColor = "<" + "col=200000000" + ">";
        } else if (tempColor.toLowerCase().equals("red")) {
         c.customYellColor = "<" + "col=800000000" + ">";
        } else if (tempColor.toLowerCase().equals("white")) {
         c.customYellColor = "<" + "col=99999999" + ">";
        } else if (tempColor.toLowerCase().equals("reset")) {
         c.customYellColor = "";
        }
        
       } else {
        c.sendMessage("Custom yell colors needs to start with 'col=' or 'shad='.");
       }
      } else {
       c.sendMessage("Custom yell colors must only be 3-12 characters long!"); 
      }
     } else {
      c.sendMessage("Only donators may use this feature.");
     }
     
    }
    Yell (Players uses one pk point for each yell):
    Code:
    if (playerCommand.startsWith("yell ")) {
        
        if (!Connection.isMuted(c)) {
      
      if (c.playerRights == 0) {
       if (c.pkPoints >= 100) {
        c.pkPoints -= 1;
       } else {
        c.sendMessage("You need at least 1 pkPoint to do this command!");
        return;
       }
      }
      
      for (int i = 0; i < Server.playerHandler.players.length; i++) {
       Client c2 = (Client) Server.playerHandler.players[i];
       if (c2 != null) {
        String color = "";
        String image = "";
        String prefix = "";
        
        String nameColor = "<col=000000000>";
        
        String optimizedName = Misc.optimizeText(c.playerName);
        String optimizedText = Misc.optimizeText(playerCommand.substring(5));
        
        //PlayerRights
        if (c.playerRights == 1) {
         color = "<col=000000000>";
         image = "<img=0>";
         prefix = "[Member]";
        } else if (c.playerRights == 1) {
         color = "<col=255255255>";
         image = "<img=1>";
         prefix = "[Moderator]";
        } else if (c.playerRights == 2) {
         color = "<col=600000000>";
         image = "<img=2>";
         prefix = "[Admin]";
        } else if (c.playerRights == 3) {
         color = "<col=200000000";
         image = "<img=2>";
         prefix = "[Owner]<img=2>";
        } else if (c.playerRights == 4) {
         color = "<shad=6081134>";
         image = "<img=0>";
         prefix = "[Donator]";
        } else if (c.playerRights == 5) {
         color = "<col=60811334>";
         image = "<img=3>";
         prefix = "[Extreme Donator]";
        }
        
        //Override
        //PlayerNames
        if (c.playerName.toLowerCase().equals("")) {
         color = "<col=000000000>";
         image = "<img=0>";
         prefix = ""; //Add what you want here
        } else if (c.playerName.toLowerCase().equals("")) { //Add whatever u want
         color = "<col=000000000>";
         image = "<img=0>";
         prefix = "[Default]";
        }
        
        //Override
        //YellTag
        if (!c.customYellTag.equals("")) {
         prefix = "[" + c.customYellTag + "]";
        }
        
        //Override
        //YellColor
        if (!c.customYellColor.equals("")) {
         color = c.customYellColor;
         nameColor = c.customYellColor;
        }
        
        c2.sendMessage(color + image + " " + prefix + "</col> " + nameColor + optimizedName + ": " + optimizedText);
       }
      }
            
        } else {
            c.sendMessage("You are muted and cannot yell.");
        }

    You can figure where you put this! (Not going to spoonfeed):
    Code:
    public int yellDelay = 0;
    public String lastYell = "";
    public String customYellTag = "";
    public String customYellColor = "";
    Please don't release this saying it's yours!

    If you like this, don't forget to leave a thanks down below!

    Tell me if I'm missing something as well, if you need help post it below as well.


    First thread on Rune-server! (Sorry a bit new to this!)
    "An Eye for an Eye, makes the world go blind."
    Reply With Quote  
     

  2. #2  
    Banned

    Join Date
    Jan 2012
    Posts
    593
    Thanks given
    527
    Thanks received
    319
    Rep Power
    0
    Not bad. As an improvement however, rather than having a hardcoded array containing all words you'd like to be blocked, you could load them from the cache (contains all cuss words and website addresses TLD's - this however won't really fit into PI, which does no other cache operations). The use of enumerations would also improve this, but nice job.
    Reply With Quote  
     

  3. #3  
    Ignorance is always an excuse

    Mikee's Avatar
    Join Date
    Nov 2009
    Posts
    2,370
    Thanks given
    732
    Thanks received
    490
    Rep Power
    656
    Quote Originally Posted by Satam View Post
    String[] blocked = { "coder", "owner", "gian", "mike", "www", "com", "tk", "no-ip", "scape", "join", "c0der", "0wner" };
    for (int i = 0; i < blocked.length; i++) {
    if (tempTag.toLowerCase().contains(blocked[i])) {
    c.sendMessage("The yell tag you have tried using contains words which arent allowed...");
    c.sendMessage("If you abuse the custom yell tag system your donator rights will be taken away.");
    return;
    }
    }
    }
    This part caught my attention. This was back from when I helped my friend Gian with his server.

    Cool updates.

    Welcome to Rune-Server by the way, I see this was your first post.



    The day Aj repped me, my life changed forever
    Quote Originally Posted by Aj View Post
    Rep++ for you
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    May 2012
    Posts
    32
    Thanks given
    0
    Thanks received
    1
    Rep Power
    11
    Quote Originally Posted by Mikee View Post
    This part caught my attention. This was back from when I helped my friend Gian with his server.

    Cool updates.

    Welcome to Rune-Server by the way, I see this was your first post.
    Haha, thanks, and that part was indeed from someone else. Thanks for noticing, and welcoming me.
    "An Eye for an Eye, makes the world go blind."
    Reply With Quote  
     

  5. #5  
    Why are you looking here?


    Join Date
    Jul 2012
    Age
    30
    Posts
    3,214
    Thanks given
    830
    Thanks received
    357
    Rep Power
    559
    Good job,thanks
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    May 2012
    Posts
    32
    Thanks given
    0
    Thanks received
    1
    Rep Power
    11
    Quote Originally Posted by Bosslad View Post
    Not bad. As an improvement however, rather than having a hardcoded array containing all words you'd like to be blocked, you could load them from the cache (contains all cuss words and website addresses TLD's - this however won't really fit into PI, which does no other cache operations). The use of enumerations would also improve this, but nice job.
    Not really big for PI I suppose, but yeah that part like I mentioned before was from someone else, if I can get his name I'll put his credits. :/
    "An Eye for an Eye, makes the world go blind."
    Reply With Quote  
     

  7. #7  
    Ignorance is always an excuse

    Mikee's Avatar
    Join Date
    Nov 2009
    Posts
    2,370
    Thanks given
    732
    Thanks received
    490
    Rep Power
    656
    Quote Originally Posted by Satam View Post
    that part like I mentioned before was from someone else, if I can get his name I'll put his credits. :/
    I coded the yelltag part for my friend Gian like I said before.

    It was one of the only times I've ever coded a PI



    The day Aj repped me, my life changed forever
    Quote Originally Posted by Aj View Post
    Rep++ for you
    Reply With Quote  
     

  8. #8  
    Registered Member
    Join Date
    May 2012
    Posts
    32
    Thanks given
    0
    Thanks received
    1
    Rep Power
    11
    Quote Originally Posted by Mikee View Post
    I coded the yelltag part for my friend Gian like I said before.

    It was one of the only times I've ever coded a PI
    I swore, I saw it in a snippet or in a tutorial section... Or was that you?
    Oh well, guess I'll have to search for it later.
    "An Eye for an Eye, makes the world go blind."
    Reply With Quote  
     

  9. #9  
    Ignorance is always an excuse

    Mikee's Avatar
    Join Date
    Nov 2009
    Posts
    2,370
    Thanks given
    732
    Thanks received
    490
    Rep Power
    656
    Quote Originally Posted by Satam View Post
    I swore, I saw it in a snippet or in a tutorial section... Or was that you?
    Oh well, guess I'll have to search for it later.
    I actually sold the source to some idiot who scammed my friend Gian.

    If there's a "Server Manager" jar file in your data files that was also coded by me.
    (The base was very unstable, the manager was for checking items/rank & "trimming" the economy)



    The day Aj repped me, my life changed forever
    Quote Originally Posted by Aj View Post
    Rep++ for you
    Reply With Quote  
     

  10. #10  
    Banned

    Join Date
    Oct 2009
    Posts
    438
    Thanks given
    29
    Thanks received
    108
    Rep Power
    0
    Instead of a massive if/else statement you can utilise the use of switch blocks.


    Quote Originally Posted by Bosslad View Post
    Not bad. As an improvement however, rather than having a hardcoded array containing all words you'd like to be blocked, you could load them from the cache (contains all cuss words and website addresses TLD's - this however won't really fit into PI, which does no other cache operations). The use of enumerations would also improve this, but nice job.
    Ya, I like this guy.
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. [PI] Yelltag
    By Mr House in forum Tutorials
    Replies: 23
    Last Post: 09-05-2012, 11:57 AM
  2. Replies: 11
    Last Post: 12-23-2011, 02:10 AM
  3. [PI] Customizable Yell Tags > Better Yell System
    By I try too hard in forum Help
    Replies: 6
    Last Post: 08-04-2011, 03:59 PM
  4. yelltag not saving on logout
    By OodlesOfNoodles in forum Help
    Replies: 18
    Last Post: 08-01-2011, 06:40 PM
  5. yelltag with color and icons
    By OodlesOfNoodles in forum Help
    Replies: 2
    Last Post: 07-29-2011, 09:38 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •