• 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!

Get player info by socket

Darkinho

New Member
Joined
Feb 25, 2009
Messages
145
Reaction score
0
Hello!

I know that we get server info by socket:
$info = chr(6).chr(0).chr(255).chr(255).'info';

But how to get player info ?
As describe protocolstatus.cpp:

Code:
case 0x01: {
            uint16_t requestedInfo = msg.get<uint16_t>(); // only a Byte is necessary, though we could add new info here
            std::string characterName;
            if (requestedInfo & REQUEST_PLAYER_STATUS_INFO) {
                characterName = msg.getString();
            }
            g_dispatcher.addTask(createTask(std::bind(&ProtocolStatus::sendInfo, std::static_pointer_cast<ProtocolStatus>(shared_from_this()),
                                  requestedInfo, characterName)));
            return;
        }
 
Thanks for the reply Milice.
Will be something like this:
chr(6).chr(0).chr(1).chr(64).chr(64).chr(10).'playername';
Where 10 is the lenght of name ?
 
Thanks for the reply Milice.
Will be something like this:
chr(6).chr(0).chr(1).chr(64).chr(64).chr(10).'playername';
Where 10 is the lenght of name ?
0x01 is just 1, hex to dec works like:
(0*16^1)+(1*16^0) = 0 + 1 = 1 in decimal.
While 0x is just an idendifier to tell the program that it should interpret it as a hexadecimal integer.
 
Hello!

I know that we get server info by socket:
$info = chr(6).chr(0).chr(255).chr(255).'info';

But how to get player info ?
As describe protocolstatus.cpp:

Code:
case 0x01: {
            uint16_t requestedInfo = msg.get<uint16_t>(); // only a Byte is necessary, though we could add new info here
            std::string characterName;
            if (requestedInfo & REQUEST_PLAYER_STATUS_INFO) {
                characterName = msg.getString();
            }
            g_dispatcher.addTask(createTask(std::bind(&ProtocolStatus::sendInfo, std::static_pointer_cast<ProtocolStatus>(shared_from_this()),
                                  requestedInfo, characterName)));
            return;
        }
How to get 'advanced' status by socket from PHP:
https://otland.net/threads/ots-advanced-status-players-list-reader.216684/

What all these '6,0,1,255' etc. means in status:
https://otland.net/threads/ots-advanced-status-players-list-reader.216684/#post-2080688

So example above is wrong:

chr(6).chr(0).chr(1).chr(64).chr(64).chr(10).'playername';

It should be:

chr(15).chr(0) - length of message is '16 bit' = 2 bytes, out message is 15 bytes length, so we send 15 and 0 (15 * 1 + 0 * 256)
.chr(255) - we want status, status protocol is 255
.chr(1) - we want some special 'binary' status, not 'XML' basic info (XML info = 255 [0xFF])
.chr(64).chr(0) - REQUEST_PLAYER_STATUS_INFO = 1 << 6 = 64, request type is '16 bit' = 2 byte, so we send 64 and 0 (64 * 1 + 0 * 256)
.chr(9).chr(0) - length of name (any string in OTS protocol) is '16 bit' = 2 bytes, in our case it's 9, so we send 9 and 0 (9 * 1 + 0 * 256)
.'GM Gesior' - our name, 9 letters

Packet:
chr(15).chr(0).chr(255).chr(1).chr(64).chr(0).chr(9).chr(0).'GM Gesior'
 
Last edited:
Back
Top