Skip to content
Denis edited this page May 3, 2020 · 3 revisions
const ID_RPC = 20;
const RPC_Chat = 101;

IRawPacket:ID_RPC(playerid, BitStream:bs)
{
    new rpcid, numberOfBitsOfData;

    BS_ReadValue(bs,
        PR_IGNORE_BITS, 8, // packet id
        PR_UINT8, rpcid,
        PR_CUINT32, numberOfBitsOfData
    );

    printf("IRawPacket:ID_RPC: playerid=%d, rpcid=%d, numberOfBitsOfData=%d", playerid, rpcid, numberOfBitsOfData);

    if (rpcid == RPC_Chat)
    {
        new chatMessage[256];

        BS_ReadValue(bs,
            PR_STRING8, chatMessage, sizeof(chatMessage)
        );

        printf("[chat] playerid=%d: %s", playerid, chatMessage);
    }

    return 1;
}