Версия: 1.0
Описание: В любое момент игрок с флагом доступа admin_menu, может отобрать у всех оружие и снаряжения
Бой будет продолжаться до конца раунда
Покупка оружия и снаряжения отключена
Подбор оружия отключен
Если бой запущен, повторно запуск ограничен
По окончанию раунда, выдаются пистолеты соответствующие команде игрока
- Код: Выделить всё
#include <amxmodx>
#include <cstrike>
#include <engine>
#include <fun>
#include <hamsandwich>
#define PLUGIN "round KNIFE"
#define VERSION "1.0"
#define AUTOR "[N][E][M][E][C]"
const FLAGS = ADMIN_MENU //флаг доступа к запуску боя на ножах
new const comand[][] = {
"buy", "usp", "glock", "deagle", "p228", "elites", "fn57", "m3", "xm1014", "mp5", "tmp", "p90", "mac10", "ump45", "ak47",
"galil", "famas", "sg552", "m4a1", "aug", "scout", "awp", "g3sg1", "sg550", "m249", "vest", "vesthelm", "flash", "hegren",
"sgren", "defuser", "nvgs", "shield", "primammo", "secammo", "km45", "9x19mm", "nighthawk", "228compact", "12gauge",
"autoshotgun", "smg", "mp", "c90", "cv47", "defender", "clarion", "krieg552", "bullpup", "magnum", "d3au1", "krieg550",
"buyammo1", "buyammo2", "buyequip"
}
new bool:g_roundKNIFE;
new g_MAXPLAYER, i;
new teamPLAYER[2];
public plugin_init(){
register_plugin(PLUGIN, VERSION, AUTOR);
register_clcmd("amx_knife", "knifeFUNCTION");
register_event("HLTV", "startRound", "a", "1=0", "2=0");
for(i = 0; i < sizeof comand; ++ i)
register_clcmd(comand[i], "BlockBuyCmd");
RegisterHam(Ham_Spawn, "player", "SpawnPlayer", 1);
register_touch("armoury_entity", "player", "fw_Touch");
register_touch("weaponbox", "player", "fw_Touch");
g_MAXPLAYER = get_maxplayers() + 1;
}
public startRound() {
if(!g_roundKNIFE)
return;
new idPLAYER;
for(idPLAYER = 1; idPLAYER < g_MAXPLAYER; ++ idPLAYER) {
if(is_user_connected(idPLAYER) && !is_user_hltv(idPLAYER)) {
g_roundKNIFE = false;
client_print(idPLAYER, print_center, "Активирована покупка |оружия| и |снаряжения|");
get_user_team(idPLAYER, teamPLAYER, charsmax(teamPLAYER));
if(equal(teamPLAYER, "T", 1)) {
give_item(idPLAYER, "weapon_glock18");
cs_set_user_bpammo(idPLAYER, CSW_GLOCK18, 40);
}
else {
give_item(idPLAYER,"weapon_usp");
cs_set_user_bpammo(idPLAYER, CSW_USP, 24);
}
}
}
}
public knifeFUNCTION(id) {
if(!(get_user_flags(id) & FLAGS)) {
ChatColor(id, "^1[ ^4SErVER ^1] ^3У вас недостаточно прав, на запуск раунда на ножах");
return PLUGIN_HANDLED;
}
if(g_roundKNIFE) {
ChatColor(id, "^1[ ^4SErVER ^1] ^3Бой на ножах, уже запущен");
return PLUGIN_HANDLED;
}
else
set_task(0.1, "taskFUNCTION", id);
return PLUGIN_CONTINUE;
}
public taskFUNCTION() {
new idPLAYER;
for(idPLAYER = 1; idPLAYER < g_MAXPLAYER; ++ idPLAYER){
if(is_user_connected(idPLAYER)){
strip_user_weapons(idPLAYER);
give_item (idPLAYER, "weapon_knife");
client_print(idPLAYER, print_center, "Активирована игра на ножах");
g_roundKNIFE = true;
}
}
}
public SpawnPlayer(id) {
if(!is_user_alive(id) || !g_roundKNIFE || is_user_hltv(idPLAYER)
return;
strip_user_weapons(id);
give_item(id, "weapon_knife");
client_print(id, print_center, "Активирована игра на ножах");
}
public BlockBuyCmd(id) {
if(!is_user_alive(id) || g_roundKNIFE) {
client_print(id, print_center, "На данный момент, вы не можете покупать |оружие| и |снаряжение|");
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
public fw_Touch(ent, id) {
if(!is_valid_ent(ent) || g_roundKNIFE) {
client_print(id, print_center, "На данный момент, вы не можете поднять |оружие|");
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
stock ChatColor(const id,const input[],any:...) {
new count = 1, players[32];
static msg[191];
vformat(msg, 190, input, 3);
replace_all(msg,190,"!g", "^4");
replace_all(msg,190,"!y", "^1");
replace_all(msg,190,"!t", "^3");
if(id)players[0] = id; else get_players(players,count,"ch"); {
for(new i = 0;i < count;i++) {
if(is_user_connected(players[i])) {
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}