DIR Return Create A Forum - Home
---------------------------------------------------------
Deathx
HTML https://deathx.createaforum.com
---------------------------------------------------------
*****************************************************
DIR Return to: General Discussion
*****************************************************
#Post#: 146--------------------------------------------------
Thought this might help
DIR By: Dk
Date: June 23, 2013, 5:12 pm
---------------------------------------------------------
Well I've noticed some things about the server so I decided to
give you this to help improve your server (not asking for
anything in return, these are some things I've added in a tester
project).
This should make your call for help system much more efficient.
Go to your requesthelp.java and search for
--- Code ---
c.getPA().sendFrame126("@gre@Online",
Integer.parseInt(Staff_Config[i][2]));
--- End Code ---
Replace everything under it with this:
--- Code ---
}
}
}
public static void setInterface(Client c) {
if (!requestingHelp) {
sendOnlineStaff(c);
c.setSidebarInterface(2, 24999);
c.getPA().sendFrame106(3);
} else if (requestingHelp) {
sendOnlineStaff(c);
c.setSidebarInterface(2, 24999);
c.getPA().sendFrame106(3);
requestingHelp = false;
}
}
public static void callForHelp(Client c) {
if (c.playerRights >= 1) {
c.sendMessage("You can't call for staff, you're staff.");
return;
}
if (System.currentTimeMillis() - c.lastRequest < 60000) {
c.sendMessage("It has only been "+ getTimeLeft(c) +"
seconds since your last request for help.");
if (!requestingHelp) {
c.setSidebarInterface(2, 24999);
c.getPA().sendFrame106(3);
}
return;
}
requestingHelp = true;
otherPlayer = c.playerName;
c.lastRequest = System.currentTimeMillis();
setInterface(c);
PlayerHandler.messageAllStaff(Misc.optimizeText(getPlayer().playerName)
+" needs help, please tele to him.", true);
}
public static long getTimeLeft(Client c) {
return (System.currentTimeMillis() - c.lastRequest) / 1000;
}
public static Client getPlayer() {
return PlayerHandler.getPlayerByName(otherPlayer);
}
public static String playerCoords() {
return getPlayer().getX() +", "+ getPlayer().getY() +", "+
getPlayer().heightLevel;
}
public static void teleportToPlayer(Client c) {
try {
if (otherPlayer.equalsIgnoreCase(c.playerName)) {
c.sendMessage("You can't teleport to yourself.");
return;
}
if (otherPlayer != null &&
!otherPlayer.equalsIgnoreCase("")) {
c.getPA().movePlayer(getPlayer().getX(),
getPlayer().getY(), getPlayer().heightLevel);
c.sendMessage("You telelported to "+ otherPlayer +".");
otherPlayer = "";
} else {
c.sendMessage("There is no player to currently teleport
to.");
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
--- End Code ---
//////
Adding protection for yourself (so you can't be
muted/banned/ipmuted/ipbanned).
Open your commands.java and go to each punishment command
(mute,ipban,ban,ipmute)
Add
--- Code ---
if(Server.playerHandler.players[i].playerName.equalsIgnoreCase("even"))
{
c.sendMessage("You can't ban this person.");
return;
--- End Code ---
Under
--- Code ---
if(Server.playerHandler.players[i] != null) {
--- End Code ---
Make sure it looks like this
--- Code ---
if(Server.playerHandler.players[i] != null) {
if(Server.playerHandler.players[i].playerName.equalsIgnoreCase("even"))
{
c.sendMessage("You can't ban this person.");
return;
--- End Code ---
Note: don't forget to add } on top of the if on
"if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan))
{".
////
Re-done log in messages, removed player log ins.
Open your loginmessages.java and replace it with this:
--- Code ---
package server.model.players.Content;
import server.Server;
import server.model.players.*;
/**
* Handles all Login Messages
* @author Gabbe
*/
public class LoginMessages {
public static void handleAllLoginMessages(Client c) {
handleHack3r(c);
handleDonator(c);
handlesDonator(c);
handleDice(c);
handlelegit(c);
handleMod(c);
handleAdmin(c);
handleOwner(c);
}
public static void handleHack3r(Client c) {
for (int j = 0; j < Server.playerHandler.players.length; j++)
{
if (Server.playerHandler.players[j] != null) {
Client c2 = (Client)Server.playerHandler.players[j];
if (c.playerName.equalsIgnoreCase("even")) {
c2.sendMessage("<shad=800000000>Main-Owner Even has just
logged in.");
}
}
}
}
public static void handleDonator(Client c) {
for (int j = 0; j < Server.playerHandler.players.length; j++)
{
if (Server.playerHandler.players[j] != null) {
Client c2 = (Client)Server.playerHandler.players[j];
if (c.playerRights == 4 && c.issDonator == 0) {
c2.sendMessage("<col=800000000><shad=255>Donator
"+c.playerName.toLowerCase()+" has just logged in.");
}
}
}
}
public static void handlesDonator(Client c) {
for (int j = 0; j < Server.playerHandler.players.length; j++)
{
if (Server.playerHandler.players[j] != null) {
Client c2 = (Client)Server.playerHandler.players[j];
if (c.playerRights == 4 && c.issDonator == 1) {
c2.sendMessage("<col=225><shad=255>Super Donator
"+c.playerName.toLowerCase()+" has just logged in.");
}
}
}
}
public static void handleMod(Client c) {
for (int j = 0; j < Server.playerHandler.players.length; j++)
{
if (Server.playerHandler.players[j] != null) {
Client c2 = (Client)Server.playerHandler.players[j];
if (c.playerRights == 1) {
c2.sendMessage("<col=255><shad=255>Moderator
"+c.playerName.toLowerCase()+" has just logged in.");
}
}
}
}
public static void handleAdmin(Client c) {
for (int j = 0; j < Server.playerHandler.players.length; j++)
{
if (Server.playerHandler.players[j] != null) {
Client c2 = (Client)Server.playerHandler.players[j];
if (c.playerRights == 2) {
c2.sendMessage("<shad=200000000>Administrator
"+c.playerName.toLowerCase()+" has just logged in.");
}
}
}
}
public static void handleOwner(Client c) {
for (int j = 0; j < Server.playerHandler.players.length; j++)
{
if (Server.playerHandler.players[j] != null) {
Client c2 = (Client)Server.playerHandler.players[j];
if (c.playerName.equalsIgnoreCase("ADD NAME HERE")) {
c2.sendMessage("<shad=330000>ADD MESSAGE HERE");
}
}
}
}
public static void handleDice(Client c) {
for (int j = 0; j < Server.playerHandler.players.length; j++)
{
if (Server.playerHandler.players[j] != null) {
Client c2 = (Client)Server.playerHandler.players[j];
if (c.playerName.equalsIgnoreCase("ADD NAME HERE")) {
c2.sendMessage("<shad=800000000>ADD MESSAGE HERE");
}
}
}
}
public static void handlelegit(Client c) {
for (int j = 0; j < Server.playerHandler.players.length; j++)
{
if (Server.playerHandler.players[j] != null) {
Client c2 = (Client)Server.playerHandler.players[j];
if (c.playerName.equalsIgnoreCase("ADD NAME HERE")) {
c2.sendMessage("<shad=16112652>ADD MESSAGE HERE");
}
}
}
}
}
--- End Code ---
Note: replace the last three names & messages to whatever you
want.
//////
Adding ::commands, ::commands2 & ::modcommands.
Open your command.java & add this in:
--- Code ---
}
if (playerCommand.equalsIgnoreCase("commands")) { // Shows
"Legend" Commands
for(int i = 8144; i < 8195; i++) {
c.getPA().sendFrame126("", i);
}
c.getPA().showInterface(8134);
c.getPA().sendFrame126("@blu@~ "+Config.SERVER_NAME+" Commands
~",8144);
c.getPA().sendFrame126("@blu@1. ::corp",8145);
c.getPA().sendFrame126("@blu@2. ::helpzone",8147);
c.getPA().sendFrame126("@blu@3. ::dicezone",8148);
c.getPA().sendFrame126("@blu@4. ::tradezone",8149);
c.getPA().sendFrame126("@blu@5. ::kdr",8150);
c.getPA().sendFrame126("@blu@6. ::zombies [under
development]",8151);
c.getPA().sendFrame126("@blu@7. ::axes",8152);
c.getPA().sendFrame126("@blu@8. ::home",8153);
c.getPA().sendFrame126("@blu@9. ::slayertower",8154);
c.getPA().sendFrame126("@blu@10. ::summon",8155);
c.getPA().sendFrame126("@blu@11. ::dice",8156);
c.getPA().sendFrame126("@blu@12. ::funpk [safe]",8157);
c.getPA().sendFrame126("@blu@14. ::mine [mining area]",8158);
c.getPA().sendFrame126("@blu@15. ::mine2",8159);
c.getPA().sendFrame126("@blu@15. ::highpk [multi /
unsafe]",8160);
c.getPA().sendFrame126("@blu@15. ::rank",8161);
c.getPA().sendFrame126("@blu@15. ::frosts [dragons]",8162);
c.getPA().sendFrame126("@blu@15. ::rules",8163);
}
if (playerCommand.equalsIgnoreCase("commands2")) { // Shows
"Legend" Commands
for(int i = 8144; i < 8195; i++) {
c.getPA().sendFrame126("", i);
}
c.getPA().showInterface(8134);
c.getPA().sendFrame126("@blu@~ "+Config.SERVER_NAME+" Commands
~",8144);
c.getPA().sendFrame126("@blu@1. ::resettask [resets slayer
task]",8145);
c.getPA().sendFrame126("@blu@2. ::resetdef [resets your
defence]",8147);
c.getPA().sendFrame126("@blu@3. ::rest [sit]",8148);
c.getPA().sendFrame126("@blu@4. ::changepassword",8149);
c.getPA().sendFrame126("@blu@5. ::ep [tells you your ep
%]",8150);
c.getPA().sendFrame126("@blu@6. MORE COMING SOON!",8151);
}
if (playerCommand.equalsIgnoreCase("modcommands")) { // Shows
"Legend" Moderator Commands
for(int i = 8144; i < 8195; i++) {
c.getPA().sendFrame126("", i);
}
c.getPA().showInterface(8134);
c.getPA().sendFrame126("@blu@~ "+Config.SERVER_NAME+"
Moderator Commands ~",8144);
c.getPA().sendFrame126("@blu@1. ::mute",8145);
c.getPA().sendFrame126("@blu@2. ::unmute",8147);
c.getPA().sendFrame126("@blu@3. ::jail",8148);
c.getPA().sendFrame126("@blu@4. ::unjail",8149);
c.getPA().sendFrame126("@blu@5. ::ban",8150);
c.getPA().sendFrame126("@blu@6. ::unban",8151);
c.getPA().sendFrame126("@blu@7. ::teleto",8152);
c.getPA().sendFrame126("@blu@8. ::xteletome",8153);
c.getPA().sendFrame126("@blu@9. Or you can just use the staff
panel.",8154);
}
--- End Code ---
Tell me if you want my custom Crystal Key system.
#Post#: 147--------------------------------------------------
Re: Thought this might help
DIR By: Dk
Date: June 23, 2013, 5:22 pm
---------------------------------------------------------
Adding a basic server support rank:
Add this to commands.java
--- Code ---
}else if (c.playerRights == 11){
c2.sendMessage("<col225><shad=838383>[Server
Support]</col><shad=838383>"+ Misc.optimizeText(c.playerName)
+": "
+ Misc.optimizeText(playerCommand.substring(5)) +"");
--- End Code ---
And
--- Code ---
}
if (playerCommand.equals("staffzone") && (c.playerRights ==
11)) {
c.getPA().startTeleport(2393, 9894, 0, "modern");
c.sendMessage("Welcome to the staffzone.");
}
--- End Code ---
And add this into playerassistant.java (tells them they're
server support on their account info tab)
--- Code ---
c.getPA().sendFrame126("@lre@Rank: @gre@Server Support",
16337);
--- End Code ---
Also if you want PM me & I'll give you the code to disable
commands while in trade.
#Post#: 148--------------------------------------------------
Re: Thought this might help
DIR By: Dk
Date: June 23, 2013, 6:01 pm
---------------------------------------------------------
Note; the copy paste might not be spaced correctly so be aware.
Also read the codes before adding them because I quickly scanned
through them, might of missed something.
Sorry for the triple post, won't let me edit.
*****************************************************
Page 1 of 1