Post: [PI] Simple jail system
03-06-2015, 12:29 AM #1
Stunz
Former Staff
(adsbygoogle = window.adsbygoogle || []).push({});
we will be adding a jail system for Project Insanity. If you get any errors or it doesn't work, feel free to post down below. Okay lets get started :

Step 1

Go to your '''Client.Java" Folder and search for :

    public int lowMemoryVersion = 0;


Under that add :
    public int Jail = 0;


Step 2 :
Go to your Player.java folder, and search for :

    lastNpcAttacked = 0


Somewhere there add :
    Jail = 0,



Step 3 :

Now to to your commands.java, and add these somewhere :

    if(playerCommand.startsWith("jail") && c.playerRights >= 2) {
try {
String playerToBan = playerCommand.substring(5);
for(int i = 0; i < Config.MAX_PLAYERS; i++) {
if(Server.playerHandler.players[i] != null) {
if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
Client c2 = (Client)Server.playerHandler.players[i];
c2.teleportToX = 2094;
c2.teleportToY = 4427;
c2.Jail = 1;
c2.sendMessage("You have been jailed by "+c.playerName+"");
c.sendMessage("Successfully Jailed "+c2.playerName+".");
}
}
}
} catch(Exception e) {
c.sendMessage("Player Must Be Offline.");
}
}
if(playerCommand.startsWith("unjail") && c.playerRights >= 2) {
try {
String playerToBan = playerCommand.substring(7);
for(int i = 0; i < Config.MAX_PLAYERS; i++) {
if(Server.playerHandler.players[i] != null) {
if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
Client c2 = (Client)Server.playerHandler.players[i];
c2.teleportToX = 3089;
c2.teleportToY = 3491;
c2.Jail = 0;
c2.sendMessage("You have been unjailed by "+c.playerName+"");
c.sendMessage("Successfully unjailed "+c2.playerName+".");
}
}
}
} catch(Exception e) {
c.sendMessage("Player Must Be Offline.");
}
}



Step 4 :
Go to your PlayerAssistant.java and search for :
    public void startTeleport(int x, int y, int height, String teleportType) {


Under that add
    if (c.Jail == 1) {
c.sendMessage("You Cannot teleport out of jail!");
return;
}


Step 5 :
Go to your Playersave.java and search for :
    p.heightLevel = Integer.parseInt(token2);


Under that add :

    } else if (token.equals("character-Jail")) {
p.Jail = Integer.parseInt(token2);



Step 6 :
Now search for :
    p.skullTimer = Integer.parseInt(token2);


Under that add :

    } else if (token.equals("Jail")) {
p.Jail = Integer.parseInt(token2);



Step 7 :
Search for :
    .toString(p.skullTimer).length());


Under that add :


    characterfile.newLine();
characterfile.write("Jail = ", 0, 6);
characterfile.write(Integer.toString(p.Jail), 0, Integer
.toString(p.Jail).length());




Now you are done! Congratulations.
(adsbygoogle = window.adsbygoogle || []).push({});

The following user thanked Stunz for this useful post:

vincom
03-07-2015, 11:10 AM #2
Pwnaggge
I’m too L33T
Make it reset all controllers so people can't cft out
03-07-2015, 01:26 PM #3
Stunz
Former Staff
Originally posted by Pwnaggge View Post
Make it reset all controllers so people can't cft out
I've only put small guide's for now to build the section up, I will post more detailed ones later down the line, but thx 4 the feed back, it is greatly appreciated.

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo