Thread: help with login message, will rep

Results 1 to 9 of 9
  1. #1 help with login message, will rep 
    BeastvilleRSPS Owner

    Join Date
    Dec 2011
    Posts
    62
    Thanks given
    3
    Thanks received
    1
    Rep Power
    11
    hey guys i need help with this login message, will rep the first person to get it right.

    if(playerRights == 2) {
    for (int j = 0; j < Server.playerHandler.players.length; j++) {
    if (Server.playerHandler.players[j] != null) {
    Client c2 = (Client)Server.playerHandler.players[j];
    c2.sendMessage("<col=255><shad=1934882>[<img=2>Admin] " +playerName+ " has just logged in.");
    else if (c.playerName.equalsIgnoreCase("logan")){
    c2.sendMessage("<col=1769216><shad=0>[Head of Staff]</col><img=2>" +playerName+ " has just logged in.");

    }
    }
    }



    i get errors with this.
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Dec 2013
    Posts
    43
    Thanks given
    2
    Thanks received
    16
    Rep Power
    20
    Post your errors please.
    Reply With Quote  
     

  3. #3  
    BeastvilleRSPS Owner

    Join Date
    Dec 2011
    Posts
    62
    Thanks given
    3
    Thanks received
    1
    Rep Power
    11
    it gives over 100 of them
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Dec 2013
    Posts
    43
    Thanks given
    2
    Thanks received
    16
    Rep Power
    20
    if(playerRights == 2) {
    for (int j = 0; j < Server.playerHandler.players.length; j++) {
    if (Server.playerHandler.players[j] != null) {
    Client c2 = (Client)Server.playerHandler.players[j];
    c2.sendMessage("<col=255><shad=1934882>[<img=2>Admin] " +playerName+ " has just logged in.");
    else if (c.playerName.equalsIgnoreCase("logan")){
    c2.sendMessage("<col=1769216><shad=0>[Head of Staff]</col><img=2>" +playerName+ " has just logged in.");

    }
    }
    }
    }
    use that.
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Jan 2013
    Age
    25
    Posts
    80
    Thanks given
    61
    Thanks received
    9
    Rep Power
    33
    You missed a bracket in the middle of the if/else statement. Remember to close the if {} before starting the else

    Code:
    if(playerRights == 2) {
        for (int j = 0; j < Server.playerHandler.players.length; j++) {
            if (Server.playerHandler.players[j] != null) {
                Client c2 = (Client)Server.playerHandler.players[j];
                c2.sendMessage("<col=255><shad=1934882>[<img=2>Admin] " +playerName+ " has just logged in.");
            } else if (c.playerName.equalsIgnoreCase("logan")){
                c2.sendMessage("<col=1769216><shad=0>[Head of Staff]</col><img=2>" +playerName+ " has just logged in.");
    
            }
        }
    }
    A majority of the time you get 100+ errors, you've missed a bracket, or added too many.

    For other "simple" errors such as this, try reading through here: [Only registered and activated users can see links. ]
    Last edited by Asphixia; 12-19-2013 at 11:00 PM. Reason: Added link for future reference to OP
    Reply With Quote  
     

  6. #6  
    Banned

    Join Date
    Dec 2011
    Posts
    967
    Thanks given
    234
    Thanks received
    208
    Rep Power
    0
    4 open brackets, 3 closed brackets, and you're just simply doing it wrong if my assumption of what you're trying to accomplish is correct (if their playerrights are two, then it sends a login message as admin, else if playerName is logan then it says head admin)

    Problem here is that you are doing something like if(.. != null) { ... ... else if() { which is just wrong...

    Spoiler for Here:
    Code:
    for (int j = 0; j < Server.playerHandler.players.length; j++) {
    				if (Server.playerHandler.players[j] != null) {
    					Client c2 = (Client)Server.playerHandler.players[j];
    					if(c.playerName.equalsIgnoreCase("logan"))
    						c2.sendMessage("<col=255><shad=1934882>[<img=2>Admin] " +playerName+ " has just logged in.");
    					else if (c.playerRights == 2)
    						c2.sendMessage("<col=1769216><shad=0>[Head of Staff]</col><img=2>" +playerName+ " has just logged in.");
    
    					}
    				}
    			}


    If you have more questions then you can ask, it's kinda hard to explain via text without making it long
    Reply With Quote  
     

  7. #7  
    BeastvilleRSPS Owner

    Join Date
    Dec 2011
    Posts
    62
    Thanks given
    3
    Thanks received
    1
    Rep Power
    11
    Quote Originally Posted by Icandoit View Post
    4 open brackets, 3 closed brackets, and you're just simply doing it wrong if my assumption of what you're trying to accomplish is correct (if their playerrights are two, then it sends a login message as admin, else if playerName is logan then it says head admin)

    Problem here is that you are doing something like if(.. != null) { ... ... else if() { which is just wrong...

    Spoiler for Here:
    Code:
    for (int j = 0; j < Server.playerHandler.players.length; j++) {
    				if (Server.playerHandler.players[j] != null) {
    					Client c2 = (Client)Server.playerHandler.players[j];
    					if(c.playerName.equalsIgnoreCase("logan"))
    						c2.sendMessage("<col=255><shad=1934882>[<img=2>Admin] " +playerName+ " has just logged in.");
    					else if (c.playerRights == 2)
    						c2.sendMessage("<col=1769216><shad=0>[Head of Staff]</col><img=2>" +playerName+ " has just logged in.");
    
    					}
    				}
    			}


    If you have more questions then you can ask, it's kinda hard to explain via text without making it long
    i used this and it said c.playername and c.playerrights doesnt exist. i took the c. out and got no errors but it just says he is a admin.
    Reply With Quote  
     

  8. #8  
    Registered Member

    Join Date
    Dec 2011
    Age
    25
    Posts
    794
    Thanks given
    92
    Thanks received
    84
    Rep Power
    250
    Quote Originally Posted by egghead85 View Post
    i used this and it said c.playername and c.playerrights doesnt exist. i took the c. out and got no errors but it just says he is a admin.
    Code:
    if(c.playerName.equalsIgnoreCase("logan"))
    						c2.sendMessage("<col=255><shad=1934882>[<img=2>Admin]
    Do you understand java or even simple english?

    Reply With Quote  
     

  9. Thankful user:


  10. #9  
    BeastvilleRSPS Owner

    Join Date
    Dec 2011
    Posts
    62
    Thanks given
    3
    Thanks received
    1
    Rep Power
    11
    lol well i guess @FortNightAtmo gets the rep thanks.
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

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


User Tag List

Similar Threads

  1. [PI] Help With Shops Disconnection WILL REP
    By TanzanitePS in forum Help
    Replies: 2
    Last Post: 08-23-2011, 01:16 AM
  2. need help with pking skull 'will rep'
    By Kenaboy in forum Help
    Replies: 0
    Last Post: 09-27-2010, 02:52 PM
  3. Need help with 100 errors will rep+++
    By T-Sex in forum Help
    Replies: 6
    Last Post: 08-11-2010, 01:11 AM
  4. Need help with exrendums client will rep++
    By ByteBlast in forum Help
    Replies: 4
    Last Post: 10-05-2009, 08:55 AM
  5. Help with these errors! Will Rep!
    By Effect in forum Help
    Replies: 11
    Last Post: 08-22-2009, 06:42 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •