Thread: Adding Jail command & Right Click Jail

Page 1 of 3 123 LastLast
Results 1 to 10 of 23
  1. #1 Adding Jail command & Right Click Jail 
    Registered Member
    Join Date
    May 2008
    Posts
    39
    Thanks given
    0
    Thanks received
    0
    Rep Power
    5
    I have only posted this tutorial here and http://tutorials.rsps-hosts.com/smf/
    If you see it anywhere else it is leeched

    Description: Make a jail that you can't teleport out of and if you try to noclip you get teleported back into jail.
    The mini-map is disabled while you are in jail aswell
    This is for MOD+ command but can easily be changed to admin+ by changing a few 1's to 2's..[/i]

    Difficulty: Probably 2-3/10.

    Assumed Knowledge: Where to add a command, boolean or void...

    Tested Server: any server

    Files/Classes Modified: client.java and if you want to add the npcs that talk you need to modify autospawn.cfg and NPCHandler.java

    Procedure
    So here we go...
    First add these commands into client.java
    Code:
    if (command.startsWith("jail") && (playerRights >= 1)) {
    
    		try {
    	String name = command.substring(5);
                client c = (client) PlayerHandler.players[PlayerHandler.getPlayerID(name)];
                //creates a new client object and fills in its needed paramaters
                    c.teleportToX = 3123;
    				c.teleportToY = 3242;
    				c.teleblock = true;
                    c.sendMessage("You have been sent to jail for breaking the rules!");
                    c.sendMessage("Maybe someone will release you shortly...");
                c.teleblock = true;
                updateRequired = true;
                appearanceUpdateRequired = true;
    			sendMessage("Player succesfully jailed");
    			PlayerHandler.messageToAll =("[SUCESS]: "+command.substring(5)+" has been jailed for breaking the rules");
    			} catch (Exception e) {
                        sendMessage("Try entering a name you want to send to jail");
                    }
    
                }	
    
     else if (command.startsWith("unjail") && (playerRights >= 1)) {
    	
    	try {
    	String name = command.substring(7);
                client c = (client) PlayerHandler.players[PlayerHandler.getPlayerID(name)];
                   c.teleportToX = 2313;
                   c.teleportToY = 9799;
                c.teleblock = false;
                   c.sendMessage("You have been released from jail, please be good.");
    			   c.frame99(0);
                updateRequired = true;
                appearanceUpdateRequired = true;
    			sendMessage("Player succesfully unjailed");
    			PlayerHandler.messageToAll =("[WARNING]: "+command.substring(7)+" has been unjailed and is now on the loose!");
    		} catch (Exception e) {
                        sendMessage("Try entering a name you want to unjail");
                    }
    
                }
    Then add these booleans
    Code:
    public boolean isjailed() {
    	if (absX >= 3120 && absX <= 3126 && absY >= 3239 && absY <= 3244)
    	return true;
    	else
    			return false;
    		}
    	public boolean abovejail() {
    	if (absX >= 3116 && absX <= 3131 && absY >= 3244 && absY <= 3250)
    	return true;
    	else
    			return false;
    		}
    	public boolean leftjail() {
    	if (absX >= 3116 && absX <= 3120 && absY >= 3238 && absY <= 3247)
    	return true;
    	else
    			return false;
    		}
    	public boolean rightjail() {
    	if (absX >= 3126 && absX <= 3136 && absY >= 3235 && absY <= 3248)
    	return true;
    	else
    			return false;
    		}
    	public boolean belowjail() {
    	if (absX >= 3117 && absX <= 3132 && absY >= 3234 && absY <= 3239)
    	return true;
    	else
    			return false;
    		}

    Now add this in boolean process()
    Code:
    if (abovejail() || belowjail() || leftjail() || rightjail()) {
    	teleportToX = 3123;
    	teleportToY = 3242;
    	teleblock = true;
        sendMessage("ROFL THERE IS NO ESCAPE!");
        sendMessage("YOU SHOULD BE BANNED");
    	}
    if (isjailed()) {
    	teleblock = true;
    	frame99(2);
    	}
    Ok now you have a working jail command
    Now for the right-click jail
    In case 153 (follow) add this under the last closing bracket but before the break;
    Code:
    if (playerRights >= 1) {//jail test
    			int pIndex2 = inStream.readUnsignedWordBigEndian();
    			client p5 = (client) server.playerHandler.players[pIndex2];
    			                        String victim = p5.playerName;
                            PlayerHandler.messageToAll = "Administrator: "+playerName+" is jailing "+victim;
                            sendMessage("Player "+victim+" successfully jailed");
    			appendToJail(victim);
    			}
    Your case should now look something like this
    Code:
    case 153: // Follow
                if (playerRights == 0) {
    			int FollowID = (misc.HexToInt(inStream.buffer, 0, packetSize) / 1000);
    
                if (playerFollowID != -1) {
                    for (i = 0; i < playerFollow.length; i++) {
                        if (PlayerHandler.players[playerFollowID].playerFollow[i]
                                == playerId) {
                            PlayerHandler.players[playerFollowID].playerFollow[i] = -1;
                            break;
                        }
                    }
                }
                playerFollowID = FollowID;
                for (i = 0; i < playerFollow.length; i++) {
                    if (PlayerHandler.players[playerFollowID].playerFollow[i] == -1
                            && PlayerHandler.players[playerFollowID] != null) {
                        PlayerHandler.players[playerFollowID].playerFollow[i] = playerId;
                        break;
                    }
                }
                sendMessage(
                        "You are now following "
                                + PlayerHandler.players[playerFollowID].playerName);
    			}
    			if (playerRights >= 1) {//jail test
    			int pIndex2 = inStream.readUnsignedWordBigEndian();
    			client p5 = (client) server.playerHandler.players[pIndex2];
    			                        String victim = p5.playerName;
                            PlayerHandler.messageToAll = "Administrator: "+playerName+" is jailing "+victim;
                            sendMessage("Player "+victim+" successfully jailed");
    			appendToJail(victim);
    			}			
                break;
    Now add this void
    Code:
    public void appendToJail(String player) {
    
    	 try {
    	 client c = (client) PlayerHandler.players[PlayerHandler.getPlayerID(player)];
                //creates a new client object and fills in its needed paramaters
                    c.teleportToX = 3123;
    				c.teleportToY = 3242;
    				c.teleblock = true;
                    c.sendMessage("You have been sent to jail for breaking the rules!");
                    c.sendMessage("Maybe someone will release you shortly...");
                c.updateRequired = true;
                c.appearanceUpdateRequired = true;
    			sendMessage("Player succesfully jailed");
    			PlayerHandler.messageToAll =("[SUCESS]: "+player+" has been jailed for breaking the rules");
    			} catch (Exception e) {
                        sendMessage("Error sending to jail!");
                    }
    			}
    And to finish find in void run() where normal players see the word follow when you right click
    it should look something like this
    Code:
    if (playerRights <= 0) {
                    outStream.createFrameVarSize(104);
                    outStream.writeByteC(2); // command slot
                    outStream.writeByteA(0); // 0 or 1; 1 if command should be placed on top in context menu
                    outStream.writeString("@gre@Follow");
                    outStream.endFrameVarSize();
    under that you want to add
    Code:
     } else if (playerRights >= 1) {		
                    outStream.createFrameVarSize(104);
                    outStream.writeByteC(2); // command slot (does it matter which one?)
                    outStream.writeByteA(0); // 0 or 1; 0 if command should be placed on top in context menu
                    outStream.writeString("@red@Jail");
                    outStream.endFrameVarSize();
                }
    And you're done
    The final product:



    This jail command was based off of this: http://www.rune-server.org/showthread.php?t=55715 but is edited ALOT
    Also based off of the right click ban tutorial
    Disabling the mini-map and the idea of stopping noclippers was found in this tutorial: http://www.rune-server.org/showthread.php?t=60377
    this is the code to disable the mini-map frame99(2);
    IF YOU GET ANY ERRORS LET ME KNOW AND I'LL TRY TO HELP


    If you want to add the guard npcs that walk and talk then open up autospawn.cfg and add this
    Code:
    spawn = 2586	3125	3245	0	3126	3246	3123	3244	1	Billy, a guard of falador
    spawn = 2587	3128	3245	0	3129	3246	3126	3244	1	Bob, another guard of falador
    Then in NPCHandler.java add this
    Code:
    if (npcs[i].npcType == 2586) {
                            if (misc.random2(30) <= 2) {
                                npcs[i].updateRequired = true;
                                npcs[i].textUpdateRequired = true;
                                npcs[i].textUpdate = "Rofl you screwed up big time!";
                            }
                        }
    					if (npcs[i].npcType == 2587) {
                            if (misc.random2(30) <= 2) {
                                npcs[i].updateRequired = true;
                                npcs[i].textUpdateRequired = true;
                                npcs[i].textUpdate = "Good luck getting outta here hahahahahah!";
                            }
                        }
     

  2. #2  
    I'm kind of back :D

    Nick's Avatar
    Join Date
    Nov 2007
    Age
    28
    Posts
    803
    Thanks given
    0
    Thanks received
    5
    Rep Power
    384
    Nice job, but i swore there was a jail command tut little while ago


     

  3. #3  
    Registered Member
    Join Date
    May 2008
    Posts
    39
    Thanks given
    0
    Thanks received
    0
    Rep Power
    5
    Quote Originally Posted by NickGonzo23 View Post
    Nice job, but i swore there was a jail command tut little while ago
    Yeah but this makes it so right-click jail works and atleast I think this command is better then the other one with all the useless stuff like timesjailed or hasbeenjailed...
     

  4. #4  
    Old School Member

    Join Date
    Feb 2008
    Age
    29
    Posts
    2,163
    Thanks given
    372
    Thanks received
    40
    Rep Power
    687
    nice job rep

    Quote Originally Posted by Colby View Post
    Rofl, moron. They're ALL going to be null idiot. This is such complete bullshit, it makes me want to strangle you.
     

  5. #5  
    Donator


    Join Date
    Mar 2008
    Posts
    1,945
    Thanks given
    118
    Thanks received
    201
    Rep Power
    2104
    very nice

    tested and i found it to work on p czar, whitescape v 5.2 and whitescape v5.10
    Attached image
     

  6. #6  
    Registered Member
    Join Date
    May 2008
    Posts
    39
    Thanks given
    0
    Thanks received
    0
    Rep Power
    5
    np good to see I didn't forget anything..
     

  7. #7  
    Old School Member

    Join Date
    Feb 2008
    Age
    29
    Posts
    2,163
    Thanks given
    372
    Thanks received
    40
    Rep Power
    687
    You didnt, i gave +10 rep 2 you aswell.

    Quote Originally Posted by Colby View Post
    Rofl, moron. They're ALL going to be null idiot. This is such complete bullshit, it makes me want to strangle you.
     

  8. #8  
    Banned

    Join Date
    Nov 2007
    Posts
    1,015
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    Hmm.. Looks alot like the Enkrona jail, eh? Just think.
     

  9. #9  
    Registered Member
    Join Date
    May 2008
    Posts
    39
    Thanks given
    0
    Thanks received
    0
    Rep Power
    5
    Quote Originally Posted by Vex View Post
    Hmm.. Looks alot like the Enkrona jail, eh? Just think.

    Lol dude this is not leeched if you dont have proof gtfo I made this myself and I hate people like you that would say this is leeched...
    PROVE To me this is leeched or shut up.. And then again, you can't prove it because its not leeched..


    OH and btw I've never even heard of this Enkrona bullcrap...
     

  10. #10  
    Old School Member

    Join Date
    Feb 2008
    Age
    29
    Posts
    2,163
    Thanks given
    372
    Thanks received
    40
    Rep Power
    687
    he gave full credits, and besides if you mean the coords of the jail place everyone uses those coords dh.

    Quote Originally Posted by Colby View Post
    Rofl, moron. They're ALL going to be null idiot. This is such complete bullshit, it makes me want to strangle you.
     

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

Tags for this Thread

View Tag Cloud

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