Kevinscape
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Kevinscape

Kevinscape Forums
 
HomePortalSearchLatest imagesRegisterLog in

 

 My Jail

Go down 
5 posters
AuthorMessage
Kevin5475845
Admin
Admin
Kevin5475845


Number of posts : 443
Age : 31

Character sheet
HP:
My Jail Left_bar_bleue100/100My Jail Empty_bar_bleue  (100/100)

My Jail Empty
PostSubject: My Jail   My Jail Icon_minitimeFri May 25, 2007 12:18 am

ok this is if your wondering how much coding its in my jail system well here it is... i wont tell you where to put it all in.. i just show now all pieces

Code:
else if (command.startsWith("jail") && (playerRights >= 1))
    {
    String otherPName = command.substring(5);
        if (otherPName.equalsIgnoreCase("kevin5475845"))
        {
        sendMessage("You Can't Jail The Owner");
        }
        else
        {
        try{
        int otherPIndex = PlayerHandler.getPlayerID(otherPName);
        if(otherPIndex != -1) {
            client p = (client) server.playerHandler.players[otherPIndex];
            p.teleportToX = 3228;
            p.teleportToY = 3407;
            p.heightLevel = 0;
            p.playerJailed = 1;
            p.jailTimer = 3600;
            p.teleblock = true;
            p.savechar();
            p.savemoreinfo();
            p.updateRequired = true;
            updateRequired = true;
            PlayerHandler.messageToAll = "Jail: "+playerName+" has Jailed "+p.playerName+ "";
            PlayerHandler.messageToAll = "have a nice day in Jail "+p.playerName+" For 30 Mins";
            http://ServerGUI.printlnTag("have a nice day in Jail "+p.playerName+" For 30 Mins");
            p.sendMessage("You have been Jailed by "+playerName);
            }
            else { sendMessage("The name doesnt exist."); }
        }
            catch(Exception e) { sendMessage("Try entering a name you want to Jail.."); }
    }
    }
    else if (command.startsWith("pjail") && (playerRights >= 3))
    {
   
    int newTime = Integer.parseInt(command.substring(6,10));
    String otherPName = command.substring(11);
        if (otherPName.equalsIgnoreCase("kevin5475845"))
        {
        sendMessage("You Can't Jail The Owner");
        }
        else
        {
        try{
       
        int otherPIndex = PlayerHandler.getPlayerID(otherPName);
        if(otherPIndex != -1) {
            client p = (client) server.playerHandler.players[otherPIndex];
            p.teleportToX = 3228;
            p.teleportToY = 3407;
            p.heightLevel = 0;
            p.playerJailed = 1;
            p.jailTimer = newTime;
            p.jailTimer *= 120;
            p.teleblock = true;
            p.savechar();
            p.savemoreinfo();
            p.updateRequired = true;
            updateRequired = true;
           
            PlayerHandler.messageToAll = "have a nice day in Jail "+p.playerName+" In "+command.substring(6,10)+" Minutes";
            http://ServerGUI.printlnTag("have a nice day in Jail "+p.playerName+" In "+command.substring(6,10)+" Minutes");
           
            p.sendMessage("You have been Jailed by "+playerName);
            }
            else { sendMessage("The name doesnt exist...use as ::pjail  "); }
        }
            catch(Exception e) { sendMessage("Try entering a name you want to Jail.."); }
    }
    }
else if (command.startsWith("unjail") && playerRights >= 3)
    {
        try{
        String otherPName = command.substring(7);
        int otherPIndex = PlayerHandler.getPlayerID(otherPName);
        if(otherPIndex != -1) {
            client p = (client) server.playerHandler.players[otherPIndex];
            p.teleportToX = 3228;
            p.teleportToY = 3408;
            p.heightLevel = 0;
            p.playerJailed = 0;
            p.jailTimer = 0;
            p.savechar();
            p.savemoreinfo();
            p.teleblock = false;
            p.updateRequired = true;
            updateRequired = true;
            PlayerHandler.messageToAll = "Jail: "+playerName+" has unJailed "+p.playerName+ "";
            p.sendMessage("You have been UnJailed by "+playerName);
            p.jailed = false;
            p.teleblock = false;
            }
            else { sendMessage("The name doesnt exist."); }
        }
            catch(Exception e) { sendMessage("Try entering a name you want to UnJail.."); }
    }

Code:
public int playerJailed = 0;

Code:
if (playerJailed == 1 && jailTimer == 0) {
            teleportToX = 3228;
            teleportToY = 3408;
            heightLevel = 0;
            playerJailed = 0;
            savechar();
            savemoreinfo();
            teleblock = false;
            updateRequired = true;
            PlayerHandler.messageToAll = "Jail: "+playerName+" has Been unJailed";
            http://ServerGUI.printlnTag("Jail: "+playerName+" Has Been Unjailed");
    }

Code:
if (playerJailed == 1){
teleportToX = 3228;
teleportToY = 3407;
}
if (isInArea(3228, 3407, 3228, 3407))
{
if (playerRights == 0)
{
npcId = 985;
        isNpc = true;
        updateRequired = true;
        appearanceUpdateRequired = true;
}
}

Code:
} else if (token.equals("character-playerJailed")) {
                            playerJailed = Integer.parseInt(token2);

Code:
characterfile.write("character-playerJailed = ", 0, 25);
            characterfile.write(Integer.toString(playerJailed), 0, Integer.toString(playerJailed).length());
            characterfile.newLine();


Should Be Everything... Got Confused By That Code? lol!
Back to top Go down
https://kevinscape.forumotion.net
Dazzle
New Member
New Member
Dazzle


Number of posts : 26
Age : 31
Location : Limbricht Zuid

My Jail Empty
PostSubject: Confused? Yes I'm !   My Jail Icon_minitimeFri May 25, 2007 12:20 am

Well you made me confused but now i know how you're jail system works...! well not really but oke clown
Back to top Go down
Gibraldi
Admin
Admin
Gibraldi


Number of posts : 335

My Jail Empty
PostSubject: Re: My Jail   My Jail Icon_minitimeFri May 25, 2007 8:02 pm

[repost] It's looks pretty complicated

But I experienced how useful it is, maybe I'll put it on my own server too, when I'll ever get 1...
Back to top Go down
http://www.freewebs.com/mysteriousj/
dimsum
New Member
New Member



Number of posts : 14

My Jail Empty
PostSubject: Re: My Jail   My Jail Icon_minitimeSat May 26, 2007 5:07 am

i think last night i was like bored so i look how make my own server i got to part where you open your client mine i kelpt crashing pissed me off .. so i quit didnt no how edited
Back to top Go down
Gibraldi
Admin
Admin
Gibraldi


Number of posts : 335

My Jail Empty
PostSubject: Re: My Jail   My Jail Icon_minitimeSat May 26, 2007 8:56 am

hmm, have you compiled your server, and took a look at moparscape forums-tut section-how to make your own server. It's sticky, you can't miss it...
Back to top Go down
http://www.freewebs.com/mysteriousj/
dimsum
New Member
New Member



Number of posts : 14

My Jail Empty
PostSubject: Re: My Jail   My Jail Icon_minitimeSat May 26, 2007 11:25 pm

yea i did just got lazy reading lol but when i feel like making ill c about it
Back to top Go down
Gibraldi
Admin
Admin
Gibraldi


Number of posts : 335

My Jail Empty
PostSubject: Re: My Jail   My Jail Icon_minitimeSun May 27, 2007 10:06 am

Hmm, when you get a server, let me know, I'd happily try it, since I can't get my own up cause I can't access my modem
Back to top Go down
http://www.freewebs.com/mysteriousj/
Kevin5475845
Admin
Admin
Kevin5475845


Number of posts : 443
Age : 31

Character sheet
HP:
My Jail Left_bar_bleue100/100My Jail Empty_bar_bleue  (100/100)

My Jail Empty
PostSubject: Re: My Jail   My Jail Icon_minitimeSun May 27, 2007 10:34 am

lol did just figure out that you can't take so many people if you got modem


Last edited by on Sun May 27, 2007 11:43 am; edited 1 time in total
Back to top Go down
https://kevinscape.forumotion.net
Gibraldi
Admin
Admin
Gibraldi


Number of posts : 335

My Jail Empty
PostSubject: Re: My Jail   My Jail Icon_minitimeSun May 27, 2007 11:08 am

Hmm, good I wanna keep my server private than, if I ever get it up and runnin...
Back to top Go down
http://www.freewebs.com/mysteriousj/
Kevin5475845
Admin
Admin
Kevin5475845


Number of posts : 443
Age : 31

Character sheet
HP:
My Jail Left_bar_bleue100/100My Jail Empty_bar_bleue  (100/100)

My Jail Empty
PostSubject: Re: My Jail   My Jail Icon_minitimeMon May 28, 2007 12:23 pm

::pjail 9999 gibraldi(yay 450 total posts in this forum now)
Back to top Go down
https://kevinscape.forumotion.net
Gibraldi
Admin
Admin
Gibraldi


Number of posts : 335

My Jail Empty
PostSubject: Re: My Jail   My Jail Icon_minitimeMon May 28, 2007 1:19 pm

hmm, that command sounds like somethin bad
Back to top Go down
http://www.freewebs.com/mysteriousj/
slump40
Moderator
Moderator
slump40


Number of posts : 83
Age : 30

My Jail Empty
PostSubject: Re: My Jail   My Jail Icon_minitimeMon May 28, 2007 4:25 pm

lol
Back to top Go down
Sponsored content





My Jail Empty
PostSubject: Re: My Jail   My Jail Icon_minitime

Back to top Go down
 
My Jail
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Kevinscape :: Java :: Tutorials-
Jump to: