I have a question..
I want to add something to my server wherefore it's required to be logging in for the first time.
Well I know how to make the variables etc. but I wanna make it so if u log in and there isn't a character file created yet the variable firstlogin is set to 1.
So that if u log in again u won't get the same thing over and over again.
I guess this is the code you need now I'm asking if u login the variable firstlogin is set to +1? but I don't now the right code for it and can't find in soemwhere else for emulous so...
Code:
public static int loadGame(Player p, String playerName, String playerPass) {
String line = "";
String token = "";
String token2 = "";
String[] token3 = new String[3];
boolean EndOfFile = false;
int ReadMode = 0;
BufferedReader characterfile = null;
BufferedReader characterfile2 = null;
boolean File1 = false;
boolean File2 = false;
try {
characterfile = new BufferedReader(new FileReader("./bin/characters/"+playerName+".txt"));
File1 = true;
} catch(FileNotFoundException fileex1) {
}
if (File1) {
File myfile1 = new File ("./characters/"+playerName+".txt");
} else {
Misc.println(playerName+": character file not found.");
p.newPlayer = true;
return 0;
}
try {
line = characterfile.readLine();
} catch(IOException ioexception) {
Misc.println(playerName+": error loading file.");
return 3;
}
while(EndOfFile == false && line != null) {
line = line.trim();
int spot = line.indexOf("=");
if (spot > -1) {
token = line.substring(0, spot);
token = token.trim();
token2 = line.substring(spot + 1);
token2 = token2.trim();
token3 = token2.split("\t");
switch (ReadMode) {
case 1:
if (token.equals("character-password")) {
if (playerPass.equalsIgnoreCase(token2)) {
} else {
return 2;
}
}