05.10.2010, 17:44
The &weapon parameter in GetPlayerWeaponData is just a reference, that is filled with the weapon id, the player has in the specified slot.
You could use GetPlayerAmmo, but it will only work, if the player has the weapon equipped.
Other ways would be, to define something to get the weapon slot from a weapon id
It could look like this (https://sampwiki.blast.hk/wiki/Control_Structures):
#define GetWeaponSlot(%0) (%0 == 22 || %0 == 23 || %0 == 24) ? (2) : ((%0 == 25 || %0 == 26 || %0 == 27) ? (3) : (and so on for all slots)
This would be a long define, you can also make a stock function with switch doing the same thing.
You could use GetPlayerAmmo, but it will only work, if the player has the weapon equipped.
Other ways would be, to define something to get the weapon slot from a weapon id
It could look like this (https://sampwiki.blast.hk/wiki/Control_Structures):
#define GetWeaponSlot(%0) (%0 == 22 || %0 == 23 || %0 == 24) ? (2) : ((%0 == 25 || %0 == 26 || %0 == 27) ? (3) : (and so on for all slots)
This would be a long define, you can also make a stock function with switch doing the same thing.