PDA

View Full Version : A couple of tuts for z508



Nathan'
June 18th, 2010, 04:25
OK i'm not going to waste people's time, this is for the new coders who maybe are trying to be creative with their server.

Guide One - Adding interfaces to different aspects of your server.

Click Here For Preview (Only the registered members can see the link.)

Purpose of this tutorial - The main intention of this tutorial is to teach people how to make interfaces show when commands are executed, or when an object is clicked. People will be able to expand on this tutorial and create things such as items on death interface. Soul wars/Clan wars

Files Modified - ActionButtons.java, Commands.java

Step One - You need to find out the id of the interface - Only the registered members can see the link. (most interface ids)

Step Two - Open up net/com/codeusa/net/packethandler/Commands.java and search for -


"home"

Now just above that add -

if (cmd[0].equals("Your Command")) {
p.getActionSender().showInterface(p, What Ever Interface You Wish);
}


p.getActionSender().showInterface - When the command is executed the interface is shown.

Step Two - Now we need to make buttons work.

Open net/com/codeusa/net/packethandler/ActionButtons.java and search for -


case 277:

Now Just Above There Add


case 677:


if (buttonId == 17) {//procede
if(p.InBounty == 1) {
p.getActionSender().sendMessage(p, "You cannot teleport out of Bounty Hunter");
return;
}
if (p.attackedBy != null) {
p.getActionSender().sendMessage(p, "You cannot use this command while in combat.");
return;
}
if (p.jailed > 0) {
p.getActionSender().sendMessage(p, "You are jailed!");
return;
}
p.teleportTo(xxxx, yyyy, y, 0, 0, 8939, 8941, 1576, 0, 1577, 0);
p.getActionSender().removeShownInterface(p);
}

Now for explaining the code -


if(p.InBounty == 1) {
p.getActionSender().sendMessage(p, "You cannot teleport out of Bounty Hunter");
return;
} If the player is in combat in bounty hunter they cannot teleport by using the command.


if (p.attackedBy != null) {
p.getActionSender().sendMessage(p, "You cannot use this command while in combat.");
return;
}
if (p.jailed > 0) {
p.getActionSender().sendMessage(p, "You are jailed!");
return;
} - If the player is either in combat/jailed they cannot teleport


p.teleportTo(xxxx, yyyy, y, 0, 0, 8939, 8941, 1576, 0, 1577, 0);
p.getActionSender().removeShownInterface(p); Teleports the player to the designated position whilst removing the interface form the screen

Now we need to add the decline button - Just below the last bracket of the of the first part of case 677 add


if (buttonId == 18) {//Decline
if(p.InBounty == 1) {
p.getActionSender().sendMessage(p, "You cannot teleport out of Bounty Hunter");
return;
}
if (p.attackedBy != null) {
p.getActionSender().sendMessage(p, "You cannot use this command while in combat.");
return;
}
if (p.jailed > 0) {
p.getActionSender().sendMessage(p, "You are jailed!");
return;
}
p.getActionSender().removeShownInterface(p);
}

The code is exactly the same except it doesn't teleport the player.

Save and compile and post any errors here.


Please don't flame me, im kinda new myself and I thought this would be helpful.

Aaron
June 18th, 2010, 04:30
Nice Guide, Tutorial;)

Nathan'
June 18th, 2010, 04:36
Thanks :P All feedback is helpful

Travesty
June 18th, 2010, 04:37
Although i don't really like 508/525s they are easy to code and good for beginners ;) Nice guide.

Nathan'
June 18th, 2010, 04:38
Thanks for the feedback Dalton

Travesty
June 18th, 2010, 04:49
Thanks for the feedback Dalton

Dalton? I'm not from battle-scape or anything, Neither did i steal his name i've been using this name for a long time on private servers.

Nathan'
June 18th, 2010, 04:51
sorry for the miss understanding

Travesty
June 18th, 2010, 06:33
sorry for the miss understanding

No problem.

Faab234
June 18th, 2010, 06:53
Explain more.

Nathan'
June 18th, 2010, 07:04
Better?

The sup
June 18th, 2010, 12:19
Detail the tutorial more, however it is a good tutorial.

Break
June 18th, 2010, 12:23
Good job.

Nathan'
June 19th, 2010, 05:10
Thank you all.