Simple command...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • BezEr
    New Member
    • Aug 2008
    • 3

    Simple command...

    I am making a command for my Java program and I want to make a command like this -

    else if(command.star tsWith("banuser ") && p.rights > 1)
    {
    String user = command.substri ng(5);
    int id = Main.m.ge.getId FromName(user);
    Player plr = Main.m.ge.playe rs[id];
    plr.disconnecte d[0] =
    plr.disconnecte d[1] = true;



    Thats as far as I got, so far it's saying if my player rights are over 1 it will kick them off the server. I want it to now Write that players name to a file called "BANNEDHOSTS.da t" but I'm lost when I get there...
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Read about how to write to a file here , try the code and post again here if you still get problems.

    Comment

    • BezEr
      New Member
      • Aug 2008
      • 3

      #3
      Which one do I use the first one or the second one to start, also it takes all that to write "playername " To bannedusers.dat ?

      I'm not good at all at Java programming, I know simple things is all ;(.

      Comment

      • r035198x
        MVP
        • Sep 2006
        • 13225

        #4
        Originally posted by BezEr
        Which one do I use the first one or the second one to start...
        There is only one method shown there for writing to a file.

        Originally posted by BezEr
        ..also it takes all that to write "playername " To bannedusers.dat ?

        I'm not good at all at Java programming, I know simple things is all ;(.
        That's only 15 lines!

        Comment

        • BezEr
          New Member
          • Aug 2008
          • 3

          #5
          Originally posted by r035198x
          There is only one method shown there for writing to a file.


          That's only 15 lines!
          Yeah but I used 4 lines to get the name and kick the name, I figured adding the name to a file would be easier o.o.

          Comment

          Working...