02.01.2015, 18:17
(
Последний раз редактировалось Lordzy; 03.01.2015 в 04:59.
)
1) GetWeaponSlot
This function returns the slot ID of the weapon. If it's an invalid weapon ID, then it will return -1 value.
Code:
Use:
2) RemoveWeapons
This function allows you to remove multiple weapons at a time.
Code:
Use:
This function returns the slot ID of the weapon. If it's an invalid weapon ID, then it will return -1 value.
Code:
pawn Код:
new
g_WeaponSlots[47] =
{
0, //Fist,
0, //Brass,
1, //Golf,
1, //Night,
1, //Knife,
1, //Baseball bat,
1, //Shovel,
1, //Pool,
1, //Katana,
1, //Chainsaw,
10, //P Dildo,
10, //Dildo,
10, //Vibrator,
10, //Silver Vib,
10, //Flowers,
10, //Cane,
8, //Grenade,
8, //Tear gas
8, //Moltov,
-1, //Invalid,
-1, //Invalid,
-1, //Invalid,
2, //Colt,
2, //Silenced,
2, //Deagle,
3, //Shotgun,
3, //Sawnoff
3, //Spas
4, //Uzi,
4, //Mp5,
5, //AK47,
5, //M4,
4, //Tec9,
6, //Rifle,
6, //Sniper,
7, //Rocket launcher,
7, //Heat seeker,
7, //Flame thrower,
7, //Minigun,
8, //Satchel,
12, //Detonator,
9, //Spray can,
9, //Extinguisher,
9, //Camera
11, //Night vision,
11, //Thermal vision,
11}; //Parachute
stock GetWeaponSlot(weaponid)
{
if(weaponid >= 0 && weaponid <= 46)
return g_WeaponSlots[weaponid];
else return -1;
}
pawn Код:
printf("Desert Eagle's weapon slot : %d", GetWeaponSlot(24));
printf("Sawnoff's weapon slot : %d", GetWeaponSlot(26));
2) RemoveWeapons
This function allows you to remove multiple weapons at a time.
Code:
pawn Код:
stock RemoveWeapons(playerid, ...)
{
for(new i = 1, j = numargs(); i< j; i++)
{
SetPlayerAmmo(playerid, getarg(i), 0);
}
return 1;
}
pawn Код:
RemoveWeapons(playerid, 38, 24, 26);
//Weapons such as Minigun(38), Desert Eagle(24) and Sawnoff(26) will be removed from player's inventory.