PDA

View Full Version : [317] Automatic teleporting [317]



thirkle
July 27th, 2010, 18:54
While I know this is very easy, I have not yet seen it on these forums and it has been requested by a few of the people on my msn, haters, I didn't write this for you.

The concept of automatic teleporting is simple, if your player walks onto a certain square with the given coordinates, they would be automatically teleported to a given location.

I tested and wrote this using final devo 2.7, but it would be simple to convert the code.

First off, open up client.java, we need to find the process method, which is called twice every second.
Quote


public boolean playerProcess() {

this method is named playerProcess(), but in other sources i'm pretty sure it's just "public boolean process()", and this is the method where timers etc go.

So just under that line, place this code:
Quote


if (absX == 2660 && absY == 3306) {
teleportToX = 2690;
teleportToY = 3306;
heightLevel = 0;
CAM().sendMessage("You have been automatically teleported.");
}

Now, this code will be called twice every second, and you can change the coordinates to your liking, change the line:


if (absX == 2660 && absY == 3306) {


To change the coordinates which teleport you.
And change the lines:


teleportToX = 2690;
teleportToY = 3306;


to change the coordinates which you get teleported to.

Remember, flame all you want, I won't be wasting my time replying.

Ryan
July 27th, 2010, 18:56
Why would you make it check for that every time the server updates? Put that in when they walk, or anything but process.

Sunny
August 12th, 2010, 00:16
how do i make it so that, like...
its a staff area, and if your not staff and you enter the area, it would automatically teleport you, ive seen it somewher before...

Fenway`
August 12th, 2010, 00:24
First off, open up client.java, we need to find the process method, which is called twice every second.


600ms*

Repcal
August 12th, 2010, 00:31
how do i make it so that, like...
its a staff area, and if your not staff and you enter the area, it would automatically teleport you, ive seen it somewher before...Mabye something like this
if (instaffzone() && playerRights >=1) {
teleportToX = 2690;
teleportToY = 3306;
heightLevel = 0;
CAM().sendMessage("You have been automatically teleported.");
}

Fenway`
August 12th, 2010, 00:37
you have to make a inStaffZone method first

Repcal
August 12th, 2010, 00:38
you have to make a inStaffZone method firstIk just a example