progamerz Posted April 8, 2016 Posted April 8, 2016 Hello, i am trying to make my script stop if the OSBot Client username is not progamerz Tried this code but still logging out if(getClient().getUsername() != "progamerz" ){ log("Take permission from progamerz please."); this.stop(); }
Charlotte Posted April 8, 2016 Posted April 8, 2016 (edited) if and no else ? if(getClient().getUsername().equalsIgnoreCase("Char")){ log("Welcome"+ getClient().getUsername().toString() + "!" + "You are authorized"); } else { log("Welcome" + getClient().getUsername().toString() + "!" + "You're not authorized to use this script!"); stop(); } Edited April 8, 2016 by Charlotte
Apaec Posted April 8, 2016 Posted April 8, 2016 you have to use comparators with non-value types, namely .equals() in this case. try if(!getClient().getUsername().equals("progamerz") ){ log("Take permission from progamerz please."); this.stop(); }
progamerz Posted April 9, 2016 Author Posted April 9, 2016 (edited) if and no else ? if(getClient().getUsername().equalsIgnoreCase("Char")){ log("Welcome"+ getClient().getUsername().toString() + "!" + "You are authorized"); } else { log("Welcome" + getClient().getUsername().toString() + "!" + "You're not authorized to use this script!"); stop(); } you have to use comparators with non-value types, namely .equals() in this case. try if(!getClient().getUsername().equals("progamerz") ){ log("Take permission from progamerz please."); this.stop(); } Will try and let u know! EDIT : both working thanks! Edited April 9, 2016 by progamerz 1