Advertisement
Guest User

Untitled

a guest
Sep 20th, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.95 KB | None | 0 0
  1. else if(strcmp(cmd, "/dropgun", true) == 0 || strcmp(cmd, "/dgun", true) == 0) {
  2. if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return SendClientMessage(playerid, COLOR_ERROR, "Ошибка! Нельзя выбросить оружие находясь в машине!");
  3. if(PlayerInfo[playerid][pDuty] != 0) return SendClientMessage(playerid, COLOR_ERROR, "Ошибка! Запрещено использовать во время дежурства!");
  4. if(PlayerInfo[playerid][pIsDead] == 1) return SendClientMessage(playerid, COLOR_ERROR, "Ошибка! Запрещено использовать во время смерти!");
  5. if(PlayerInfo[playerid][pConnectTime] < 5) return SendClientMessage(playerid, COLOR_ERROR, "Ошибка! Запрещено использовать когда наиграно менее 5 часов!");
  6. if(PlayerInfo[playerid][pGunLic] != 0) return SendClientMessage(playerid, COLOR_ERROR, "Ошибка! Запрещено использовать когда есть лицензия на оружие!");
  7. new weapon_id = GetPlayerWeapon(playerid);
  8. new weapon_ammo = GetPlayerAmmo(playerid);
  9. if(weapon_id == 0 || weapon_ammo == 0) return SendClientMessage(playerid, COLOR_ERROR, "Ошибка! Это оружие нельзя выбросить!");
  10. if(!CheckPlayerWeapon(playerid, GetWeaponSlot(weapon_id))) {
  11. new weapon_name[64];
  12. GetWeaponName(weapon_id, weapon_name, sizeof(weapon_name));
  13. format(string, sizeof(string), "Внимание! Игрок %s[%d] попытался выбросить нелегальное оружие %s[id%d] %d пт!", PlayerName(playerid), playerid, weapon_name, weapon_id, weapon_ammo);
  14. SendAdminMessage(COLOR_YELLOW, string);
  15. SendClientMessage(playerid, COLOR_ERROR, "Ошибка! Это оружие нельзя выбросить, обратитесь к администрации!");
  16. return true;
  17. }
  18. new object_id = MAX_DROPED_ITEMS + 1;
  19. for(new id; id < MAX_DROPED_ITEMS; id++) {
  20. if(ItemInfo[id][status] == 0) {
  21. object_id = id;
  22. break;
  23. }
  24. }
  25. if(object_id > MAX_DROPED_ITEMS) return SendClientMessage(playerid, COLOR_ERROR, "Ошибка! Не удалось выбросить оружие, попробуйте позднее!");
  26. new weapon_name[64];
  27. GetWeaponName(weapon_id, weapon_name, sizeof(weapon_name));
  28. format(string, sizeof(string), "Вы выбросили оружие %s с %d патронами на землю.", weapon_name, weapon_ammo);
  29. SendClientMessage(playerid, COLOR_INFO, string);
  30. format(string, sizeof(string), "Внимание: %s[%d] выбросил на землю оружие %s[id%d] %d пт!", PlayerName(playerid), playerid, weapon_name, weapon_id, weapon_ammo);
  31. SendAdminMessage(COLOR_YELLOW, string);
  32. RemovePlayerWeaponLegal(playerid, weapon_id);
  33. ItemInfo[object_id][item_id] = weapon_id;
  34. ItemInfo[object_id][status] = 1;
  35. ItemInfo[object_id][quantity] = weapon_ammo;
  36. GetPlayerPos(playerid, ItemInfo[object_id][pos_x], ItemInfo[object_id][pos_y], ItemInfo[object_id][pos_z]);
  37. ItemInfo[object_id][pos_rx] = 90.0;
  38. ItemInfo[object_id][pos_ry] = 120.0;
  39. GetPlayerFacingAngle(playerid, ItemInfo[object_id][pos_rz]);
  40. ItemInfo[object_id][pos_rz] += random(360);
  41. ItemInfo[object_id][pos_int] = GetPlayerInterior(playerid);
  42. ItemInfo[object_id][pos_vw] = GetPlayerVirtualWorld(playerid);
  43. ItemInfo[object_id][object] = CreateDynamicObject(GunObjects[weapon_id][0],
  44. ItemInfo[object_id][pos_x], ItemInfo[object_id][pos_y], ItemInfo[object_id][pos_z]-1,
  45. ItemInfo[object_id][pos_rx], ItemInfo[object_id][pos_ry], ItemInfo[object_id][pos_rz],
  46. ItemInfo[object_id][pos_vw], ItemInfo[object_id][pos_int]);
  47. return true;
  48. }
  49. // ================================= Pickup Gun ================================
  50. else if(strcmp(cmd, "/pickupgun", true) == 0 || strcmp(cmd, "/pgun", true) == 0) {
  51. if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return SendClientMessage(playerid, COLOR_ERROR, "Ошибка! Нельзя поднять оружие находясь в машине!");
  52. if(PlayerInfo[playerid][pDuty] != 0) return SendClientMessage(playerid, COLOR_ERROR, "Ошибка! Запрещено использовать во время дежурства!");
  53. if(PlayerInfo[playerid][pIsDead] == 1) return SendClientMessage(playerid, COLOR_ERROR, "Ошибка! Запрещено использовать во время смерти!");
  54. if(PlayerInfo[playerid][pConnectTime] < 5) return SendClientMessage(playerid, COLOR_ERROR, "Ошибка! Запрещено использовать когда наиграно менее 5 часов!");
  55. new object_id = MAX_DROPED_ITEMS + 1;
  56. for(new id; id < MAX_DROPED_ITEMS; id++) {
  57. if(IsPlayerInRangeOfPoint(playerid, 1.0, ItemInfo[id][pos_x], ItemInfo[id][pos_y], ItemInfo[id][pos_z])) {
  58. object_id = id;
  59. break;
  60. }
  61. }
  62. if(object_id > MAX_DROPED_ITEMS || ItemInfo[object_id][status] != 1) return SendClientMessage(playerid, COLOR_ERROR, "Ошибка! Рядом с вами нету оружия которое можно поднять!");
  63. ItemInfo[object_id][status] = 0; ItemInfo[object_id][pos_x] = 0; ItemInfo[object_id][pos_y] = 0; ItemInfo[object_id][pos_z] = 0;
  64. DestroyDynamicObject(ItemInfo[object_id][object]);
  65. new weapon_name[64];
  66. GetWeaponName(ItemInfo[object_id][item_id], weapon_name, sizeof(weapon_name));
  67. format(string, sizeof(string), "Вы подняли оружие %s с %d патронами с землю.", weapon_name, ItemInfo[object_id][quantity]);
  68. SendClientMessage(playerid, COLOR_INFO, string);
  69. format(string, sizeof(string), "Внимание: %s[%d] подобрал с земли оружие %s[id%d] %d пт!", PlayerName(playerid), playerid, weapon_name, ItemInfo[object_id][item_id], ItemInfo[object_id][quantity]);
  70. SendAdminMessage(COLOR_YELLOW, string);
  71. GivePlayerWeaponLegal(playerid, ItemInfo[object_id][item_id], ItemInfo[object_id][quantity]);
  72. return true;
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement