Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Lonely logout


    skepta

    Recommended Posts

    Trying to get the script to log out when there is no other players around, not understanding why this doesn't work.

    Just goes off if im alone or around a load of people

    if (getPlayers().all().size() <= 2) {
    		    	if(!getTabs().isOpen(Tab.LOGOUT))
    		    	getTabs().open(Tab.LOGOUT);
    		    } else {
    				getMouse().move(p);
    				sleep(10, 60);
    				getMouse().click();
    				sleep(10, 60);
    
    Link to comment
    Share on other sites

    the <=2 would log out if there was just you or you and one other person.. Why it goes off when there are a lot of people is beyond me.

     

    Then again I can't code, just trying to help :L

     

    edit: ok so you're trying to get it to log off when you're alone. You WANT to be in a group.. idk why that part was so confusing. I would imagine it's something with your getPlayers thing.. agh nope can't help

    Link to comment
    Share on other sites

     

    Trying to get the script to log out when there is no other players around, not understanding why this doesn't work.

    Just goes off if im alone or around a load of people

    if (getPlayers().all().size() <= 2) {
    		    	if(!getTabs().isOpen(Tab.LOGOUT))
    		    	getTabs().open(Tab.LOGOUT);
    		    } else {
    				getMouse().move(p);
    				sleep(10, 60);
    				getMouse().click();
    				sleep(10, 60);
    

    There is a

    getTabs().logout();
    

    method, FYI. Other than that, your logic should be fine.

     

    Try this:

    if(getPlayers().all(player -> player != null && !player.equals(getLocalPlayer())).size() < 2){
                getTabs().logout();
            }
    
    Link to comment
    Share on other sites

     

    Trying to get the script to log out when there is no other players around, not understanding why this doesn't work.

    Just goes off if im alone or around a load of people

    if (getPlayers().all().size() <= 2) {
    		    	if(!getTabs().isOpen(Tab.LOGOUT))
    		    	getTabs().open(Tab.LOGOUT);
    		    } else {
    				getMouse().move(p);
    				sleep(10, 60);
    				getMouse().click();
    				sleep(10, 60);
    

    It looks like you meant to do:

                        if(!getTabs().isOpen(Tab.LOGOUT)) {
    		    	getTabs().open(Tab.LOGOUT);
    		    } else {
    				getMouse().move(p);
    				sleep(10, 60);
    				getMouse().click();
    				sleep(10, 60);
                       }
    

    but instead you did

    if(!getTabs().isOpen(Tab.LOGOUT))
    		    	getTabs().open(Tab.LOGOUT);
    		    } else {
    				getMouse().move(p);
    				sleep(10, 60);
    				getMouse().click();
    				sleep(10, 60);
    

    Though, I could be wrong.

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.