Невидимые энтити в Walls Creator

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
16
Реакции
4
Ошибка
Ошибка заключается в том, что когда включаю плагин Walls Creator в какой-либо карте он работает нормально, и при смене на другой он выключается, и в некоторых картах появляются невидимые стены в рандомных местах(а при перезагрузке сервера они пропадают)
ОС
Linux
Amx Mod X
AMX Mod X 1.9.0.5263 (http://www.amxmodx.org)
Authors:
David "BAILOPAN" Anderson, Pavol "PM OnoTo" Marko
Felix "SniperBeamer" Geyer, Jonny "Got His Gun" Bergstrom
Lukasz "SidLuke" Wlasinski, Christian "Basic-Master" Hammacher
Borja "faluco" Ferrer, Scott "DS" Ehlert
Compiled: Oct 27 2019 16:23:31
Built from: https://github.com/alliedmodders/amxmodx/commit/15a14a0
Build ID: 5263:15a14a0
Core mode: JIT+ASM32
Билд
ReHLDS version: 3.7.0.697-dev
Build date: 20:42:34 Jul 24 2020 (2295)
Build from: https://github.com/dreamstalker/rehlds/commit/98db467
ReGamedll
ReGameDLL version: 5.18.0.474-dev
Build date: 11:07:34 Jul 16 2020
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/efb06a7
Версия Metamod
Metamod-r v1.3.0.128, API (5:13)
Metamod-r build: 17:47:54 Aug 24 2018
Metamod-r from: https://github.com/theAsmodai/metamod-r/commit/0cf2f70
Список метамодулей
[ 1] AMX Mod X             RUN   -    amxmodx_mm_i386.so        v1.9.0.5263      ini  Start ANY
[ 2] Reunion RUN - reunion_mm_i386.so v0.1.0.92c ini Start Never
[ 3] Ultimate Unprecacher RUN - unprecacher_i386.so vBeta 2.5.3 ini Chlvl Chlvl
[ 4] ReSemiclip RUN - resemiclip_mm_i386.so v2.3.9 ini Chlvl ANY
[ 5] VoiceTranscoder RUN - VoiceTranscoder.so v2017RC5 ini ANY ANY
[ 6] SQLite RUN - sqlite_amxx_i386.so v1.9.0.5263 pl1 ANY ANY
[ 7] Fun RUN - fun_amxx_i386.so v1.9.0.5263 pl1 ANY ANY
[ 8] Engine RUN - engine_amxx_i386.so v1.9.0.5263 pl1 ANY ANY
[ 9] FakeMeta RUN - fakemeta_amxx_i386.so v1.9.0.5263 pl1 ANY ANY
[10] GeoIP RUN - geoip_amxx_i386.so v1.9.0.5271 pl1 ANY ANY
[11] CStrike RUN - cstrike_amxx_i386.so v1.9.0.5263 pl1 ANY ANY
[12] CSX RUN - csx_amxx_i386.so v1.9.0.5263 pl1 ANY ANY
[13] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.9.0.5263 pl1 ANY ANY
[14] ReAPI RUN - reapi_amxx_i386.so v5.16.0.198-dev pl1 ANY Never
[15] gRIP RUN - grip_amxx_i386.so v0.1.5 Beta pl1 ANY ANY
Список плагинов
dsp_polymorph.amxx debug
dsp_poly_rtv_new.amxx
dsp_gamename.amxx
dsp_anticheat_kz.amxx
dsp_fresh_bans.amxx
dsp_ca_core.amxx
dsp_ca_gag.amxx
dsp_ca_mute.amxx
dsp_proxy_check.amxx
dsp_admin.amxx
dsp_admin_menu.amxx
dsp_adminvote.amxx ; команды голосования
dsp_admincmd.amxx ; консольные команды админа
dsp_adminslots.amxx ; резервируемые слоты
dsp_adminchat.amxx
dsp_cmdmenu.amxx
dsp_telemenu.amxx ; телепорт меню
dsp_plmenu_fix.amxx ; меню игроков
dsp_timeleft.amxx ; показывает оставшееся время игры на карте
dsp_nextmap.amxx
dsp_multilingual.amxx
dsp_lang_menu.amxx
dsp_revive.amxx
dsp_sky_change.amxx
dsp_unlimited_teams.amxx
dsp_loading_sound.amxx
dsp_center_msg_fix.amxx
dsp_paint_marker.amxx
dsp_paint_marker_access.amxx
dsp_plugins_editor.amxx
dsp_surf_fix.amxx
dsp_voteban.amxx
dsp_motd_site.amxx
dsp_client_cfg.amxx
dsp_camera.amxx
dsp_demo.amxx
dsp_bank.amxx
dsp_registration_system.amxx
dsp_costumes_all.amxx
dsp_cs_player_models_api.amxx
dsp_miscstats.amxx
dsp_ad_manager.amxx
dsp_player_models_all.amxx
dsp_ranksystem.amxx
dsp_knife_skinsystem.amxx
dsp_crx_chatmanager.amxx
dsp_crx_chatmanager_tg.amxx
dsp_menu_classic.amxx
dsp_menu_cl_other_all.amxx
dsp_prokreedz.amxx
dsp_PK_Grab_v2.4.amxx
dsp_PK_Hook_v2.4.amxx
dsp_PK_Jetpack_v2.4.amxx
dsp_spawns_fixer.amxx
dsp_KZMenu.amxx
dsp_KZInvis.amxx
dsp_uq_jumpstats.amxx
dsp_uq_jumpstats_tops.amxx
dsp_mpbhop.amxx
dsp_showtimeleft.amxx
dsp_mod_restarter_kz.amxx
dsp_module_disactivator.amxx
Автор плагина
d3m37r4
Версия плагина
1.1
Исходный код
/*
Plugin is based on WalkGuard (https://forums.alliedmods.net/showthread.php?t=55245).
Thanks a mogel (https://forums.alliedmods.net/member.php?u=24745) for base (WalkGuard v1.3.2).
*/

#include <amxmodx>
#include <engine>

#if AMXX_VERSION_NUM < 183
#include <colorchat>
#endif

#if !defined client_disconnected
#define client_disconnected client_disconnect
#endif

new const PLUGIN_NAME[] = "Walls Creator";
new const PLUGIN_VERSION[] = "1.1";
new const PLUGIN_AUTHOR[] = "ь";

const ACCESS_FLAG = ADMIN_LEVEL_A; // Флаг доступа к меню создания/редактирования/удаления заграждения

const MAX_WALLS = 64; // Максимальное кол-во заграждений на карте
const TASK_ID_SHOW_WALLS = 1024;

#if !defined NULLENT
const NULLENT = -1;
#endif

new const FOLDER_NAME[] = "walls_data"; // Папка в которой хранятся файлы с настройками для карт
new const FILE_FORMAT[] = "dat"; // Формат файлов

new const ENT_CLASSNAME[] = "dsp_fix_wall_ent";
new const ENT_SET_MODEL[] = "models/gib_skull.mdl"; // valve/models/gib_skull.mdl
new const SPRITE_BEAM[] = "sprites/laserbeam.spr"; // valve/sprites/laserbeam.spr

enum {X, Y, Z};
enum _:TYPE {WALL_DEFAULT, ACTIVE_WALL, RED_WALL, YELLOW_WALL};
enum _:COLOR {R, G, B};

new const g_Coord[3][] = {"X", "Y", "Z"};
new const g_Color[TYPE][COLOR] = {
{255, 255, 255},
{0, 0, 255},
{255, 0, 0},
{255, 255, 0}
};

new Float:g_vecDefMins[3] = {-32.0, -32.0, -32.0};
new Float:g_vecDefMaxs[3] = {32.0, 32.0, 32.0};

new Float:g_WallPos[MAX_WALLS + 1][3];
new Float:g_WallMins[MAX_WALLS + 1][3];
new Float:g_WallMaxs[MAX_WALLS + 1][3];

new g_iEditorID = 0;
new g_iDirection = 0;
new g_iSetupUnits = 10;

new g_iWallsCount, g_iWallsMax, g_iWall_ID;
new g_iWallIndex[MAX_WALLS + 1];
new g_BeamSprite;
new g_MapName[32];

public plugin_precache()
{
precache_model(ENT_SET_MODEL);
g_BeamSprite = precache_model(SPRITE_BEAM);
}

public plugin_cfg()
{
new szFileDir[128];

get_localinfo("amxx_configsdir", szFileDir, charsmax(szFileDir));
get_mapname(g_MapName, charsmax(g_MapName));

formatex(szFileDir, charsmax(szFileDir), "%s/%s/%s.%s", szFileDir,FOLDER_NAME, g_MapName, FILE_FORMAT);

switch(file_exists(szFileDir))
{
case 0:
{
server_print("[%s] Warning: there is no file with location of barriers for map ^"%s^"!", PLUGIN_NAME, g_MapName);
return;
}
case 1:
{
new iFile = fopen(szFileDir, "rt");

if(iFile)
{
new szBuffer[128], szArgIndex[4];
new szArgPosX[8], szArgPosY[8], szArgPosZ[8];
new szArgMinsX[6], szArgMinsY[6], szArgMinsZ[6];
new szArgMaxsX[6], szArgMaxsY[6], szArgMaxsZ[6];

while(!feof(iFile))
{
fgets(iFile, szBuffer, charsmax(szBuffer));
trim(szBuffer);

if(!(szBuffer[0]) || szBuffer[0] == ';' || szBuffer[0] == '#')
continue;

parse(szBuffer, szArgIndex, charsmax(szArgIndex),
szArgPosX, charsmax(szArgPosX), szArgPosY, charsmax(szArgPosY), szArgPosZ, charsmax(szArgPosZ),
szArgMinsX, charsmax(szArgMinsX), szArgMinsY, charsmax(szArgMinsY), szArgMinsZ, charsmax(szArgMinsZ),
szArgMaxsX, charsmax(szArgMaxsX), szArgMaxsY, charsmax(szArgMaxsY), szArgMaxsZ, charsmax(szArgMaxsZ)
);

UTIL_Vec_Set(g_WallPos[g_iWallsCount], str_to_float(szArgPosX), str_to_float(szArgPosY), str_to_float(szArgPosZ));
UTIL_Vec_Set(g_WallMins[g_iWallsCount], str_to_float(szArgMinsX), str_to_float(szArgMinsY), str_to_float(szArgMinsZ));
UTIL_Vec_Set(g_WallMaxs[g_iWallsCount], str_to_float(szArgMaxsX), str_to_float(szArgMaxsY), str_to_float(szArgMaxsZ));

g_iWallIndex[g_iWallsCount] = CreateNewWall(g_WallPos[g_iWallsCount], g_WallMins[g_iWallsCount], g_WallMaxs[g_iWallsCount]);
g_iWallsCount++;
}

fclose(iFile);
}
}
}

FindAllWalls();
HideAllWalls();

if(!g_iWallsCount)
{
server_print("[%s] Warning: file ^"%s^" is empty!", PLUGIN_NAME, szFileDir);
} else {
g_iWall_ID = g_iWallsMax;

server_print("[%s] Success: %d barrier%s were uploaded to ^"%s^" map.", PLUGIN_NAME, g_iWallsMax, (g_iWallsMax > 1) ? "s" : "", g_MapName);
}
}

public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);

register_clcmd("wallscreator", "PreOpen_WallsCreatorMenu", ACCESS_FLAG);

register_menucmd(register_menuid("WallsCreator Menu"), 1023, "WallsCreator_MenuHandler");
register_menucmd(register_menuid("WallsCreator EditMenu"), 1023, "WallsCreator_EditMenuHandler");
register_menucmd(register_menuid("WallsCreator KillMenu"), 1023, "WallsCreator_KillMenuHandler");

register_dictionary("walls_creator.txt");
}

public client_disconnected(iIndex)
{
if(iIndex == g_iEditorID)
{
HideAllWalls();
g_iEditorID = 0;
}
}

public plugin_end()
SaveAllWalls(0)

public task_ShowWallBox(iEnt)
{
iEnt -= TASK_ID_SHOW_WALLS;

if(!is_valid_ent(iEnt) || !g_iEditorID)
return;

new Float:vPos[3];

entity_get_vector(iEnt, EV_VEC_origin, vPos);

if(!is_in_viewcone(g_iEditorID, vPos) && iEnt != g_iWallIndex[g_iWall_ID])
return;

new Float:vEditorPos[3], Float:vReturn[3];

entity_get_vector(g_iEditorID, EV_VEC_origin, vEditorPos);
trace_line(NULLENT, vEditorPos, vPos, vReturn);

if(iEnt == g_iWallIndex[g_iWall_ID])
UTIL_VisualizeVector(vEditorPos[0], vEditorPos[1], vEditorPos[2] - 16.0, vPos[0], vPos[1], vPos[2], g_Color[RED_WALL]);

new Float:dh = vector_distance(vEditorPos, vPos) - vector_distance(vEditorPos, vReturn)

if(floatabs(dh) > 128.0 && iEnt != g_iWallIndex[g_iWall_ID])
return;

new iColor[3], Float:vMins[3], Float:vMaxs[3];

entity_get_vector(iEnt, EV_VEC_mins, vMins);
entity_get_vector(iEnt, EV_VEC_maxs, vMaxs);

UTIL_Vec_Add(vMins, vPos, vMins);
UTIL_Vec_Add(vMaxs, vPos, vMaxs);

iColor[R] = (g_iWallIndex[g_iWall_ID] == iEnt) ? g_Color[ACTIVE_WALL][R] : g_Color[WALL_DEFAULT][R];
iColor[G] = (g_iWallIndex[g_iWall_ID] == iEnt) ? g_Color[ACTIVE_WALL][G] : g_Color[WALL_DEFAULT][G];
iColor[B] = (g_iWallIndex[g_iWall_ID] == iEnt) ? g_Color[ACTIVE_WALL][B] : g_Color[WALL_DEFAULT][B];

UTIL_CreateBox(vMins, vMaxs, iColor);

if(iEnt != g_iWallIndex[g_iWall_ID])
return;

switch(g_iDirection)
{
case X: // X-координата
{
UTIL_VisualizeVector(vMaxs[0], vMaxs[1], vMaxs[2], vMaxs[0], vMins[1], vMins[2], g_Color[YELLOW_WALL]);
UTIL_VisualizeVector(vMaxs[0], vMaxs[1], vMins[2], vMaxs[0], vMins[1], vMaxs[2], g_Color[YELLOW_WALL]);
UTIL_VisualizeVector(vMins[0], vMaxs[1], vMaxs[2], vMins[0], vMins[1], vMins[2], g_Color[RED_WALL]);
UTIL_VisualizeVector(vMins[0], vMaxs[1], vMins[2], vMins[0], vMins[1], vMaxs[2], g_Color[RED_WALL]);
}
case Y: // Y-координата
{
UTIL_VisualizeVector(vMins[0], vMaxs[1], vMins[2], vMaxs[0], vMaxs[1], vMaxs[2], g_Color[YELLOW_WALL]);
UTIL_VisualizeVector(vMaxs[0], vMaxs[1], vMins[2], vMins[0], vMaxs[1], vMaxs[2], g_Color[YELLOW_WALL]);
UTIL_VisualizeVector(vMins[0], vMins[1], vMins[2], vMaxs[0], vMins[1], vMaxs[2], g_Color[RED_WALL]);
UTIL_VisualizeVector(vMaxs[0], vMins[1], vMins[2], vMins[0], vMins[1], vMaxs[2], g_Color[RED_WALL]);
}
case Z: // Z-координата
{
UTIL_VisualizeVector(vMaxs[0], vMaxs[1], vMaxs[2], vMins[0], vMins[1], vMaxs[2], g_Color[YELLOW_WALL]);
UTIL_VisualizeVector(vMaxs[0], vMins[1], vMaxs[2], vMins[0], vMaxs[1], vMaxs[2], g_Color[YELLOW_WALL]);
UTIL_VisualizeVector(vMaxs[0], vMaxs[1], vMins[2], vMins[0], vMins[1], vMins[2], g_Color[RED_WALL]);
UTIL_VisualizeVector(vMaxs[0], vMins[1], vMins[2], vMins[0], vMaxs[1], vMins[2], g_Color[RED_WALL]);
}
}
}

public PreOpen_WallsCreatorMenu(iIndex, iFlags)
{
if(~get_user_flags(iIndex) & iFlags)
{
console_print(iIndex, "%L", iIndex, "WC_NO_ACCESS");
return PLUGIN_HANDLED;
}

g_iEditorID = iIndex;

FindAllWalls();
ShowAllWalls();
WallsCreator_BuildMenu(iIndex);

return PLUGIN_HANDLED;
}

public WallsCreator_BuildMenu(iIndex)
{
new szMenu[512], iLen;

new iKeys = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_9|MENU_KEY_0;

iLen = formatex(szMenu, charsmax(szMenu), "\w[\rWallsCreator Menu\w] %L^n^n", iIndex, "WC_MAIN_MENU");

iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w%L: \r%d^n", iIndex, "WC_TOTAL_BARRIERS", g_iWallsMax);
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w%L: \r%d^n^n", iIndex, "WC_BARRIER_SELECTED", g_iWall_ID);

iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "%s %L^n", (g_iWall_ID < g_iWallsMax) ? "\r1. \w" : "\d1. ", iIndex, "WC_NEXT_BARRIER");
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "%s %L^n^n", (g_iWall_ID > 1) ? "\r2. \w" : "\d2. ", iIndex, "WC_PREVIOUS_BARRIER");
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "%s %L^n^n", (g_iWallsMax < MAX_WALLS) ? "\r3. \w" : "\d3. ", iIndex, "WC_CREATE_BARRIER");
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "%s %L^n", is_valid_ent(g_iWallIndex[g_iWall_ID]) ? "\r4. \w" : "\d4. ", iIndex, "WC_EDIT_BARRIER");
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "%s %L^n^n", is_valid_ent(g_iWallIndex[g_iWall_ID]) ? "\r5. \w" : "\d5. ", iIndex, "WC_DELETE_BARRIER");

iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\r9. \w%L^n", iIndex, "WC_SAVE_SETTINGS");
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\r0. \w%L", iIndex, "WC_EXIT_MENU");

show_menu(iIndex, iKeys, szMenu, -1, "WallsCreator Menu");
}

public WallsCreator_MenuHandler(iIndex, iKey)
{
switch(iKey)
{
case 0:
{
g_iWall_ID = (g_iWall_ID < g_iWallsMax) ? ++g_iWall_ID : g_iWall_ID;
WallsCreator_BuildMenu(iIndex);
}
case 1:
{
g_iWall_ID = (g_iWall_ID > 1) ? --g_iWall_ID : g_iWall_ID;
WallsCreator_BuildMenu(iIndex);
}
case 2:
{
if(g_iWallsMax < MAX_WALLS)
{
new Float:vPos[3];

entity_get_vector(iIndex, EV_VEC_origin, vPos);

g_iWallIndex[g_iWallsCount] = CreateNewWall(vPos, g_vecDefMins, g_vecDefMaxs);
g_iWall_ID = g_iWallsCount;

ShowAllWalls();
WallsCreator_BuildEditMenu(iIndex);
}
}
case 3:
{
if(is_valid_ent(g_iWallIndex[g_iWall_ID]))
{
WallsCreator_BuildEditMenu(iIndex);
} else {
WallsCreator_BuildMenu(iIndex);
}
}
case 4: WallsCreator_BuildKillMenu(iIndex);
case 8:
{
SaveAllWalls(iIndex);
WallsCreator_BuildMenu(iIndex);
client_print_color(iIndex, 0, "%L", iIndex, "WC_NEED_CHANGEMAP");
}
case 9: HideAllWalls();
}
}

public WallsCreator_BuildKillMenu(iIndex)
{
new szMenu[512], iLen;

new iKeys = MENU_KEY_0|MENU_KEY_1;

iLen = formatex(szMenu, charsmax(szMenu), "\w[\rWallsCreator Menu\w] %L^n^n", iIndex, "WC_DELETING_BARRIER");

iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\r1. \w%L^n", iIndex, "WC_CONFIRM_DELETING");
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\r0. \w%L", iIndex, "WC_CANCEL_DELETE");

show_menu(iIndex, iKeys, szMenu, -1, "WallsCreator KillMenu");
}

public WallsCreator_KillMenuHandler(iIndex, iKey)
{
switch(iKey)
{
case 0:
{
remove_entity(g_iWallIndex[g_iWall_ID]);
FindAllWalls();

g_iWall_ID = g_iWallsMax;
WallsCreator_BuildMenu(iIndex);

client_print_color(iIndex, 0, "%L", iIndex, "WC_SUCCESSFULLY_REMOVED");
}
case 9:
{
WallsCreator_BuildMenu(iIndex);
client_print_color(iIndex, 0, "%L", iIndex, "WC_NEED_SAVE_SETTINGS");
}
}
}

public WallsCreator_BuildEditMenu(iIndex)
{
new szMenu[512], iLen;

new iKeys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6;

iLen = formatex(szMenu, charsmax(szMenu), "\w[\rWallsCreator Menu\w] %L^n^n", iIndex, "WC_EDITING");

iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\r1. \w%L: [\r%s\w]^n", iIndex, "WC_EDIT_AXIS", g_Coord[g_iDirection]);
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\r2. \w%L: [\r%d Unit%s\w]^n^n", iIndex, "WC_EDIT_STEP", g_iSetupUnits, (g_iSetupUnits == 1) ? "": "s");

iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\r3. \y%L %L^n", iIndex, "WC_ZOOM", iIndex, g_iDirection == 1 ? "WC_LEFT" : ((1 < g_iDirection) ? "WC_FROM_ABOVE" : "WC_FRONT"));
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\r4. \y%L %L^n^n", iIndex, "WC_REDUCE", iIndex, g_iDirection == 1 ? "WC_LEFT" : ((1 < g_iDirection) ? "WC_FROM_ABOVE" : "WC_FRONT"));

iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\r5. \r%L %L^n", iIndex, "WC_ZOOM", iIndex, g_iDirection == 1 ? "WC_RIGHT" : ((1 < g_iDirection) ? "WC_FROM_BELOW" : "WC_POSTERIORLY"));
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\r6. \r%L %L^n^n", iIndex, "WC_REDUCE", iIndex, g_iDirection == 1 ? "WC_RIGHT" : ((1 < g_iDirection) ? "WC_FROM_BELOW" : "WC_POSTERIORLY"));

iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\r0. \w%L", iIndex, "WC_RETURN_MAIN_MENU");

show_menu(iIndex, iKeys, szMenu, -1, "WallsCreator EditMenu");
}

public WallsCreator_EditMenuHandler(iIndex, iKey)
{
new Float:vPos[3], Float:vMins[3], Float:vMaxs[3];

entity_get_vector(g_iWallIndex[g_iWall_ID], EV_VEC_origin, vPos);
entity_get_vector(g_iWallIndex[g_iWall_ID], EV_VEC_mins, vMins);
entity_get_vector(g_iWallIndex[g_iWall_ID], EV_VEC_maxs, vMaxs);

switch(iKey)
{
case 0:
{
g_iDirection = (g_iDirection < 2) ? ++g_iDirection : 0;
WallsCreator_BuildEditMenu(iIndex);
}
case 1:
{
g_iSetupUnits = (g_iSetupUnits < 100) ? g_iSetupUnits * 10 : 1;
WallsCreator_BuildEditMenu(iIndex);
}
case 2:
{
vMins[g_iDirection] -= float(g_iSetupUnits) / 2.0;
vMaxs[g_iDirection] += float(g_iSetupUnits) / 2.0;
vPos[g_iDirection] += float(g_iSetupUnits) / 2.0;

entity_set_vector(g_iWallIndex[g_iWall_ID], EV_VEC_origin, vPos);
entity_set_size(g_iWallIndex[g_iWall_ID], vMins, vMaxs);

WallsCreator_BuildEditMenu(iIndex);
}
case 3:
{
if((floatabs(vMins[g_iDirection]) + vMaxs[g_iDirection]) >= g_iSetupUnits)
{
vMins[g_iDirection] += float(g_iSetupUnits) / 2.0;
vMaxs[g_iDirection] -= float(g_iSetupUnits) / 2.0;
vPos[g_iDirection] -= float(g_iSetupUnits) / 2.0;
}

entity_set_vector(g_iWallIndex[g_iWall_ID], EV_VEC_origin, vPos);
entity_set_size(g_iWallIndex[g_iWall_ID], vMins, vMaxs);

WallsCreator_BuildEditMenu(iIndex);
}
case 4:
{
vMins[g_iDirection] -= float(g_iSetupUnits) / 2.0;
vMaxs[g_iDirection] += float(g_iSetupUnits) / 2.0;
vPos[g_iDirection] -= float(g_iSetupUnits) / 2.0;

entity_set_vector(g_iWallIndex[g_iWall_ID], EV_VEC_origin, vPos);
entity_set_size(g_iWallIndex[g_iWall_ID], vMins, vMaxs);

WallsCreator_BuildEditMenu(iIndex);
}
case 5:
{
if((floatabs(vMins[g_iDirection]) + vMaxs[g_iDirection]) >= g_iSetupUnits)
{
vMins[g_iDirection] += float(g_iSetupUnits) / 2.0;
vMaxs[g_iDirection] -= float(g_iSetupUnits) / 2.0;
vPos[g_iDirection] += float(g_iSetupUnits) / 2.0;
}

entity_set_vector(g_iWallIndex[g_iWall_ID], EV_VEC_origin, vPos);
entity_set_size(g_iWallIndex[g_iWall_ID], vMins, vMaxs);

WallsCreator_BuildEditMenu(iIndex);
}
case 9:
{
WallsCreator_BuildMenu(iIndex);
client_print_color(iIndex, 0, "%L", iIndex, "WC_NEED_SAVE_SETTINGS");
}
}
}

CreateNewWall(Float:vPos[3], Float:vMins[3], Float:vMaxs[3])
{
new iEnt = create_entity("info_target");

entity_set_string(iEnt, EV_SZ_classname, ENT_CLASSNAME);
entity_set_model(iEnt, ENT_SET_MODEL);
entity_set_origin(iEnt, vPos);
entity_set_int(iEnt, EV_INT_movetype, MOVETYPE_PUSH);

if(g_iEditorID)
{
entity_set_int(iEnt, EV_INT_solid, SOLID_NOT);
} else {
entity_set_int(iEnt, EV_INT_solid, SOLID_BBOX);
}

entity_set_size(iEnt, vMins, vMaxs);
set_entity_visibility(iEnt, 0);

return iEnt;
}

FindAllWalls()
{
new iEnt = NULLENT;
g_iWallsCount = 0;

while((iEnt = find_ent_by_class(iEnt, ENT_CLASSNAME)))
g_iWallIndex[++g_iWallsCount] = iEnt;

g_iWallsMax = g_iWallsCount;
g_iWallsCount += 1;
}

HideAllWalls()
{
g_iEditorID = 0;

for(new i; i < g_iWallsCount; i++)
{
if(is_valid_ent(g_iWallIndex[i]))
{
entity_set_int(g_iWallIndex[i], EV_INT_solid, SOLID_BBOX);
remove_task(TASK_ID_SHOW_WALLS + g_iWallIndex[i]);
}
}
}

ShowAllWalls()
{
FindAllWalls();

for(new i; i < g_iWallsCount; i++)
{
if(is_valid_ent(g_iWallIndex[i]))
{
if(task_exists(TASK_ID_SHOW_WALLS + g_iWallIndex[i]))
remove_task(TASK_ID_SHOW_WALLS + g_iWallIndex[i]);

entity_set_int(g_iWallIndex[i], EV_INT_solid, SOLID_NOT);
set_task(0.2, "task_ShowWallBox", TASK_ID_SHOW_WALLS + g_iWallIndex[i], _, _, "b");
}
}
}

SaveAllWalls(iIndex)
{
new szFileDir[128], szBuffer[128];

get_localinfo("amxx_configsdir", szFileDir, charsmax(szFileDir));

formatex(szFileDir, charsmax(szFileDir), "%s/%s/", szFileDir,FOLDER_NAME);

if(!dir_exists(szFileDir))
mkdir(szFileDir);

formatex(szFileDir, charsmax(szFileDir), "%s/%s.%s", szFileDir, g_MapName, FILE_FORMAT);

if(file_exists(szFileDir))
delete_file(szFileDir);

FindAllWalls();

formatex(szBuffer, charsmax(szBuffer), "#^n\
# File was created for %s^n\
#^n\
# <Wall Index> <Position X Y Z> <Mins X Y Z> <Maxs X Y Z>^n\
#^n", g_MapName
);
write_file(szFileDir, szBuffer);

for(new i; ++i < g_iWallsCount;)
{
new Float:vPos[3], Float:vMins[3], Float:vMaxs[3]

entity_get_vector(g_iWallIndex[i], EV_VEC_origin, vPos);
entity_get_vector(g_iWallIndex[i], EV_VEC_mins, vMins);
entity_get_vector(g_iWallIndex[i], EV_VEC_maxs, vMaxs);

formatex(szBuffer, charsmax(szBuffer), "%d %.1f %.1f %.1f %.0f %.0f %.0f %.0f %.0f %.0f",
i, vPos[0], vPos[1], vPos[2], vMins[0], vMins[1], vMins[2], vMaxs[0], vMaxs[1], vMaxs[2]
);

write_file(szFileDir, szBuffer);
}

if(iIndex > 0)
{
client_print_color(iIndex, 0, "%L ^"^4%s/%s.%s^1^".", iIndex, "WC_PRESERVATION_OF_BARRIERS", FOLDER_NAME, g_MapName, FILE_FORMAT);
} else if(iIndex == 0) {
server_print("[%s] Map Change: All created barriers are stored in file ^"%s/%s.%s^".", PLUGIN_NAME, FOLDER_NAME, g_MapName, FILE_FORMAT);
}
}

stock UTIL_CreateBox(const Float:vecMins[], const Float:vecMaxs[], Color[3])
{
UTIL_VisualizeVector(vecMaxs[0], vecMaxs[1], vecMaxs[2], vecMins[0], vecMaxs[1], vecMaxs[2], Color);
UTIL_VisualizeVector(vecMaxs[0], vecMaxs[1], vecMaxs[2], vecMaxs[0], vecMins[1], vecMaxs[2], Color);
UTIL_VisualizeVector(vecMaxs[0], vecMaxs[1], vecMaxs[2], vecMaxs[0], vecMaxs[1], vecMins[2], Color);
UTIL_VisualizeVector(vecMins[0], vecMins[1], vecMins[2], vecMaxs[0], vecMins[1], vecMins[2], Color);
UTIL_VisualizeVector(vecMins[0], vecMins[1], vecMins[2], vecMins[0], vecMaxs[1], vecMins[2], Color);
UTIL_VisualizeVector(vecMins[0], vecMins[1], vecMins[2], vecMins[0], vecMins[1], vecMaxs[2], Color);
UTIL_VisualizeVector(vecMins[0], vecMaxs[1], vecMaxs[2], vecMins[0], vecMaxs[1], vecMins[2], Color);
UTIL_VisualizeVector(vecMins[0], vecMaxs[1], vecMins[2], vecMaxs[0], vecMaxs[1], vecMins[2], Color);
UTIL_VisualizeVector(vecMaxs[0], vecMaxs[1], vecMins[2], vecMaxs[0], vecMins[1], vecMins[2], Color);
UTIL_VisualizeVector(vecMaxs[0], vecMins[1], vecMins[2], vecMaxs[0], vecMins[1], vecMaxs[2], Color);
UTIL_VisualizeVector(vecMaxs[0], vecMins[1], vecMaxs[2], vecMins[0], vecMins[1], vecMaxs[2], Color);
UTIL_VisualizeVector(vecMins[0], vecMins[1], vecMaxs[2], vecMins[0], vecMaxs[1], vecMaxs[2], Color);
}

/* Thanks wopox1337 for stock (https://dev-cs.ru/threads/222/#post-8937) */
stock UTIL_VisualizeVector(Float:vStartX, Float:vStartY, Float:vStartZ, Float:vEndX, Float:vEndY, Float:vEndZ, iColor[3])
{
message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
write_byte(TE_BEAMPOINTS);
write_coord(floatround(vStartX));
write_coord(floatround(vStartY));
write_coord(floatround(vStartZ));
write_coord(floatround(vEndX));
write_coord(floatround(vEndY));
write_coord(floatround(vEndZ));
write_short(g_BeamSprite);
write_byte(1); // Стартовый кадр
write_byte(1); // Скорость анимации
write_byte(2); // Время существования/life in 0.1's
write_byte(6); // Толщина луча
write_byte(0); // Искажение
write_byte(iColor[0]); // Цвет красный
write_byte(iColor[1]); // Цвет зеленый
write_byte(iColor[2]); // Цвет синий
write_byte(200); // Яркость
write_byte(0); // Скорость
message_end();
}

stock UTIL_Vec_Add(const Float:Vec1[], const Float:Vec2[], Float:Out[])
{
Out[0] = Vec1[0] + Vec2[0];
Out[1] = Vec1[1] + Vec2[1];
Out[2] = Vec1[2] + Vec2[2];
}

stock UTIL_Vec_Set(Float:Vec[], Float:x, Float:y, Float:z)
{
Vec[0] = x;
Vec[1] = y;
Vec[2] = z;
}
Ошибка заключается в том, что когда включаю плагин Walls Creator в какой-либо карте он работает нормально, и при смене на другой он выключается, и в некоторых картах появляются невидимые стены в рандомных местах, при том, что плагин выключен(а при перезагрузке сервера они пропадают)
 
Сообщения
2,288
Реакции
1,740
Помог
31 раз(а)
DINOBO, поля заполнены неверно. Пробуем еще раз используя подсказки
 
Статус
В этой теме нельзя размещать новые ответы.

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу