12.04.2015, 09:08
Just this is enough:
pawn Код:
public OnPlayerChangeWeapon(playerid, oldweapon, newweapon)
{
new clipsize = 0, string[7], leftammo = 0;
switch(newweapon)//set the value according to the guns clipsizes!
{
case 27: clipsize = 7;//for spas12
}
if((GetPlayerAmmo(playerid) - clipsize) >= clipsize)//if the ammo is more than or equal that of clipsize
{
leftammo = (GetPlayerAmmo(playerid) - clipsize);
format(string, sizeof(string), "%d - %d", clipsize, leftammo);
}
else//if the ammo is less than clip size
{
format(string, sizeof(string), "%d", GetPlayerAmmo(playerid));
leftammo = 0;
}
PlayerTextDrawSetString(playerid, txt[playerid], string);
return 1;
}