- Joined
- Jun 3, 2008
- Messages
- 84
- Reaction score
- 13
So users in the server I program for were asking for a command to ask for help from a GM so I created this command. It will send a pop up message to all GMs that are online with what the user typed.
@callgm This is an example of how to use the command.
EDIT minimumTimeToWait to the time you want players to wait before sending another help message (In minutes!)
Add the following into Commands.java in the player commands method.
You also have to run this in mysql
I understand that oh, there's a report button but that's for reporting someone so yeah. I've made it so you can only call a GM every hour.
Also, sorry if this command was created before delete this thread if there is one
@callgm This is an example of how to use the command.
EDIT minimumTimeToWait to the time you want players to wait before sending another help message (In minutes!)
Add the following into Commands.java in the player commands method.
PHP:
else if (sub[0].equals("callgm")) {
int minimumTimeToWait = 10;
try{
PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("Select * from characters where name = ?");
ps.setString(1, chr.getName());
ResultSet rs = ps.executeQuery();
if(!rs.next()){
rs.close();
ps.close();
} else {
long ts2 = rs.getLong("gmCallTime");
long ts1 = System.currentTimeMillis();
int timeDif = (int)(ts1-ts2)/60000;
if(timeDif >= minimumTimeToWait || timeDif < 0){
c.getChannelServer().broadcastGMPacket(MaplePacketCreator.serverNotice(1, chr.getName()+": " + StringUtil.joinStringFrom(sub, 1)));
ps = DatabaseConnection.getConnection().prepareStatement("update characters set gmCallTime = ? where name = ?");
ps.setLong(1, ts1);
ps.setString(2, chr.getName());
ps.executeUpdate();
} else {
c.announce(MaplePacketCreator.serverNotice(1, "You cannot call a GM for " + (minimumTimeToWait-timeDif) + " more minutes."));
}
rs.close();
ps.close();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
PHP:
ALTER TABLE `moopledev`.`characters` ADD COLUMN `gmCallTime` BIGINT NOT NULL DEFAULT '0'
I understand that oh, there's a report button but that's for reporting someone so yeah. I've made it so you can only call a GM every hour.
Also, sorry if this command was created before delete this thread if there is one
Last edited:

