Players can't add GMs to buddylist

Joined
Jul 13, 2008
Messages
419
Reaction score
217
BuddylistModifyHandler.java
Add
Code:
Connection con = DatabaseConnection.getConnection();
            try {
                PreparedStatement ps = con.prepareStatement("SELECT * FROM characters WHERE gm > 0 AND name = ?");
                ps.setString(1, addName);
                ResultSet rs = ps.executeQuery();

                if (rs.next() && !player.isGM()) {
                    player.dropMessage(1, "Gamemaster is not available as a buddy.");
                    return;
                }

                rs.close();
                ps.close();
            } catch (SQLException sqlE) {}
Under
Code:
String addName = slea.readMapleAsciiString();
 
Thanks, that very useful and gms-like :) added!

C:\Users\אור לייזר\Documents\NetBeansProjects\MapleDev\src\net\sf\odinms\net\channel\handler\BuddylistModifyHandler.java:75: cannot find symbol
symbol : method isGM()
location: class net.sf.odinms.client.MapleCharacter
if (rs.next() && !player.isGM()) {
C:\Users\אור לייזר\Documents\NetBeansProjects\MapleDev\src\net\sf\odinms\net\channel\handler\BuddylistModifyHandler.java:107: con is already defined in handlePacket(net.sf.odinms.tools.data.input.SeekableLittleEndianAccessor,net.sf.odinms.client.MapleClient)
Connection con = DatabaseConnection.getConnection();
C:\Users\אור לייזר\Documents\NetBeansProjects\MapleDev\src\net\sf\odinms\net\channel\handler\BuddylistModifyHandler.java:140: con is already defined in handlePacket(net.sf.odinms.tools.data.input.SeekableLittleEndianAccessor,net.sf.odinms.client.MapleClient)
Connection con = DatabaseConnection.getConnection();

3 errors.
 
how the fuck can u know its gms-like
u event dont know a NAME of a GM in global
nice release btw
Go in Bera and try to add "Bera" to your buddylist and there is also a GM list on the Nexon forums anywhere. If you play EMS try to add "GMMango".


C:\Users\אור לייזר\Documents\NetBeansProjects\MapleDev\src\net\sf\odinms\net\channel\handler\BuddylistModifyHandler.java:75: cannot find symbol
symbol : method isGM()
location: class net.sf.odinms.client.MapleCharacter
if (rs.next() && !player.isGM()) {
C:\Users\אור לייזר\Documents\NetBeansProjects\MapleDev\src\net\sf\odinms\net\channel\handler\BuddylistModifyHandler.java:107: con is already defined in handlePacket(net.sf.odinms.tools.data.input.SeekableLittleEndianAccessor,net.sf.odinms.client.MapleClient)
Connection con = DatabaseConnection.getConnection();
C:\Users\אור לייזר\Documents\NetBeansProjects\MapleDev\src\net\sf\odinms\net\channel\handler\BuddylistModifyHandler.java:140: con is already defined in handlePacket(net.sf.odinms.tools.data.input.SeekableLittleEndianAccessor,net.sf.odinms.client.MapleClient)
Connection con = DatabaseConnection.getConnection();

3 errors.
For the first one add this in your MapleCharacter.java :
Code:
public boolean isGM() {
        return gmLevel >= 1;
    }
For the other ones just comment the lines out, it is already defined at top now.
 
PHP:
                PreparedStatement ps = con.prepareStatement("SELECT * FROM characters WHERE gm > 0 AND name = ?");

not should be gm > 1 ?
 
Why not just do it this way?
Its shorter and saves time
Below
MapleCharacter otherChar = c.getChannelServer().getPlayerStorage().getCharacterByName(addName);

Add
Code:
if (otherChar.isGM()) {
                        return;
                    }

It has a good reason that I didn't do it like that, what if "otherChar" is offline?
 
AverixBer, VectorBe, Bera, MintPowder, gmscody... those are the GMs THAT I KNOW in bera

TiaraYellond in yellonde too


oh and Next in Scania and KhainiHammer in Khaini
 
btw here's my way to do that
PHP:
Connection gmcheck = DatabaseConnection.getConnection(); // used gmcheck instead of con because it gets error
            try {
                PreparedStatement ps = gmcheck.prepareStatement("SELECT * FROM characters WHERE gm > 0 AND name = ?");
                ps.setString(1, addName);
                ResultSet rs = ps.executeQuery();
				
                if (rs.next() && !player.isGM()) {
                    c.getSession().write(MaplePacketCreator.serverNotice(1, "GameMaster is not available as a buddy."));
                    return;
                }
                rs.close();
                ps.close();
            } catch (SQLException sqlE) {}

im off to sleep.. cya tomorrow guys :):
 
Back