GetPlayerAmmo

From SA-MP Wiki

Jump to: navigation, search


Description:

Gets the amount of ammo in a player's current weapon.


Parameters:
(playerid)
playeridThe ID of the player whose ammo to get.


Return Values:

The amount of ammo in the player's current weapon.


Image:32px-Circle-style-warning.png

Important
Note

The ammo can hold 16-bit values, therefore values over 32767 will return erroneous values.


Example Usage:

ShowPlayerAmmo(playerid)
{
    new ammo = GetPlayerAmmo(playerid);
    new infoString[16];
    format(infoString, sizeof(infoString), "Ammo: %i", ammo);
    SendClientMessage(playerid, -1, infoString);
}


Related Functions

The following functions may be useful, as they are related to this function in one way or another.

Personal tools
Navigation
Toolbox
In other languages