Basically, this is something like a function which allows you to display a message only when you login and it will not show when you change channel/coming out from cash shop. Besides message, you can even put others such as pop-up NPC, etc.
First:
MapleClient.java
LoginPasswordHandler
Add:
right after
PlayerLoggedInHandler
SQL
Credits to me. And yea, I'm sure there's a shorter way to do it.
-AuroX
First:
MapleClient.java
PHP:
private boolean message;
public boolean messageOn() {
PreparedStatement ps;
try {
ps = DatabaseConnection.getConnection().prepareStatement("SELECT message FROM accounts WHERE id = ?");
ps.setInt(1, this.getAccID());
ResultSet rs = ps.executeQuery();
while (rs.next()) {
if (rs.getInt("message") == 0) {
message = false;
} else {
message = true;
}
}
rs.close();
ps.close();
} catch (Exception e) {
System.out.println("message error");
}
return message;
}
public void setMessageToggle(int x) {
try {
PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("UPDATE accounts SET message = ? WHERE id = ?");
ps.setInt(1, x);
ps.setInt(2, getAccID());
ps.executeUpdate();
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
LoginPasswordHandler
Add:
PHP:
c.setMessageToggle(0);
PHP:
if (c.finishLogin(true) == 0) {
PlayerLoggedInHandler
PHP:
if (!c.messageOn()) {
player.dropMessage("Welcome to RageZone! If you see this, means your server is useless."); // EDIT here for your usage
c.setMessageToggle(1);
}
SQL
PHP:
ALTER TABLE `accounts` ADD `message` tinyint(1) NOT NULL DEFAULT '0';
Credits to me. And yea, I'm sure there's a shorter way to do it.
-AuroX
Last edited: