// Include Made by BarD // Special for http://world-source.ru #if defined weapon_functions #endinput #endif #define weapon_functions //Массивчики new String:WeaponPrimary[][] = {"weapon_m3", "weapon_xm1014", "weapon_m4a1", "weapon_mac10", "weapon_tmp", "weapon_mp5havy", "weapon_p90", "weapon_galil", "weapon_famas", "weapon_ak47", "weapon_aug", "weapon_sg552", "weapon_awp", "weapon_sg550", "weapon_m249", "weapon_g3sg1", "weapon_ump45" }; new String:WeaponSecondary[][] ={"weapon_glock", "weapon_usp", "weapon_p228", "weapon_deagle", "weapon_elite", "weapon_fiveseven"}; new String:WeaponGrenade[][] ={"weapon_hegrenade", "weapon_flashbang", "weapon_smokegrenade"}; /* *** *** Выдает указанное оружие с указанным количеством патронов игроку с индексом client *** *** client - индекс игрока *** item - Строка с названием оружия (Пример: "weapon_deagle" - дигл) *** clip - количество патронов в обойме у выданного оружия *** reserve - Количество запасных патронов в выданном оружии *** *** Возвращает index выданного оружия, в случае успеха, или -1, в случае неудачи. *** */ stock GivePlayerItemEx(client, const String:item[], clip, reserve) { if (IsClientInGame(client) && client && IsPlayerAlive(client)) { if (StrEqual(item, "weapon_knife")) return -1; else if (StrEqual(item, "item_defuser")) return -1; else if (StrEqual(item, "item_assaultsuit")) return -1; else if (StrEqual(item, "weapon_c4")) return -1; else if (StrEqual(item, "weapon_hegrenade")) return -1; else if (StrEqual(item, "weapon_flashbang")) return -1; else if (StrEqual(item, "weapon_smokegrenade")) return -1; else if (StrEqual(item, "item_nvgs")) return -1; else { new index = GivePlayerItem(client, item); if (index > 0 && index > MaxClients) { new m_iPrimaryAmmoType = -1; if ((m_iPrimaryAmmoType = GetEntProp(index, Prop_Send, "m_iPrimaryAmmoType")) != -1) { SetEntProp(index, Prop_Send, "m_iClip1", clip); SetEntProp(client, Prop_Send, "m_iAmmo", reserve, _, m_iPrimaryAmmoType); return index; } else return -1; } else return -1; } } else return -1; } /* *** *** Выдает случайное оружие игроку с индексом client *** *** client - индекс игрока *** slot - номер слота. (1 - Основное оружие, 2 - Пистолеты, 3 - Гранаты, иначе вернет -1) *** *** Возвращает index выданного оружия, в случае успеха, или -1, в случае неудачи. *** */ stock GiveRandomWeapon(client, slot) { if (IsClientInGame(client) && client && IsPlayerAlive(client)) { new index = -1; if (slot == 1) { new primary = GetRandomInt(0, 16); index = GivePlayerItem(client, WeaponPrimary[primary]); } else if (slot == 2) { new secondary = GetRandomInt(0, 5); index = GivePlayerItem(client, WeaponSecondary[secondary]); } else if (slot == 3) { new grenade = GetRandomInt(0, 2); index = GivePlayerItem(client, WeaponGrenade[grenade]); } else return -1; if (index > 0 && index > MaxClients) return index; else return -1; } else return -1; } /* *** *** Выдает случайное оружие с указанным количеством патронов игроку с индексом client *** *** client - индекс игрока *** slot - номер слота. (1 - Основное оружие, 2 - Пистолеты, иначе вернет -1) *** clip - количество патронов в обойме у выданного оружия *** reserve - Количество запасных патронов в выданном оружии *** *** Возвращает index выданного оружия, в случае успеха, или -1, в случае неудачи. *** */ stock GiveRandomWeaponEx(client, slot, clip, reserve) { if (IsClientInGame(client) && client && IsPlayerAlive(client)) { new index = -1; if (slot == 1) { new primary = GetRandomInt(0, 16); index = GivePlayerItemEx(client, WeaponPrimary[primary], clip, reserve); } else if (slot == 2) { new secondary = GetRandomInt(0, 5); index = GivePlayerItemEx(client, WeaponSecondary[secondary], clip, reserve); } else return -1; if (index > 0 && index > MaxClients) return index; else return -1; } else return -1; }