[TuT]How to Create a ClanChat[TuT]

Results 1 to 13 of 13
  1. #1
    Apprentice xxv0iderxx is offline
    MemberRank
    Oct 2008 Join Date
    24Posts

    [TuT]How to Create a ClanChat[TuT]

    Make A Clan Chat!

    Purpose: How to add a ClanChat on your server as a command code.

    Description: This allows you to make a code that makes you join a user's clan and talk in that user's clan only. Perfect for Castle Wars or other team activities.

    Difficulty: 3/10 (If you really get stuck, that is the problem)

    Source used:
    Void-Pkz (:D)

    Files Modified:
    Client.java

    Step 1.


    Look for this specific code:
    Code:
    public String specbar;
    Now under that, add this:
    Code:
    public String clan = null;	// Clan Chat  by xx v0ider xx

    Step 2:


    After that code was added, all you have to do is do the command for the joining the clan

    Go look for this code:
    Code:
      if (command.equalsIgnoreCase("god") && playerRights >= 2) {
    (Some servers may not have this code, so I recommend to the people that do not have this to look for:
    Code:
    if (command.equalsIgnoreCase("
    As a beginning command code)

    Now under that TYPE of coding, add in:
    Code:
    }
    if (command.toLowerCase().startsWith("joinclan")) {
    		try {
    			clan = command.substring(8);
    			sendMessage("You have joined the clan chat "+clan);
    		for(int i = 0; i < 50; i++) {
    			client p2 = (client) server.playerHandler.players[i];
    		if(p2.clan.equalsIgnoreCase(clan) && !p2.playerName.equals(playerName) && p2 != null) {
    			p2.sendMessage(playerName+" has joined the clan chat."); // by xx v0ider xx
    				}
    			}
    		} catch(Exception e) {
    	}
    So this is the code to join a clan of a friend on the server you know. An example to use this is ::joinclan xx v0ider xx. And it should say
    Code:
     " xx v0ider xx has joined the clan chat."
    Easy so far?

    Ok now how to talk on in the clan chat. Under the code you just added, add this code to talk now:
    Code:
    }
    if (command.startsWith("clan")) {
    	 try {
    	 for (int i = 0; i < server.playerHandler.maxPlayers; i++) {
    			client toClan = (client) server.playerHandler.players[i];
    	  if (toClan != null && toClan.clan.equalsIgnoreCase(clan) && clan != null) {
    		 	toClan.sendMessage("["+clan+"] " +playerName+": "+command.substring(5)+"");  // by xx v0ider xx
    						 }
    			   } 
    		} catch(Exception e) {
    	  }
    }
    Ok now for this, the way to this is, you do the code ::clan "type your message", like ::clan hi. This will turn up as
    Code:
    [Clan Name] xx v0ider xx: Hi.

    Step 3:


    Now that you know how to use your clan chat, other people on the server need to have a guide of how to use it. So this is how you are going to do it.


    Ok to place this code, put it under the
    Code:
    public void
    region to make it simpler. Or you can use your welcome screen menu and put the code under that because the text is going to be the same as that.

    After you done finding that, add this:
    Code:
    }	
    	
    	public void ClanHelpMenu() {
    
    	   //misc interface
    clearQuestInterface();
    sendQuest("Close Window", 18447);//Close Text//By 0wner  v0id
    sendQuest("Clan Help", 18450);//Title
    sendQuest("", 18451);//Sub Title
    sendQuest("1. Do ::join + Usersname clan name u wanna join", 18439);//Line 1
    sendQuest("", 18440);//Line 2
    sendQuest("2. ::clan [Say] ", 18441);//Line 3
    sendQuest("To tell your clan what you wanna say", 18442);//Line 4
    sendQuest("", 18443);//Line 5
    sendQuest("Sorry for being basic, but atleast we have one X[)", 18446);//Line 6
    sendQuest("Enjoy!", 18445);//Line 7
    sendQuest("", 18444);//Line 8
    showInterface(18436);
    flushOutStream(); // by xx v0ider xx
    	}
    Ok now, we are going to need to put this guide as a code so when someone types in the command code, this guide pops up.

    Look for this:
    Code:
    } else if (command.equalsIgnoreCase("home")) {
    Under that add this:
    Code:
    } else if (command.equalsIgnoreCase("clanhelp")) {
    		
    			ClanHelpMenu(); //by xx v0ider xx

    You are basically done, Save & Compile. :)


    Here are some pictures for example:

    Joining the ClanChat


    Talking in the Chat


    Clan Chat Help Menu



    Credits

    Me


  2. #2
    Apprentice Sorz is offline
    MemberRank
    Oct 2008 Join Date
    12Posts

    Re: [TuT]How to Create a ClanChat[TuT]

    Actually you couldnt tell someone to add it under this

    public String clan = null;
    You dragged that out of your client.java which not everyone has specials, therefor you could have easily told the to declare it and where to declare it instead of telling them to add it under something they may not have.

  3. #3
    Apprentice xxv0iderxx is offline
    MemberRank
    Oct 2008 Join Date
    24Posts

    Re: [TuT]How to Create a ClanChat[TuT]

    Alright lol...

  4. #4
    Account Upgraded | Title Enabled! tj960 is offline
    MemberRank
    Feb 2007 Join Date
    United Kingdom (England)Location
    209Posts

    Re: [TuT]How to Create a ClanChat[TuT]

    Quite nice, but you should use a chat mask so it is "/ message"

  5. #5
    change my name already! I Rule MU is offline
    MemberRank
    Apr 2007 Join Date
    JerseyLocation
    4,220Posts

    Re: [TuT]How to Create a ClanChat[TuT]

    Aye this is awsome. We have clan wars at ragescape and this could help!

  6. #6
    Apprentice Eddie12390 is offline
    MemberRank
    Jun 2007 Join Date
    14Posts

    Re: [TuT]How to Create a ClanChat[TuT]

    It gives me 15 errors when I put in. I didn't really know where to put public void ClanHelpMenu()

  7. #7
    Apprentice xxv0iderxx is offline
    MemberRank
    Oct 2008 Join Date
    24Posts

    Re: [TuT]How to Create a ClanChat[TuT]

    Quote Originally Posted by Eddie12390 View Post
    It gives me 15 errors when I put in. I didn't really know where to put public void ClanHelpMenu()
    Put it under the interface for your welcome screen.

    Thanks guys for your support.

  8. #8
    Apprentice Eddie12390 is offline
    MemberRank
    Jun 2007 Join Date
    14Posts

    Re: [TuT]How to Create a ClanChat[TuT]

    I just had to remove a } that I added extra, i feel stupid :(

    As soon as the owner of the dedi gets online i'll send him the updated client.java

    Thanks a bunch :)

  9. #9
    Proficient Member Syntax. is offline
    MemberRank
    Jul 2008 Join Date
    Chip SticksLocation
    167Posts

    Re: [TuT]How to Create a ClanChat[TuT]

    Nice tutorial v0id.

  10. #10
    Member sambroughton is offline
    MemberRank
    Jul 2007 Join Date
    Leicester WOOTLocation
    79Posts

    Re: [TuT]How to Create a ClanChat[TuT]

    Good coding, but you should really explain in MORE detail what everything does exactly. 7/10

  11. #11
    Apprentice xxv0iderxx is offline
    MemberRank
    Oct 2008 Join Date
    24Posts

    Re: [TuT]How to Create a ClanChat[TuT]

    If you do not understand the title, then....o.O

  12. #12
    Novice Darkmagic42 is offline
    MemberRank
    Aug 2010 Join Date
    1Posts

    Re: [TuT]How to Create a ClanChat[TuT]

    i dont have public string specbar, so where would i add it under?

  13. #13
    There's no RL just AFK -fedexer- is offline
    MemberRank
    May 2006 Join Date
    ScotlandLocation
    1,632Posts

    Re: [TuT]How to Create a ClanChat[TuT]

    This is why specific tutorials are annoying... what you must do is just add that code in question, in with the other public variable definitions in your source, don't look for that public string in particular, just look for any public variable or definition.



Advertisement