15.01.2012, 02:25
pawn Код:
case 0: //standard
{
if(GetPlayerWeapon(playerid) != 0) {
if(tempGun[playerid] != -1)
{
SetPlayerArmedWeapon(playerid, tempGun[playerid]);
SetPlayerAmmo(playerid, GetWeaponSlot(tempGun[playerid]), tempAmmo[playerid]);
expAmmo[playerid] = -1;
UsingTazer[playerid] = -1;
tempGun[playerid] = -1;
tempAmmo[playerid] = -1;
SendClientMessage(playerid, COLOR_SUCCESSFUL, "* You are now using Standard Rounds!");
}
else return SendClientMessage(playerid, COLOR_ERROR, "< You are already using Standard Rounds!");
}
}
case 1: //explosive
{
if(tempGun[playerid] == -1)
{
expAmmo[playerid] = 1;
UsingTazer[playerid] = -1;
tempAmmo[playerid] = GetPlayerAmmo(playerid);
tempGun[playerid] = GetPlayerWeapon(playerid);
SetPlayerAmmo(playerid, GetWeaponSlot(tempGun[playerid]), -1);
SetPlayerAmmo(playerid, GetWeaponSlot(tempGun[playerid]), UserInfo[playerid][ExplosiveAmmo]);
SendClientMessage(playerid, COLOR_SUCCESSFUL, "* You are now using Incendiary Rounds!");
}
}
pawn Код:
stock GetWeaponSlot(weaponid)
{
switch (weaponid)
{
case 0, 1: return 0; // Unarmed
case 2 .. 9: return 1; // Melee
case 22 .. 24: return 2; // Pistol
case 25 .. 27: return 3; // Shotgun
case 28, 29, 32: return 4; // SMG
case 30, 31: return 5; // Machinegun
case 33, 34: return 6; // Rifle
case 35 .. 38: return 7; // Heavy
case 16, 18, 39: return 8; // Projectile
case 42, 43: return 9; // Special
case 14 : return 10; // Gifts
case 44 .. 46: return 11; // Special
case 40 : return 12; // Detonator
}
return 0;
}