• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Check if player is online via Socket - always getting 0x00(offline)

Rer

LUA is for genius xD
Joined
Oct 24, 2012
Messages
234
Reaction score
16
Location
Poland
My problem is that always when I check via socket if player is online in node.js, I get 0x00 byte as a response. I tried with many different IP adresses. My question is how to send message with player name to get correct response. My code(but I don't expect you to fix my code, just looking for a suggestion):
Code:
this.getPlayerInfo = function(name) {
        var sendBuffer = new MsgBuffer(new Buffer([0xFF, 0x01, 0x40]));
        sendBuffer.putString(name, 'ASCII');

        var communication = new Communication(host, port);

        communication.on('connected', function () {
            communication.send(sendBuffer.getBuffer(true));
        })

        communication.on('receivedBytes', function(bytes) {
            console.log('Received: ' + bytes.length);
            if(bytes[2] == 0x22)
                console.log('0x22! : REQUEST_PLAYER_STATUS_INFO');
            if(bytes[3] == 0x01)
                console.log('online?');
            else if(bytes[3] == 0x00)
                console.log('offline?');
        });

        communication.connect();
    }
So, as you see I'm sending 0xFF, 0x01, 0x40(and of course, when my buffer is complete I put length of full message at the beginning, this works because other requests are working) and then sending player name in ASCII encoding. I've also tried putting name length as uint16(little-endian) before string but with no success. I always get 0x00 - offline. Please help me.
 
Back
Top Bottom