11.07.2016, 14:55
Hi, I've made some changes to the /givewep in my script, but it doesn't seem to work properly now. It compiles all good, I can give all weapons except "heavy weapons" (shotgun, mp5, ak, etc). When I try to give them to myself, it does nothing. Here are the codes:
Stocks:
Part of givewep that is not working:
Stocks:
Код:
stock IsAHeavyWeapon(weaponid) { switch (weaponid) { case 25, 27, 29, 30, 31, 33, 34: return 1; } return 0; } stock PlayerHasHeavyWeapon(playerid) { if (PlayerHasWeapon(playerid, 25) || PlayerHasWeapon(playerid, 27) || PlayerHasWeapon(playerid, 29) || PlayerHasWeapon(playerid, 30) || PlayerHasWeapon(playerid, 31) || PlayerHasWeapon(playerid, 33) || PlayerHasWeapon(playerid, 34)) return 1; return 0; }
Код:
if (IsAHeavyWeapon(weaponid)) { if (PlayerHasHeavyWeapon(userid)) { if (PlayerHasWeapon(userid, weaponid)) { GiveWeaponToPlayer(userid, weaponid, ammo); SendServerMessage(playerid, "You have gave %s a %s with %d ammo.", ReturnName(userid, 0), ReturnWeaponName(weaponid), ammo); } else SendErrorMessage(playerid, "The specified player has already a heavy weapon."); } } else { GiveWeaponToPlayer(userid, weaponid, ammo); SendServerMessage(playerid, "You have gave %s a %s with %d ammo.", ReturnName(userid, 0), ReturnWeaponName(weaponid), ammo); }