12.05.2012, 04:09
So I came up with a way to "Hard Cap Ammo Capacity" on players. Problem is its not working.
Its not creating the gun. Even with 0 Ammo/no gun in hand.
pawn Код:
public IsAtAmmoLimit(playerid, gun, ammo)
{
new weaponid, ammo2;
GetPlayerWeaponData(playerid, gun, weaponid, ammo2);
switch(gun)
{
case 0:
{
if(PlayerInfo[playerid][pGunAmmo0] + ammo <= 500 && PlayerInfo[playerid][pGunAmmo0] == ammo2) { return 1; }
}
case 1:
{
if(PlayerInfo[playerid][pGunAmmo1] + ammo <= 500 && PlayerInfo[playerid][pGunAmmo1] == ammo2) { return 1; }
}
case 2:
{
if(PlayerInfo[playerid][pGunAmmo2] + ammo <= 500 && PlayerInfo[playerid][pGunAmmo2] == ammo2) { return 1; }
}
case 3:
{
if(PlayerInfo[playerid][pGunAmmo3] + ammo <= 500 && PlayerInfo[playerid][pGunAmmo3] == ammo2) { return 1; }
}
case 4:
{
if(PlayerInfo[playerid][pGunAmmo4] + ammo <= 500 && PlayerInfo[playerid][pGunAmmo4] == ammo2) { return 1; }
}
case 5:
{
if(PlayerInfo[playerid][pGunAmmo5] + ammo <= 500 && PlayerInfo[playerid][pGunAmmo5] == ammo2) { return 1; }
}
case 6:
{
if(PlayerInfo[playerid][pGunAmmo6] + ammo <= 500 && PlayerInfo[playerid][pGunAmmo6] == ammo2) { return 1; }
}
case 7:
{
if(PlayerInfo[playerid][pGunAmmo7] + ammo <= 500 && PlayerInfo[playerid][pGunAmmo7] == ammo2) { return 1; }
}
case 8:
{
if(PlayerInfo[playerid][pGunAmmo8] + ammo <= 500 && PlayerInfo[playerid][pGunAmmo8] == ammo2) { return 1; }
}
case 9:
{
if(PlayerInfo[playerid][pGunAmmo9] + ammo <= 500 && PlayerInfo[playerid][pGunAmmo9] == ammo2) { return 1; }
}
case 10:
{
if(PlayerInfo[playerid][pGunAmmo10] + ammo <= 500 && PlayerInfo[playerid][pGunAmmo10] == ammo2) { return 1; }
}
case 11:
{
if(PlayerInfo[playerid][pGunAmmo11] + ammo <= 500 && PlayerInfo[playerid][pGunAmmo11] == ammo2) { return 1; }
}
case 12:
{
if(PlayerInfo[playerid][pGunAmmo12] + ammo <= 500 && PlayerInfo[playerid][pGunAmmo12] == ammo2) { return 1; }
}
}
return 0;
}
pawn Код:
if(PlayerInfo[playerid][pArmsSkill] >= 0)
{
if(PlayerInfo[playerid][pCarP] >= 125 && IsAtAmmoLimit(playerid, 22, 120) == 1)
{
SafeGivePlayerWeapon(playerid, 22, 120);
PlayerInfo[playerid][pCarP] -= 125;
PlayerInfo[playerid][pArmsSkill]++;
SendClientMessage(playerid, COLOR_LIGHTYELLOW, "[Legendary Gaming RolePlay]:");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "You successfully made a [ Pistol ] from the Gunsmith!");
if(PlayerInfo[playerid][pArmsSkill] == 50)
{ SendClientMessage(playerid, COLOR_YELLOW, "* Weapon Crafter Skill is now Level 2, New Weapon Schematic: The Rifle."); }
else if(PlayerInfo[playerid][pArmsSkill] == 100)
{ SendClientMessage(playerid, COLOR_YELLOW, "* Weapon Crafter Skill is now Level 3, New Weapon Schematic: The MP5."); }
else if(PlayerInfo[playerid][pArmsSkill] == 200)
{ SendClientMessage(playerid, COLOR_YELLOW, "* Weapon Crafter Skill is now LVL 4, New Weapon Schematics: The Desert Eagle."); }
else if(PlayerInfo[playerid][pArmsSkill] == 500)
{ SendClientMessage(playerid, COLOR_YELLOW, "* Maximumn Level Achieved!, New Weapon Schematic: The AK-47/M4."); }
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "You don't have enough Car Parts!");
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "You lack the Weapon Crafting Level to Make That!");
}