pawn Код:
new gun, ammo;
if(newstate == PLAYER_STATE_DRIVER && GetPlayerWeapon(playerid) == 29)
{
if(GetPlayerWeapon(playerid) == 29)
{
GetPlayerWeaponData(playerid, 4, gun, ammo); // An MP5 was, is, and always will be slot 4. You don't need a loop for a constant value.
SetPlayerAmmo(playerid, 4, 0); // SetPlayerAmmo works on the SLOT, not the weapon.
}
}
if(newstate == 1 && oldstate == 2)
{
GivePlayerWeapon(playerid, 29, ammo);
}
return 1;
}
pawn Код:
public OnPlayerStateChange(playerid, oldstate, newstate)
{
if(newstate == 2) SetPlayerArmedWeapon(playerid, 0);
return 1;
}