GetPlayerWeaponData
From SA-MP Wiki
GetPlayerWeaponData
Read the weapon and ammo in a specific weapon slot of a player.
(playerid, slot, &weapons, &ammo)
| playerid | ID of the player |
| slot | Weapon slot to read (0-12) |
| &weapons | Variable to store the weapon ID, passed by reference |
| &ammo | Variable to store the ammo, passed by reference |
This function does not return a specific value.
//common use: get all weapons and store info in an array containing 13 slots //first value is weapon id and second is ammo new weapons[13][2]; for (new i = 0; i < 13; i++) { GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]); }
Related Functions
The following functions might be useful as well, as they're related to this function in one way or another.
- GetPlayerWeapon: Check what weapon a player is currently holding.
- GivePlayerWeapon: Give a player a weapon.
