Something wrong happened when I read bullet sync data with RakNet
#1

I'm learning about RakNet and I was trying to read bullet sync data but the data was not exactly what I want. It gives me strange value and in the code and the video below, you can see that I don't change my weapon but the bulletSyncData[PR_weaponId] value changes. I need a help to solve this.
My English is not good so I cannot have more words.
PHP код:
const ID_BULLET_SYNC 206;
public 
OnIncomingPacket(playeridpacketidBitStream:bs)
{
    if(
packetid == ID_BULLET_SYNC)
    {
        new 
bulletSyncData[PR_BulletSync],
               
Packed:string[128];
        
BS_ReadBulletSync(bsbulletSyncData);
        
format(stringsizeof(string), !"hittype: %d, hitid: %d, weaponid: %d"bulletSyncData[PR_hitType],
        
bulletSyncData[PR_hitId], bulletSyncData[PR_weaponId]);
        
msg(playerid, -1string);
    }
    return 
1;

More at this video.
Reply
#2

pawn Код:
BS_IgnoreBits(bs, 8);
before BS_ReadBulletSync function.
Reply
#3

Quote:
Originally Posted by Calisthenics
Посмотреть сообщение
pawn Код:
BS_IgnoreBits(bs, 8);
before BS_ReadBulletSync function.
I don't know what BS_IgnoreBits does but It works now! Thank you [REP++]
So everytime I use BS_ReadBulletSync, I must put BS_IgnoreBits before it, right?
Reply
#4

https://sampforum.blast.hk/showthread.php?tid=652400
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)