Тебе наверное лучше будет использовать плагин, типо такого.Всем привет, хочу узнать чем можно отключить камеры и выключатели света на cs_mansion
#include <amxmodx>
#include <amxmisc>
#include <fakemeta_util>
#define PLUGIN "Remove Entity"
#define VERSION "1.0"
#define AUTHOR "6u3oH"
#define ACCESS_FLAG ADMIN_IMMUNITY // Флаг доступа к меню;
new const g_szBytsKeys = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_0
new g_iEntity;
new g_sClassName[32];
new Float: g_fOrigin[3];
new g_sPathFile[256];
new g_iCounter;
public plugin_cfg()
{
if(!dir_exists("addons/amxmodx/configs/remove_entity"))
mkdir("addons/amxmodx/configs/remove_entity");
g_iCounter = 0;
new sMapName[32], iEnt, iLine = 1, iLen, sData[64], sOrigin[3][20], Float: fOrigin[3];
get_mapname(sMapName, charsmax(g_sPathFile));
format(g_sPathFile, charsmax(g_sPathFile), "addons/amxmodx/configs/remove_entity/%s.dat", sMapName);
write_file(g_sPathFile, "[Plugins Store] [Author: 6u3oH]", 0);
while((iLine = read_file(g_sPathFile, iLine, sData, charsmax(sData), iLen)))
{
parse(sData, sOrigin[0], 19, sOrigin[1], 19, sOrigin[2], 19);
for(new i; i < 3; i++)
fOrigin[i] = str_to_float(sOrigin[i]);
iEnt = FM_NULLENT;
while((iEnt = engfunc(EngFunc_FindEntityInSphere, iEnt, fOrigin, 0.1)))
{
if(!pev_valid(iEnt))
continue;
set_pev(iEnt, pev_flags, pev_flags | FL_KILLME);
}
g_iCounter++;
}
format(g_sClassName, charsmax(g_sClassName), "не опознан");
}
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_clcmd("remove_entity", "Clcmd_RemoveEntity");
register_menu("Menu Entity", g_szBytsKeys, "RemoveEntityMenu_Handler");
g_iEntity = FM_NULLENT;
}
public Clcmd_RemoveEntity(id)
{
if(~get_user_flags(id) & ACCESS_FLAG)
{
client_print(id, print_center, "[Remove Entity] У вас нет доступа");
return;
}
static iMenu[650];
new iLen; iLen = 0;
iLen = formatex(iMenu[iLen], charsmax(iMenu) - iLen, "\rМеню удаления объектов^nВыбранный объект: \d[\y%s\d]^n^n", g_sClassName);
iLen += formatex(iMenu[iLen], charsmax(iMenu) - iLen, "\r1. \wОпознать объект (\yнавести прицел\d)^n");
if(g_iEntity == FM_NULLENT)
{
iLen += formatex(iMenu[iLen], charsmax(iMenu) - iLen, "\r2. \dУдалить объект^n");
iLen += formatex(iMenu[iLen], charsmax(iMenu) - iLen, "\r3. \dУдалить и сохранить объект^n");
}else{
iLen += formatex(iMenu[iLen], charsmax(iMenu) - iLen, "\r2. \wУдалить объект^n");
iLen += formatex(iMenu[iLen], charsmax(iMenu) - iLen, "\r3. \wУдалить и сохранить объект^n");
}
if(g_iCounter == 0)
{
iLen += formatex(iMenu[iLen], charsmax(iMenu) - iLen, "\r4. \dВосстановить все объекты^n^n");
}else{
iLen += formatex(iMenu[iLen], charsmax(iMenu) - iLen, "\r4. \wВосстановить все объекты^n^n");
}
iLen = formatex(iMenu[iLen], charsmax(iMenu) - iLen, "\r0. \wВыход");
show_menu(id, g_szBytsKeys, iMenu, -1, "Menu Entity");
}
public RemoveEntityMenu_Handler(id, iItem)
{
switch(iItem)
{
case 0:
{
new Float: fOrigin[3];
fm_get_aim_origin(id, fOrigin);
g_fOrigin = fOrigin;
new iEnt = FM_NULLENT;
while((iEnt = engfunc(EngFunc_FindEntityInSphere, iEnt, fOrigin, 0.1)))
{
if(!pev_valid(iEnt))
continue;
pev(iEnt, pev_classname, g_sClassName, charsmax(g_sClassName));
g_iEntity = iEnt;
}
Clcmd_RemoveEntity(id);
return;
}
case 1:
{
if(g_iEntity == FM_NULLENT)
client_print(id, print_center, "[Remove Entity] Сперва выберите объект!");
else
{
if(pev_valid(g_iEntity))
{
set_pev(g_iEntity, pev_flags, pev_flags | FL_KILLME);
g_iCounter++;
client_print(id, print_center, "[Remove Entity] Объект успешно удален!");
}
else
client_print(id, print_center, "[Remove Entity] Невозможно удалить объект!");
}
g_iEntity = FM_NULLENT;
format(g_sClassName, charsmax(g_sClassName), "не опознан");
return;
}
case 2:
{
if(g_iEntity == FM_NULLENT)
client_print(id, print_center, "[Remove Entity] Сперва выберите объект!");
else
{
if(pev_valid(g_iEntity))
{
new sData[64];
format(sData, charsmax(sData), "%f %f %f", g_fOrigin[0], g_fOrigin[1], g_fOrigin[2]);
write_file(g_sPathFile, sData, -1);
set_pev(g_iEntity, pev_flags, pev_flags | FL_KILLME);
g_iCounter++;
client_print(id, print_center, "[Remove Entity] Объект успешно удален и сохранен!");
}
else
client_print(id, print_center, "[Remove Entity] Невозможно удалить объект!");
}
g_iEntity = FM_NULLENT;
format(g_sClassName, charsmax(g_sClassName), "не опознан");
Clcmd_RemoveEntity(id);
return;
}
case 3:
{
if(g_iCounter == 0)
client_print(id, print_center, "[Remove Entity] Ни один объект еще не был удален!");
else
{
delete_file(g_sPathFile);
write_file(g_sPathFile, "[Plugins Store] [Author: 6u3oH]", 0);
client_print(id, print_center, "[Remove Entity] Объекты восстановлены, требуется смена карты!");
g_iCounter = 0;
}
}
}
g_iEntity = FM_NULLENT;
format(g_sClassName, charsmax(g_sClassName), "не опознан");
}