Skip to content
Denis edited this page Sep 11, 2021 · 12 revisions

Natives

playerid = -1 means broadcast to all players

native PR_SendPacket(BitStream:bs, playerid, PR_PacketPriority:priority = PR_HIGH_PRIORITY, PR_PacketReliability:reliability = PR_RELIABLE_ORDERED, orderingchannel = 0);
native PR_SendRPC(BitStream:bs, playerid, rpcid, PR_PacketPriority:priority = PR_HIGH_PRIORITY, PR_PacketReliability:reliability = PR_RELIABLE_ORDERED, orderingchannel = 0);
native PR_EmulateIncomingPacket(BitStream:bs, playerid);
native PR_EmulateIncomingRPC(BitStream:bs, playerid, rpcid);

native BitStream:BS_New();
native BitStream:BS_NewCopy(BitStream:bs);
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(eventid, const publicname[], PR_HandlerType:type);

Stocks

stock PR_SendPacketToPlayerStream(BitStream:bs, playerid, PR_PacketPriority:priority = PR_HIGH_PRIORITY, PR_PacketReliability:reliability = PR_RELIABLE_ORDERED);
stock PR_SendRPCToPlayerStream(BitStream:bs, playerid, rpcid, PR_PacketPriority:priority = PR_HIGH_PRIORITY, PR_PacketReliability:reliability = PR_RELIABLE_ORDERED);

stock PR_SendPacketToVehicleStream(BitStream:bs, vehicleid, excludedplayerid = INVALID_PLAYER_ID, PR_PacketPriority:priority = PR_HIGH_PRIORITY, PR_PacketReliability:reliability = PR_RELIABLE_ORDERED);
stock PR_SendRPCToVehicleStream(BitStream:bs, vehicleid, rpcid, excludedplayerid = INVALID_PLAYER_ID, PR_PacketPriority:priority = PR_HIGH_PRIORITY, PR_PacketReliability:reliability = PR_RELIABLE_ORDERED);
stock BS_ReadOnFootSync(BitStream:bs, data[PR_OnFootSync], outgoing = false);
stock BS_ReadInCarSync(BitStream:bs, data[PR_InCarSync], outgoing = 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_ReadMarkersSync(BitStream:bs, data[PR_MarkersSync]);
stock BS_ReadWeaponsUpdate(BitStream:bs, data[PR_WeaponsUpdate]);
stock BS_ReadStatsUpdate(BitStream:bs, data[PR_StatsUpdate]);
stock BS_ReadRconCommand(BitStream:bs, data[PR_RconCommand]);

stock BS_WriteOnFootSync(BitStream:bs, data[PR_OnFootSync], outgoing = false);
stock BS_WriteInCarSync(BitStream:bs, data[PR_InCarSync], outgoing = 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_WriteMarkersSync(BitStream:bs, data[PR_MarkersSync]);
stock BS_WriteWeaponsUpdate(BitStream:bs, data[PR_WeaponsUpdate]);
stock BS_WriteStatsUpdate(BitStream:bs, data[PR_StatsUpdate]);
stock BS_WriteRconCommand(BitStream:bs, data[PR_RconCommand]);

stock BS_PackHealthArmour(health, armour, &healthArmour);
stock BS_UnpackHealthArmour(healthArmour, &health, &armour);

stock BS_PackAspectRatio(Float:value);
stock Float:BS_UnpackAspectRatio(value);
stock BS_PackCameraZoom(Float:value);
stock Float:BS_UnpackCameraZoom(value);

Macroses

BS_ReadInt8(BitStream:bs, &value);
BS_ReadInt16(BitStream:bs, &value);
BS_ReadInt32(BitStream:bs, &value);
BS_ReadUint8(BitStream:bs, &value);
BS_ReadUint16(BitStream:bs, &value);
BS_ReadUint32(BitStream:bs, &value);
BS_ReadFloat(BitStream:bs, &value);
BS_ReadBool(BitStream:bs, &value);
BS_ReadString(BitStream:bs, dest[], size);

BS_ReadCompressedInt8(BitStream:bs, &value);
BS_ReadCompressedInt16(BitStream:bs, &value);
BS_ReadCompressedInt32(BitStream:bs, &value);
BS_ReadCompressedUint8(BitStream:bs, &value);
BS_ReadCompressedUint16(BitStream:bs, &value);
BS_ReadCompressedUint32(BitStream:bs, &value);
BS_ReadCompressedFloat(BitStream:bs, &value);
BS_ReadCompressedBool(BitStream:bs, &value);
BS_ReadCompressedString(BitStream:bs, dest[], size);

BS_ReadBits(BitStream:bs, &value, count);
BS_ReadFloat3(BitStream:bs, dest[]);
BS_ReadFloat4(BitStream:bs, dest[]);
BS_ReadVector(BitStream:bs, dest[]);
BS_ReadNormQuat(BitStream:bs, dest[]);

BS_ReadString8(BitStream:bs, dest[]);
BS_ReadString32(BitStream:bs, dest[]);

BS_WriteInt8(BitStream:bs, value);
BS_WriteInt16(BitStream:bs, value);
BS_WriteInt32(BitStream:bs, value);
BS_WriteUint8(BitStream:bs, value);
BS_WriteUint16(BitStream:bs, value);
BS_WriteUint32(BitStream:bs, value);
BS_WriteFloat(BitStream:bs, value);
BS_WriteBool(BitStream:bs, value);
BS_WriteString(BitStream:bs, const str[]);

BS_WriteCompressedInt8(BitStream:bs, value);
BS_WriteCompressedInt16(BitStream:bs, value);
BS_WriteCompressedInt32(BitStream:bs, value);
BS_WriteCompressedUint8(BitStream:bs, value);
BS_WriteCompressedUint16(BitStream:bs, value);
BS_WriteCompressedUint32(BitStream:bs, value);
BS_WriteCompressedFloat(BitStream:bs, value);
BS_WriteCompressedBool(BitStream:bs, value);
BS_WriteCompressedString(BitStream:bs, const str[]);

BS_WriteBits(BitStream:bs, value, count);
BS_WriteFloat3(BitStream:bs, const arr[]);
BS_WriteFloat4(BitStream:bs, const arr[]);
BS_WriteVector(BitStream:bs, const arr[]);
BS_WriteNormQuat(BitStream:bs, const arr[]);

BS_WriteString8(BitStream:bs, const str[]);
BS_WriteString32(BitStream:bs, const str[]);