Skip to content
urShadow edited this page Mar 15, 2020 · 12 revisions

Natives

playerid == -1 => broadcast

native BS_SendPacket(BitStream:bs, playerid, PR_PacketPriority:priority = PR_HIGH_PRIORITY, PR_PacketReliability:reliability = PR_RELIABLE_ORDERED);
native BS_SendRPC(BitStream:bs, playerid, rpcid, PR_PacketPriority:priority = PR_HIGH_PRIORITY, PR_PacketReliability:reliability = PR_RELIABLE_ORDERED);
native BS_EmulateIncomingPacket(BitStream:bs, playerid);
native BS_EmulateIncomingRPC(BitStream:bs, playerid, rpcid);

native BitStream:BS_New();
native BS_Delete(&BitStream:bs);

native BS_Reset(BitStream:bs);
native BS_ResetReadPointer(BitStream:bs);
native BS_ResetWritePointer(BitStream:bs);
native BS_IgnoreBits(BitStream:bs, number_of_bits);

native BS_SetWriteOffset(BitStream:bs, offset);
native BS_GetWriteOffset(BitStream:bs, &offset);
native BS_SetReadOffset(BitStream:bs, offset);
native BS_GetReadOffset(BitStream:bs, &offset);

native BS_GetNumberOfBitsUsed(BitStream:bs, &number);
native BS_GetNumberOfBytesUsed(BitStream:bs, &number);
native BS_GetNumberOfUnreadBits(BitStream:bs, &number);
native BS_GetNumberOfBitsAllocated(BitStream:bs, &number);

native BS_WriteValue(BitStream:bs, {PR_ValueType, Float, _}:...);
native BS_ReadValue(BitStream:bs, {PR_ValueType, Float, _}:...);

native PR_RegHandler(id, const publicname[], PR_HandlerType:type);

Macroses

#define BS_ReadInt8(%0,%1) BS_ReadValue(%0,PR_INT8,%1)
#define BS_ReadInt16(%0,%1) BS_ReadValue(%0,PR_INT16,%1)
#define BS_ReadInt32(%0,%1) BS_ReadValue(%0,PR_INT32,%1)
#define BS_ReadUint8(%0,%1) BS_ReadValue(%0,PR_UINT8,%1)
#define BS_ReadUint16(%0,%1) BS_ReadValue(%0,PR_UINT16,%1)
#define BS_ReadUint32(%0,%1) BS_ReadValue(%0,PR_UINT32,%1)
#define BS_ReadFloat(%0,%1) BS_ReadValue(%0,PR_FLOAT,%1)
#define BS_ReadBool(%0,%1) BS_ReadValue(%0,PR_BOOL,%1)
#define BS_ReadString(%0,%1,%2) BS_ReadValue(%0,PR_STRING,%1,%2)

#define BS_ReadCompressedInt8(%0,%1) BS_ReadValue(%0,PR_CINT8,%1)
#define BS_ReadCompressedInt16(%0,%1) BS_ReadValue(%0,PR_CINT16,%1)
#define BS_ReadCompressedInt32(%0,%1) BS_ReadValue(%0,PR_CINT32,%1)
#define BS_ReadCompressedUint8(%0,%1) BS_ReadValue(%0,PR_CUINT8,%1)
#define BS_ReadCompressedUint16(%0,%1) BS_ReadValue(%0,PR_CUINT16,%1)
#define BS_ReadCompressedUint32(%0,%1) BS_ReadValue(%0,PR_CUINT32,%1)
#define BS_ReadCompressedFloat(%0,%1) BS_ReadValue(%0,PR_CFLOAT,%1)
#define BS_ReadCompressedBool(%0,%1) BS_ReadValue(%0,PR_CBOOL,%1)
#define BS_ReadCompressedString(%0,%1,%2) BS_ReadValue(%0,PR_CSTRING,%1,%2)

#define BS_ReadBits(%0,%1,%2) BS_ReadValue(%0,PR_BITS,%1,%2)
#define BS_ReadFloat3(%0,%1) BS_ReadValue(%0,PR_FLOAT3,%1)
#define BS_ReadFloat4(%0,%1) BS_ReadValue(%0,PR_FLOAT4,%1)
#define BS_ReadVector(%0,%1) BS_ReadValue(%0,PR_VECTOR,%1)
#define BS_ReadNormQuat(%0,%1) BS_ReadValue(%0,PR_NORM_QUAT,%1)

#define BS_ReadString8(%0,%1) BS_ReadValue(%0,PR_STRING8,%1)
#define BS_ReadString32(%0,%1) BS_ReadValue(%0,PR_STRING32,%1)

#define BS_WriteInt8(%0,%1) BS_WriteValue(%0,PR_INT8,%1)
#define BS_WriteInt16(%0,%1) BS_WriteValue(%0,PR_INT16,%1)
#define BS_WriteInt32(%0,%1) BS_WriteValue(%0,PR_INT32,%1)
#define BS_WriteUint8(%0,%1) BS_WriteValue(%0,PR_UINT8,%1)
#define BS_WriteUint16(%0,%1) BS_WriteValue(%0,PR_UINT16,%1)
#define BS_WriteUint32(%0,%1) BS_WriteValue(%0,PR_UINT32,%1)
#define BS_WriteFloat(%0,%1) BS_WriteValue(%0,PR_FLOAT,%1)
#define BS_WriteBool(%0,%1) BS_WriteValue(%0,PR_BOOL,%1)
#define BS_WriteString(%0,%1) BS_WriteValue(%0,PR_STRING,%1)

#define BS_WriteCompressedInt8(%0,%1) BS_WriteValue(%0,PR_CINT8,%1)
#define BS_WriteCompressedInt16(%0,%1) BS_WriteValue(%0,PR_CINT16,%1)
#define BS_WriteCompressedInt32(%0,%1) BS_WriteValue(%0,PR_CINT32,%1)
#define BS_WriteCompressedUint8(%0,%1) BS_WriteValue(%0,PR_CUINT8,%1)
#define BS_WriteCompressedUint16(%0,%1) BS_WriteValue(%0,PR_CUINT16,%1)
#define BS_WriteCompressedUint32(%0,%1) BS_WriteValue(%0,PR_CUINT32,%1)
#define BS_WriteCompressedFloat(%0,%1) BS_WriteValue(%0,PR_CFLOAT,%1)
#define BS_WriteCompressedBool(%0,%1) BS_WriteValue(%0,PR_CBOOL,%1)
#define BS_WriteCompressedString(%0,%1) BS_WriteValue(%0,PR_CSTRING,%1)

#define BS_WriteBits(%0,%1,%2) BS_WriteValue(%0,PR_BITS,%1,%2)
#define BS_WriteFloat3(%0,%1) BS_WriteValue(%0,PR_FLOAT3,%1)
#define BS_WriteFloat4(%0,%1) BS_WriteValue(%0,PR_FLOAT4,%1)
#define BS_WriteVector(%0,%1) BS_WriteValue(%0,PR_VECTOR,%1)
#define BS_WriteNormQuat(%0,%1) BS_WriteValue(%0,PR_NORM_QUAT,%1)

#define BS_WriteString8(%0,%1) BS_WriteValue(%0,PR_STRING8,%1)
#define BS_WriteString32(%0,%1) BS_WriteValue(%0,PR_STRING32,%1)

#define PR_EXPAND_ARR3(%0) %0[0],%0[1],%0[2]
#define PR_EXPAND_ARR4(%0) %0[0],%0[1],%0[2],%0[3]

Stocks

stock BS_ReadOnFootSync(BitStream:bs, data[PR_OnFootSync], outcoming = false);
stock BS_ReadInCarSync(BitStream:bs, data[PR_InCarSync], outcoming = false);
stock BS_ReadTrailerSync(BitStream:bs, data[PR_TrailerSync]);
stock BS_ReadPassengerSync(BitStream:bs, data[PR_PassengerSync]);
stock BS_ReadUnoccupiedSync(BitStream:bs, data[PR_UnoccupiedSync]);
stock BS_ReadAimSync(BitStream:bs, data[PR_AimSync]);
stock BS_ReadBulletSync(BitStream:bs, data[PR_BulletSync]);
stock BS_ReadSpectatingSync(BitStream:bs, data[PR_SpectatingSync]);
stock BS_ReadWeaponsUpdate(BitStream:bs, data[PR_WeaponsUpdate]);

stock BS_WriteOnFootSync(BitStream:bs, data[PR_OnFootSync], outcoming = false);
stock BS_WriteInCarSync(BitStream:bs, data[PR_InCarSync], outcoming = false);
stock BS_WriteTrailerSync(BitStream:bs, data[PR_TrailerSync]);
stock BS_WritePassengerSync(BitStream:bs, data[PR_PassengerSync]);
stock BS_WriteUnoccupiedSync(BitStream:bs, data[PR_UnoccupiedSync]);
stock BS_WriteAimSync(BitStream:bs, data[PR_AimSync]);
stock BS_WriteBulletSync(BitStream:bs, data[PR_BulletSync]);
stock BS_WriteSpectatingSync(BitStream:bs, data[PR_SpectatingSync]);
stock BS_WriteWeaponsUpdate(BitStream:bs, data[PR_WeaponsUpdate]);