[NOTE] Because of Ganders birthday party , some threads got deleted , and people lost post count and rep ( they seem to care LOL! ) So im reposting this and my other tutorials.
Purpose : To add a working BankPin system , Reenscape way , fixed by me.
Difficulty : Adding ints booleans statements and methods seems to be hard for some people.
Server Base : ReenScape ,LegendzPK ( My first pking source )
Credits : 99% Creator of ReenScape , 1% Me for fixing System and validation.
Step 1:Go into Player.java and under "public abstract class Player" add these ints :
Code:
public int correctPin = 0;
public int bankSet = 0;
Step 2: Save and close player.java and go into your client.java and under
"public class client implements runnable {"
add these ints booleans statements methods.
Code:
public void BankSystem(String Message) {
outStream.createFrame(218);
outStream.writeWordBigEndianA(1);
BankSystem(Message);
outStream.createFrame(218);
outStream.writeWordBigEndianA(-1);
updateRequired = true;
appearanceUpdateRequired = true;
}
public int doubler = 1;
public int bankPin = 0;
public boolean setpin = false;
public boolean bankCorrect = false;
public boolean changeMode = false;
public void VerifyPin() {
boolean chck = changeMode;
closeInterface();
if(chck == false) {
if(bankPin == correctPin) {
bankCorrect = true;
BankSystem("You have correctly entered you PIN.");
Print.ln("[Valid]"+playerName+" entered a valid pin");
openUpBank();
} else {
BankSystem("Invalid PIN.");
Print.ln("[Error]"+playerName+" entered a invalid pin");
}
} else {
correctPin = bankPin;
BankSystem("Bank PIN set!");
bankSet = 1;
bankCorrect = true;
}
}
public void setpin() {
BankSystem("Bank PIN set!");
changeMode = true;
bankSet = 1;
}
public void bankInterfaces(int callid) {
switch(callid) {
case 58074:
bankPin = 0;
doubler = 1;
LegendS("Cancelled.");
closeInterface();
break;
case 58025:
addNumber(1);
break;
case 58026:
addNumber(2);
break;
case 58027:
addNumber(3);
break;
case 58028:
addNumber(4);
break;
case 58029:
addNumber(5);
break;
case 58030:
addNumber(6);
break;
case 58031:
addNumber(7);
break;
case 58032:
addNumber(8);
break;
case 58033:
addNumber(9);
break;
case 58034:
addNumber(0);
break;
}
}
public void initBankPIN() {
BankTextInfo();
VerifyPin();
if(setpin == false) {
setpin();
setpin = true;
if(changeMode == true) {
sendFrame126("@[email protected] enter your Bank Pin:", 14920);
}
doubler = 1;
bankPin = 0;
showInterface(7424);
}
}
public void BankTextInfo() {
sendFrame126("@[email protected] Bank of Project Legend X", 14923);
sendFrame126("@[email protected] enter your PIN using the buttons below.", 14920);
if(pinenter == 0) sendFrame126("@[email protected] click the FIRST digit", 15313); // First entry
sendFrame126("@[email protected]", 14883);
sendFrame126("@[email protected]", 14884);
sendFrame126("@[email protected]", 14885);
sendFrame126("@[email protected]", 14886);
sendFrame126("@[email protected]", 14887);
sendFrame126("@[email protected]", 14888);
sendFrame126("@[email protected]", 14889);
sendFrame126("@[email protected]", 14890);
sendFrame126("@[email protected]", 14891);
sendFrame126("@[email protected]", 14892);
sendFrame126("@[email protected] don't know it.", 14921);
sendFrame126("@[email protected]", 14922);
}
public int pinenter = 0;
public void addNumber(int Number) {
int temp1 = Number * doubler;
if(pinenter == 0) sendFrame126("@[email protected] click the FIRST digit", 15313); // First entry
if(pinenter == 1) sendFrame126("@[email protected] click the SECOND digit", 15313); // Second entry
if(pinenter == 2) sendFrame126("@[email protected] click the THIRD digit", 15313); // Third entry
if(pinenter == 3) sendFrame126("@[email protected] click the FOURTH digit", 15313); // Fourth entry
if(pinenter == 4) sendFrame126("@[email protected] click the FIFTH digit", 15313); // Fourth entry
pinenter++;
bankPin += temp1;
doubler = doubler * 10;
if(doubler == 10000) {
doubler = 1;
VerifyPin();
}
}
Now this is an important step. I will explain it as simple as possible for those that are to retarted to understand basic english.
Every bank booth in your server has an ID , this ID will be a case in method first object click and second object click , for example , a bank booths ID is 5 then the case number in method first object click would be case 5:
Now , inside each case of a bankbooth , you will see openUpBank();
replace that with : initBankPIN(); in both cases in first object and second object click.
When you have done that. Save , compile and run your server , and now when you click on a bank booth , you need to set and enter a PIN!
~Legend Rene
[NOTE]Do not post your errors here , this is all basic java , and any errors you will get should be easy to fix , if you cannot seem to fix them , post in the help section. I will not help you if you post your errors here[NOTE]