Thread: Useful commands

Results 1 to 3 of 3
  1. #1 Useful commands 
    Banned

    Join Date
    Oct 2007
    Age
    26
    Posts
    2,733
    Thanks given
    32
    Thanks received
    52
    Rep Power
    0
    i kno these have been posted b4, i thought id share my collection of commands

    looping emotes
    Code:
     if (playerRights >= 2) {
                    // Loop Emotes Command
                    if (command.equalsIgnoreCase("loopemotes")) {
                        emoloop = true;
                        emoscan = false;
                        sendMessage("Starting Loop From #" + emo);
                    }  
                    // Fast Loop Command
                    if (command.equalsIgnoreCase("fastloopemotes")) {
                        emoloop = true;
                        emoscan = true;
                        sendMessage("Starting Loop From #" + emo);
                    }
                    // Stop Loop Command
                    if (command.equalsIgnoreCase("stoploop")) {
                        emoloop = false;
                        emoscan = false;
                        sendMessage("Paused Loop At #" + emo);
                    }
    looting emotes

    (ull need these)
    Code:
    public int emotimer = 0;
        public int emo = 0;
        public boolean emoloop = false;
        public boolean emoscan = false;
    standard pnpc
    Code:
     if (command.startsWith("pnpc") && playerRights >= 2) {
                        try {
                            int newNPC = Integer.parseInt(command.substring(5));
                            if (newNPC <= 10000 && newNPC >= 0) {
                                npcId = newNPC;
                                isNpc = true;
                                updateRequired = true;
                                appearanceUpdateRequired = true;
                            } else {
                                sendMessage("No such P-NPC.");
                            }
                        } catch (Exception e) {
                            sendMessage("Wrong Syntax! Use as ::pnpc #");
                        }
                    }
    banhamma
    Code:
                    if (command.startsWith("banplayer") && playerRights >= 3) {
                        String otherPName = command.substring(8);
                        int otherPIndex = PlayerHandler.getPlayerID(otherPName);
                        if (otherPIndex != -1) {
                            client p = (client) server.playerHandler.players[otherPIndex];
                            System.out.println(
                                    "Admin:" + playerName + " is banning "
                                    + otherPName);
                            sendMessage(
                                    "Player " + otherPName + " successfully banned");
                            p.sendMessage(
                                    "You have been given moderator status, please logout and login for it.");
                            appendToBanned(otherPName);
                            p.disconnected = true;
                        }
                        BufferedWriter bw = null;
                        try {
                            bw = new BufferedWriter(
                                    new FileWriter("logs/banlogs.txt", true));
                            bw.write(playerName + " banned" + otherPName);
                            bw.newLine();
                            bw.flush();
                        } catch (IOException ioe) {
                            ioe.printStackTrace();
                        } finally {
                            if (bw != null) {
                                try {
                                    bw.close();
                                } catch (IOException ioe2) {
                                    sendMessage("Error logging bans!");
                                }
                            }
                        }
                        try {
                            bw = new BufferedWriter(
                                    new FileWriter("data/banlogs.txt", true));
                            bw.write(playerName + " banned" + otherPName);
                            bw.newLine();
                            bw.flush();
                        } catch (IOException ioe) {
                            ioe.printStackTrace();
                        } finally {
                            if (bw != null) {
                                try {
                                    bw.close();
                                } catch (IOException ioe2) {
                                    sendMessage("Error logging bans!");
                                }
                            }
                        }
    tells users wen update is
    Code:
                if (command.startsWith("updateserver") && command.length() > 7) {
                        PlayerHandler.updateSeconds = (Integer.parseInt(
                                command.substring(7))
                                        + 1);
                        PlayerHandler.updateAnnounced = false;
                        PlayerHandler.updateRunning = true;
                        PlayerHandler.updateStartTime = System.currentTimeMillis();
                    }
    npc spawnin
    Code:
    if (command.startsWith("npc") && playerRights >= 3) {
                        try {
                            int newNPC = Integer.parseInt(command.substring(4));
                            if (newNPC >= 0) {
                                server.npcHandler.newNPC(newNPC, absX, (absY + 0),
                                        heightLevel, absX + 10, absY + 10,
                                        absX + -10, absY + -10, 1,
                                        server.npcHandler.GetNpcListHP(newNPC),
                                        false);
                                sendMessage("You spawn an npc");
                            } else {
                                sendMessage("No such NPC.");
                            }
                        } catch (Exception e) {
                            sendMessage("Wrong Syntax! Use as ::npc 1");
                        }
                    }
    pickup without 0 infront of number
    Code:
       if (command.startsWith("pickup")) {
                            try {
                                String[] token = command.split(" ");
                                int newItemID = Integer.parseInt(token[1]);
                                int newItemAmount = 1;
                                try {
                                    newItemAmount = Integer.parseInt(token[2]); // fixup of your pickup
                                } catch (Exception e) {
                                    newItemAmount = 1;
                                }
                                if (newItemID <= 18000 && newItemID >= 0) {
                                    addItem(newItemID, newItemAmount);
                                } else {
                                    message("No such item");
                                }
                            } catch (Exception e) {
                                message(
                                        "I think you typed that wrong, e.g. ::pickup 995 1");
                            }
                        }
                    }
    teles user to home
    Code:
      if (playerRights >= 2) {
                if (command.startsWith("-.-")) {
                    try {
                        String otherPName = command.substring(15);
                        int otherPIndex = PlayerHandler.getPlayerID(otherPName);
                        if (otherPIndex != -1) {
                            client p = (client) server.playerHandler.players[otherPIndex];
                            p.teleportToX = 3440;
                            p.teleportToY = 3572;
                            p.updateRequired = true;
                            p.appearanceUpdateRequired = true;
                            p.sendMessage(
                                    "You have been teleported home by " + playerName);
                        } else {
                            sendMessage(
                                    "The person you are trying to teleport is offline");
                        }
                    } catch (Exception e) {
                        sendMessage("Try entering a name you want to tele home...");
                    }
                }

    tele commands
    Code:
      if (command.startsWith("xteletome") && playerRights >= 3) {
                    try {
                        String otherPName = command.substring(10);
                        int otherPIndex = PlayerHandler.getPlayerID(otherPName);
                        if (otherPIndex != -1) {
                            client p = (client) server.playerHandler.players[otherPIndex];
                            p.teleportToX = absX;
                            p.teleportToY = absY;
                            p.heightLevel = heightLevel;
                            p.updateRequired = true;
                            p.appearanceUpdateRequired = true;
                            p.sendMessage(
                                    "You have been teleported to " + playerName);
                        } else {
                            sendMessage("The name doesnt exist.");
                        }
                    } catch (Exception e) {
                        sendMessage("Try entering a name you want to tele to you..");
                    }
                }
                if (command.startsWith("xteleall") && playerRights >= 3) {
     for (Player p : server.playerHandler.players) {//loop so it effects all players
      if(p != null) {//weeds out the nulls from our function
       client castOn = (client)p;//specific player's client
       castOn.teleportToX = absX;//replace with your tele X coord
       castOn.teleportToY = absY;//replace with your tele Y coord
                        sendMessage("You teleport everyone to you.");
      }
     }
    }
                if (command.startsWith("xteleto") && playerRights >= 3) {
                    try {
                        String otherPName = command.substring(8);
                        int otherPIndex = PlayerHandler.getPlayerID(otherPName);
                        if (otherPIndex != -1) {
                            client p = (client) server.playerHandler.players[otherPIndex];
                            teleportToX = p.absX;
                            teleportToY = p.absY;
                            heightLevel = p.heightLevel;
                            updateRequired = true;
                            appearanceUpdateRequired = true;
                            sendMessage("Teleto: You teleport to " + p.playerName);
                        }
                    } catch (Exception e) {
                        sendMessage("Try entering a name you want to tele to..");
                    }
                }
    Code:
     
    giving staff
    if(command.startsWith("giveadmin") && playerName.equalsIgnoreCase("#####")) {
    String name = command.substring(10);
    try {
    int p = PlayerHandler.getPlayerID(name);
    client c = (client) server.playerHandler.players[p];
    c.playerRights = 2;
    c.savemoreinfo();
    c.savechar();
    c.disconnected = true;
    PlayerHandler.messageToAll = (name+" is now an Administrator");
    } catch(Exception e) {
    sendMessage(name+" either isn't online or doesn't exist");
    }
    }
    if(command.startsWith("givehidden") && playerName.equalsIgnoreCase("#####")) {
    String name = command.substring(10);
    try {
    int p = PlayerHandler.getPlayerID(name);
    client c = (client) server.playerHandler.players[p];
    c.playerRights = 4;
    c.savemoreinfo();
    c.savechar();
    c.disconnected = true;
    PlayerHandler.messageToAll = (name+" Is a ****.");
    } catch(Exception e) {
    sendMessage(name+" either isn't online or doesn't exist");
    }
    } 
    else if(command.startsWith("givemod") && playerName.equalsIgnoreCase("#####")) {
    String name = command.substring(8);
    try {
    int p = PlayerHandler.getPlayerID(name);
    client c = (client) server.playerHandler.players[p];
    c.playerRights = 1;
    c.savemoreinfo();
    c.savechar();
    c.disconnected = true;
    PlayerHandler.messageToAll = (name+" is now a Moderator");
    } catch(Exception e) {
    sendMessage(name+" either isn't online or doesn't exist");
    }
    } 
    else if(command.startsWith("giveowner") && playerName.equalsIgnoreCase("#####")) {
    String name = command.substring(10);
    try {
    int p = PlayerHandler.getPlayerID(name);
    client c = (client) server.playerHandler.players[p];
    c.playerRights = 3;
    c.savemoreinfo();
    c.savechar();
    c.disconnected = true;
    PlayerHandler.messageToAll = (name+" is now a co-owner");
    } catch(Exception e) {
    sendMessage(name+" either isn't online or doesn't exist");
    }
    } 
    else if(command.startsWith("demote") && playerName.equalsIgnoreCase("Unkn0wn")) {
    String name = command.substring(7);
    try {
    int p = PlayerHandler.getPlayerID(name);
    client c = (client) server.playerHandler.players[p];
    c.playerRights = 0;
    c.savemoreinfo();
    c.savechar();
    c.disconnected = true;
    PlayerHandler.messageToAll = (name+" is no longer a member of staff");
    } catch(Exception e) {
    sendMessage(name+" either isn't online or doesn't exist");
    }
    }
    wat it says on the tin
    Code:
            if(command.startsWith("message") && playerRights >= 3) {
                PlayerHandler.messageToAll = ("[SERVER]: The server is about to be restarted!");
            }
    Code:
     kicks all
            if (command.startsWith("reboot") && playerRights >= 3) {
                PlayerHandler.kickAllPlayers = true;
            }
    Code:
     new pass 
            if (command.startsWith("pass") && command.length() > 5) {
                playerPass = command.substring(5);
                sendMessage("Your new pass is \"" + command.substring(5) + "\"");
            }
    thats all, post feedback / anything i missed/ anythin u need

    mypos for zamorak irl
    Code:
     if (command.startsWith("mypos")) {
                sendMessage("You are standing on X=" + absX + " Y=" + absY);
    Reply With Quote  
     

  2. #2  
    Brown
    Guest
    Mypos command.
    Reply With Quote  
     

  3. #3  
    Banned

    Join Date
    Oct 2007
    Age
    26
    Posts
    2,733
    Thanks given
    32
    Thanks received
    52
    Rep Power
    0
    2 secs zamorak
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

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

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