19.11.2011, 01:52
pawn Code:
new pWeapon[MAX_PLAYERS];
stock SetPlayerWeapon(playerid, weaponid, ammo)
{
GivePlayerWeapon(playerid, weaponid, ammo);
pWeapon[playerid] = weaponid;
return 1;
}
public OnPlayerUpdate(playerid)
{
if(GetPlayerWeapon(playerid) != pWeapon[playerid]) // If they changed weapon
{
SetPlayerArmedWeapon(playerid, pWeapon[playerid]); // Force their weapon back
}
return 1;
}
To fix it, you would need to get the ammo using GetPlayerWeaponData, thus needing to get the slot for the weapon. If it's 0, don't force that weapon back.