Thread: Member Area Teleporting (Like RS)

Page 1 of 3 123 LastLast
Results 1 to 10 of 25
  1. #1 Member Area Teleporting (Like RS) 
    Banned

    Join Date
    Jan 2007
    Posts
    260
    Thanks given
    3
    Thanks received
    5
    Rep Power
    0
    This tutorial will teach you how to properly add Premium member only areas.

    Purpose
    If a character who is not a member attempts to get in the member only area then it will teleport the non-premium character out of the member area and send them a message that say's they need to subscribe to be in that area.

    Source Tested On
    Deltascape, but it should work on all with some tiny modifications..

    To begin with you need to add the following to your server, I take no credit for this part of the tutorial (I can't remember who made this part though..)

    1)Open up your config folder and make a file called members.text

    2)Add the following code next to some other int's:
    Code:
    public int checkmembers()
    	{
    		try
    		{
    			BufferedReader in = new BufferedReader(new FileReader("config/members.txt"));
    			String data = null;
    			while ((data = in.readLine()) != null) {
    				if (playerName.equalsIgnoreCase(data)) {
    					return 5;
    				}
    			}
    		} catch (IOException e)
    		{
    			System.out.println("Critical error while check members!");
    			e.printStackTrace();
    		}
    		return 0;
    	}
    That is all we will be using from the other person's tutorial, I will explain what it does though.

    Explanation of Step 2
    What the above code does is checks the file "members.text" to see whether or not a player is a member. If a player is a member then it returns a 5, if the player isn't a member then it doesn't return a 5.

    3)Now we are going to add another void, it is almost the same as the IsInWilderness Void found in most sources.
    So, add this code:
    Code:
    public boolean memberArea(int coordX, int coordY, int Type) {
    		if (Type == 3) {
    			if ((coordY >= XXXX) && (coordY <= XXXX) && (coordX <= XXXX)
    					&& (coordX >= XXXX)) {
    				return true;
    			}
    		} else if (Type == 4) {
    			if ((coordY >= XXXX) && (coordY <= XXXX) && (coordX <= XXXX)
    					&& (coordX >= XXXX)) {
    				return true;
    			}
    		}
    		return false;
    	}
    So to add a member only area fill in the "X's" with the COORDS of the area you want to be members only. You would fill in the COORDS the same way you would add them to a safezone.

    If you wanted to add a new area other then the 2 that I put options for then you would put the following code in after the
    Code:
    return true;
    }
    and put
    Code:
    } else if (Type == 5) {
    			if ((coordY >= XXXX) && (coordY <= XXXX) && (coordX <= XXXX)
    					&& (coordX >= XXXX)) {
    				return true;
    			}
    		}
    and so on.. All you have to do is change the "Type == 5" to "Type == WHATEVER"

    So now we need to make the server check for whether or not a player is in the memberArea. To do this go into your boolean process and add the following:
    Code:
    if (memberArea(absX, absY, 3)) /*Start Runeore Premium membership check and teleport*/
    		{
    			if (checkmembers() != 5)
    			{
    				sM("Sorry this is a member's only area, please purchase");
    				sM("a membership pin from the Runeore Forums!");
    				toX = 3092;
    				toY = 3499;
    			}
    		}
    Explanation of the above code:
    The above code is basically saying that if a player is in a memberArea then the server need's to check whether or not the player is premium or not. If the player is not premium then he will be sent a message and teleported to the above codes.

    Code:
    (memberArea(absX, absY, 3))
    What that code means is that it's using the memberArea int to check what COORDS are member only. The only thing you need to worry about in that part of the code is
    Code:
    , 3))
    Replace that with whatever your "Type ==" From above.

    I think that is explained pretty thoroughly, if you didn't understand something or you get errors then post back here.
    Reply With Quote  
     

  2. #2  
    Registered Member
    minutes's Avatar
    Join Date
    Apr 2008
    Posts
    1,926
    Thanks given
    2
    Thanks received
    19
    Rep Power
    465
    nice job wont use this but all f2p coders gona use this i think
    [Only registered and activated users can see links. ]
    click banner to join gtracer!
    Reply With Quote  
     

  3. #3  
    SERGEANT OF THE MASTER SERGEANTS MOST IMPORTANT PERSON OF EXTREME SERGEANTS TO THE MAX!

    cube's Avatar
    Join Date
    Jun 2007
    Posts
    8,881
    Thanks given
    1,854
    Thanks received
    4,741
    Rep Power
    5000
    "Like RS", too bad RS doesn't have a feature like this.



    Reply With Quote  
     

  4. #4  
    Donator

    Ecstasy's Avatar
    Join Date
    Sep 2008
    Age
    26
    Posts
    5,032
    Thanks given
    324
    Thanks received
    596
    Rep Power
    843
    Quote Originally Posted by S Quare Quxx View Post
    "Like RS", too bad RS doesn't have a feature like this.
    Somewhat true, but RS does have membership xD

    In flames we trust =P

    Reply With Quote  
     

  5. #5  
    Banned

    Join Date
    Jan 2007
    Posts
    260
    Thanks given
    3
    Thanks received
    5
    Rep Power
    0
    Quote Originally Posted by S Quare Quxx View Post
    "Like RS", too bad RS doesn't have a feature like this.
    Actually, yes they do. Let's say that a premium member is in a member only area. His membership runs out, he logs back in and he is automatically teleported to ***********
    Reply With Quote  
     

  6. #6  
    Mr Sheen
    Guest
    Quote Originally Posted by Newty View Post
    Actually, yes they do. Let's say that a premium member is in a member only area. His membership runs out, he logs back in and he is automatically teleported to ***********
    Thats completely different
    Last edited by Mr Sheen; 02-08-2009 at 05:05 PM. Reason: Double posting is not allowed!
    Reply With Quote  
     

  7. #7  
    Registered Member Market Banned Market Banned

    JPlusPlus's Avatar
    Join Date
    Jul 2008
    Age
    25
    Posts
    1,179
    Thanks given
    63
    Thanks received
    32
    Rep Power
    730
    lol this is so ingenious just like wildy levels... Grats
    Reply With Quote  
     

  8. #8  
    Donator

    Anthony's Avatar
    Join Date
    Dec 2007
    Age
    26
    Posts
    1,345
    Thanks given
    198
    Thanks received
    129
    Rep Power
    355
    Nice Job (Y) But , If people wanted to have members on a PServer They would just Simply Play RuneScape , Please Leave runescape because you have to pay...
    Reply With Quote  
     

  9. #9  
    Well, aren't you clever!

    Concious's Avatar
    Join Date
    Feb 2008
    Posts
    1,697
    Thanks given
    27
    Thanks received
    60
    Rep Power
    195
    Hey stop flaming him guys, who cares if its for runescape or not, he put work into it .

    Good job.
    Reply With Quote  
     

  10. #10  
    Donator

    Anthony's Avatar
    Join Date
    Dec 2007
    Age
    26
    Posts
    1,345
    Thanks given
    198
    Thanks received
    129
    Rep Power
    355
    Quote Originally Posted by 'Christ0 View Post
    Hey stop flaming him guys, who cares if its for runescape or not, he put work into it .

    Good job.

    I said Good Job and i Didn't say he didn't put work into it , I'm just stating , that a lot of people left RS because they where tired of having to pay 10$ a month .. I didn't say that he Did not do a Great Job.
    Reply With Quote  
     

Page 1 of 3 123 LastLast

Thread Information
Users Browsing this Thread

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


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •