23.02.2013, 12:24
Some weapons will become infinite when ammo is set to 9999, however with my code (if weapon ammo is infinite), the weapons will become bugged.
OnPlayerDeath:
It loops through all weapon slots and saves the weapons to an array, then when they respawn it gives them the weapons again with the same ammo amount.
So basically, if I /givewep 0 24 9999 the Desert Eagle ammunition is infinite, when I die and I get the weapon again, I can't switch to it as it is bugged with an ammo which seems to be something like -1 ...
If I set the ammo to a lower amount than 9999 it works, however.
Any fix for this?
OnPlayerDeath:
pawn Код:
for (new i = 0; i < 13; i++) GetPlayerWeaponData(playerid, i, PAdminDeathWeapons[playerid][i][0], PAdminDeathWeapons[playerid][i][1]);
SetSpawnInfo(playerid, 0, UserStats[playerid][Skin], x, y, z, 0, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
SetPlayerHealth(playerid, 100);
SetTimerEx("DeathGiveWep", 750, false, "i", playerid);
pawn Код:
public DeathGiveWep(playerid)
{
for (new i = 0; i < 13; i++)
{
GivePlayerWeapon(playerid, PAdminDeathWeapons[playerid][i][0], PAdminDeathWeapons[playerid][i][1]);
}
}
So basically, if I /givewep 0 24 9999 the Desert Eagle ammunition is infinite, when I die and I get the weapon again, I can't switch to it as it is bugged with an ammo which seems to be something like -1 ...
If I set the ammo to a lower amount than 9999 it works, however.
Any fix for this?