/*
Хотите сделать плагин для вип игроков? Раскомментируйте строки... Как это сделать? Удалите все '*/ /*'
И впишите в addons/sourcemod/translations/vip_modules.phrases.txt следующее:
"Bombplant"
{
"ru" "Выбор взрыва бомбы"
"en" "Selecting a bomb explosion"
}
"Bombdefuse"
{
"ru" "Выбор обезвреживания бомбы"
"en" "Selection of bomb neutralization"
}
И в groups.ini:
"Bombplant" "1" // Включить выбор взрыва бомбы
"Bombdefuse" "1" // Включить выбор обезвреживания бомбы
*/
public Plugin myinfo = {name = "Bomb Defusing Plant | Установка для уничтожения бомбы", author = "Drumanid", version = "1.0", url = "http://vk.com/drumanid"}
#pragma semicolon 1
#pragma newdecls required
#include <sdktools_functions>
char g_sInfoBomb[32];
bool g_bBomb;
/*
#include <vip_core>
static const char g_sF1[] = "Bombplant", g_sF2[] = "Bombdefuse";
*/
public void OnPluginStart()
{
HookEvent("bomb_planted", Bomb_p);
HookEvent("bomb_begindefuse", Bomb_bd);
HookEvent("bomb_exploded", Bomb_ed);
HookEvent("bomb_defused", Bomb_ed);
HookEvent("round_start", RoundStart);
/*
if(VIP_IsVIPLoaded()) VIP_OnVIPLoaded();
*/
}
/*
public void OnPluginEnd()
{
if(CanTestFeatures() && GetFeatureStatus(FeatureType_Native, "VIP_UnregisterFeature") == FeatureStatus_Available)
{
VIP_UnregisterFeature(g_sF1);
VIP_UnregisterFeature(g_sF2);
}
}
public int VIP_OnVIPLoaded()
{
VIP_RegisterFeature(g_sF1, BOOL);
VIP_RegisterFeature(g_sF2, BOOL);
}
*/
public Action Bomb_p(Event event, const char[] name, bool dbc)
{
int iClient = GetClientOfUserId(event.GetInt("userid"));
if(iClient && !IsFakeClient(iClient) /*&& VIP_IsClientVIP(iClient) && VIP_IsClientFeatureUse(iClient, g_sF1)*/) Bomb_bpMenu(iClient);
}
public Action Bomb_bd(Event event, const char[] name, bool dbc)
{
int iClient = GetClientOfUserId(event.GetInt("userid"));
if(iClient && !IsFakeClient(iClient) && g_sInfoBomb[0] /*&& VIP_IsClientVIP(iClient) && VIP_IsClientFeatureUse(iClient, g_sF2)*/) Bomb_bdMenu(iClient);
}
public Action Bomb_ed(Event event, const char[] name, bool dbc)
{
g_bBomb = true;
}
public Action RoundStart(Event event, const char[] name, bool dbc)
{
g_bBomb = false;
g_sInfoBomb[0] = 0;
}
void Bomb_bpMenu(int iClient)
{
Menu hMenu = new Menu(Bomb_bpMenuOptions);
hMenu.ExitButton = true;
hMenu.SetTitle("Какой провод выбрали?\n ");
hMenu.AddItem("\x02красный", "Красный");
hMenu.AddItem("\x0Cсиний", "Синий");
hMenu.AddItem("\x08серый", "Серый");
hMenu.AddItem("\x04зеленый", "Зеленый");
hMenu.Display(iClient, 5);
}
public int Bomb_bpMenuOptions(Menu hMenu, MenuAction action, int iClient, int iOption)
{
switch(action)
{
case MenuAction_End: delete hMenu;
case MenuAction_Select:
{
hMenu.GetItem(iOption, g_sInfoBomb, sizeof(g_sInfoBomb));
PrintToChat(iClient, " Вы выбрали %s\x01 провод!", g_sInfoBomb);
}
}
}
void Bomb_bdMenu(int iClient)
{
Menu hMenu = new Menu(Bomb_bdMenuOptions);
hMenu.ExitButton = false;
hMenu.SetTitle("Выберите провод чтобы раздефузить бомбу быстрее...\nЕсли вы сделаете ошибку то произойдет взрыв!\nНичего не выбирайте если не хотите делать выбор.\n ");
hMenu.AddItem("\x02красный", "Красный");
hMenu.AddItem("\x0Cсиний", "Синий");
hMenu.AddItem("\x08серый", "Серый");
hMenu.AddItem("\x04зеленый", "Зеленый");
hMenu.Display(iClient, 5);
}
public int Bomb_bdMenuOptions(Menu hMenu, MenuAction action, int iClient, int iOption)
{
switch(action)
{
case MenuAction_End: delete hMenu;
case MenuAction_Select:
{
if(!IsPlayerAlive(iClient))
{
PrintToChat(iClient, " \x07Вы не можете выбрать провод, т.к вы мертвы!");
return;
}
if(g_bBomb)
{
PrintToChat(iClient, " \x07Бомба уже раздефузена или же взорвана!");
return;
}
int bomb = FindEntityByClassname(-1, "planted_c4");
if(bomb > 0)
{
char sBuffer[32];
hMenu.GetItem(iOption, sBuffer, sizeof(sBuffer));
if(StrContains(sBuffer, g_sInfoBomb, false) != -1)
{
SetEntPropFloat(bomb, Prop_Send, "m_flDefuseCountDown", 0.1);
PrintToChatAll(" \x04%N\x01 выбрал(а) %s\x01 провод. Раздефузил(а) бомбу!", iClient, sBuffer);
}
else
{
SetEntPropFloat(bomb, Prop_Send, "m_flC4Blow", 0.1);
PrintToChatAll(" \x04%N\x01 выбрал(а) %s\x01 провод. Бомба взорвалась!", iClient, sBuffer);
PrintToChatAll(" Правильный провод был: %s", g_sInfoBomb);
}
}
}
}
}