Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- else if(strcmp(cmd, "/dropgun", true) == 0 || strcmp(cmd, "/dgun", true) == 0) {
- if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return SendClientMessage(playerid, COLOR_ERROR, "Ошибка! Нельзя выбросить оружие находясь в машине!");
- if(PlayerInfo[playerid][pDuty] != 0) return SendClientMessage(playerid, COLOR_ERROR, "Ошибка! Запрещено использовать во время дежурства!");
- if(PlayerInfo[playerid][pIsDead] == 1) return SendClientMessage(playerid, COLOR_ERROR, "Ошибка! Запрещено использовать во время смерти!");
- if(PlayerInfo[playerid][pConnectTime] < 5) return SendClientMessage(playerid, COLOR_ERROR, "Ошибка! Запрещено использовать когда наиграно менее 5 часов!");
- if(PlayerInfo[playerid][pGunLic] != 0) return SendClientMessage(playerid, COLOR_ERROR, "Ошибка! Запрещено использовать когда есть лицензия на оружие!");
- new weapon_id = GetPlayerWeapon(playerid);
- new weapon_ammo = GetPlayerAmmo(playerid);
- if(weapon_id == 0 || weapon_ammo == 0) return SendClientMessage(playerid, COLOR_ERROR, "Ошибка! Это оружие нельзя выбросить!");
- if(!CheckPlayerWeapon(playerid, GetWeaponSlot(weapon_id))) {
- new weapon_name[64];
- GetWeaponName(weapon_id, weapon_name, sizeof(weapon_name));
- format(string, sizeof(string), "Внимание! Игрок %s[%d] попытался выбросить нелегальное оружие %s[id%d] %d пт!", PlayerName(playerid), playerid, weapon_name, weapon_id, weapon_ammo);
- SendAdminMessage(COLOR_YELLOW, string);
- SendClientMessage(playerid, COLOR_ERROR, "Ошибка! Это оружие нельзя выбросить, обратитесь к администрации!");
- return true;
- }
- new object_id = MAX_DROPED_ITEMS + 1;
- for(new id; id < MAX_DROPED_ITEMS; id++) {
- if(ItemInfo[id][status] == 0) {
- object_id = id;
- break;
- }
- }
- if(object_id > MAX_DROPED_ITEMS) return SendClientMessage(playerid, COLOR_ERROR, "Ошибка! Не удалось выбросить оружие, попробуйте позднее!");
- new weapon_name[64];
- GetWeaponName(weapon_id, weapon_name, sizeof(weapon_name));
- format(string, sizeof(string), "Вы выбросили оружие %s с %d патронами на землю.", weapon_name, weapon_ammo);
- SendClientMessage(playerid, COLOR_INFO, string);
- format(string, sizeof(string), "Внимание: %s[%d] выбросил на землю оружие %s[id%d] %d пт!", PlayerName(playerid), playerid, weapon_name, weapon_id, weapon_ammo);
- SendAdminMessage(COLOR_YELLOW, string);
- RemovePlayerWeaponLegal(playerid, weapon_id);
- ItemInfo[object_id][item_id] = weapon_id;
- ItemInfo[object_id][status] = 1;
- ItemInfo[object_id][quantity] = weapon_ammo;
- GetPlayerPos(playerid, ItemInfo[object_id][pos_x], ItemInfo[object_id][pos_y], ItemInfo[object_id][pos_z]);
- ItemInfo[object_id][pos_rx] = 90.0;
- ItemInfo[object_id][pos_ry] = 120.0;
- GetPlayerFacingAngle(playerid, ItemInfo[object_id][pos_rz]);
- ItemInfo[object_id][pos_rz] += random(360);
- ItemInfo[object_id][pos_int] = GetPlayerInterior(playerid);
- ItemInfo[object_id][pos_vw] = GetPlayerVirtualWorld(playerid);
- ItemInfo[object_id][object] = CreateDynamicObject(GunObjects[weapon_id][0],
- ItemInfo[object_id][pos_x], ItemInfo[object_id][pos_y], ItemInfo[object_id][pos_z]-1,
- ItemInfo[object_id][pos_rx], ItemInfo[object_id][pos_ry], ItemInfo[object_id][pos_rz],
- ItemInfo[object_id][pos_vw], ItemInfo[object_id][pos_int]);
- return true;
- }
- // ================================= Pickup Gun ================================
- else if(strcmp(cmd, "/pickupgun", true) == 0 || strcmp(cmd, "/pgun", true) == 0) {
- if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return SendClientMessage(playerid, COLOR_ERROR, "Ошибка! Нельзя поднять оружие находясь в машине!");
- if(PlayerInfo[playerid][pDuty] != 0) return SendClientMessage(playerid, COLOR_ERROR, "Ошибка! Запрещено использовать во время дежурства!");
- if(PlayerInfo[playerid][pIsDead] == 1) return SendClientMessage(playerid, COLOR_ERROR, "Ошибка! Запрещено использовать во время смерти!");
- if(PlayerInfo[playerid][pConnectTime] < 5) return SendClientMessage(playerid, COLOR_ERROR, "Ошибка! Запрещено использовать когда наиграно менее 5 часов!");
- new object_id = MAX_DROPED_ITEMS + 1;
- for(new id; id < MAX_DROPED_ITEMS; id++) {
- if(IsPlayerInRangeOfPoint(playerid, 1.0, ItemInfo[id][pos_x], ItemInfo[id][pos_y], ItemInfo[id][pos_z])) {
- object_id = id;
- break;
- }
- }
- if(object_id > MAX_DROPED_ITEMS || ItemInfo[object_id][status] != 1) return SendClientMessage(playerid, COLOR_ERROR, "Ошибка! Рядом с вами нету оружия которое можно поднять!");
- ItemInfo[object_id][status] = 0; ItemInfo[object_id][pos_x] = 0; ItemInfo[object_id][pos_y] = 0; ItemInfo[object_id][pos_z] = 0;
- DestroyDynamicObject(ItemInfo[object_id][object]);
- new weapon_name[64];
- GetWeaponName(ItemInfo[object_id][item_id], weapon_name, sizeof(weapon_name));
- format(string, sizeof(string), "Вы подняли оружие %s с %d патронами с землю.", weapon_name, ItemInfo[object_id][quantity]);
- SendClientMessage(playerid, COLOR_INFO, string);
- format(string, sizeof(string), "Внимание: %s[%d] подобрал с земли оружие %s[id%d] %d пт!", PlayerName(playerid), playerid, weapon_name, ItemInfo[object_id][item_id], ItemInfo[object_id][quantity]);
- SendAdminMessage(COLOR_YELLOW, string);
- GivePlayerWeaponLegal(playerid, ItemInfo[object_id][item_id], ItemInfo[object_id][quantity]);
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement