Skip to content
Nexius edited this page Jan 10, 2021 · 18 revisions

WeaponsUpdate (packetid: 204)

Destination:
Incoming/Outcoming

Description:
Called only when a player actually updates his weapon/ammo in any of the slots (including the one in which the player is holding a weapon).

Parameters (for incoming packet):

Value type Parameter Short description
PR_UINT8 packetId The ID of the packet
PR_UINT16 targetId The ID of a player which is aimed by the player
PR_UINT16 targetActorId The ID of an actor which is aimed by the player
PR_UINT8 slotId The weapon slot to get data for
PR_UINT8 slotWeaponId The weapon ID in the specified slot
PR_UINT16 slotWeaponAmmo The ammo in the specified slot

Note:
slotId, slotWeaponId and slotWeaponAmmo are duplicated 13 times (by the number of weapon slots), with slotId value from 0 to 12.

Related SA-MP callbacks:

  • None (but the data can be received indefinitely using GetPlayerWeaponData, GetPlayerTargetPlayer and GetPlayerTargetActor)

Example (as incoming packet):

const WEAPONS_UPDATE_SYNC = 204;

IPacket:WEAPONS_UPDATE_SYNC(playerid, BitStream:bs)
{
    new weaponsUpdate[PR_WeaponsUpdate];

    BS_IgnoreBits(bs, 8);
    BS_ReadWeaponsUpdate(bs, weaponsUpdate);

    //Anything you want to see here

    return 1;
}