01.09.2015, 09:50
You must delete this value of the variable if the weapon is empty.
Put this into OnPlayerWeaponShot:
Maybe it is not the best solution but it work.
Put this into OnPlayerWeaponShot:
PHP код:
new Waffe[7],Ammo[8];
for(new i;i<12;i++)
{
if(i < 10 && i > -1)
{
format(Waffe,sizeof Waffe,"pGun0%i",i);
format(Ammo,sizeof Ammo,"pAmmo0%i",i);
}
else if(i >= 10)
{
format(Waffe,sizeof Waffe,"pGun%i",i);
format(Ammo,sizeof Ammo,"pAmmo%i",i);
}
if(PlayerInfo[playerid][Waffe] == weaponid)
{
if(PlayerInfo[playerid][Ammo] > 0)
{
PlayerInfo[playerid][Ammo] --;
}
if(PlayerInfo[playerid][Ammo] == 0)
{
PlayerInfo[playerid][Ammo] = 0;
PlayerInfo[playerid][Waffe] = 0;
}
}
}
![Wink](images/smilies/wink.png)