Проблема с GUI

Сообщения
330
Реакции
-24
Ошибка
Было голосование за смену карты, через GUI, с картинками карт, потом второе сразу, на втором у всех мышка зависла и никто не смог проголосовать.
ОС
Linux
Amx Mod X
AMX Mod X 1.9.0.5271
Билд
3.8.0.739-dev
ReGamedll
5.20.0.492-dev
Версия Metamod
Metamod v1.21p37  2013/05/30 (5:13)
Список метамодулей
description      stat pend  file              vers      src   load  unlod
[ 1] Reunion RUN - reunion_mm_i386. v0.1.0.1 ini Start Never
[ 2] SafeNameAndChat RUN - SafeNameAndChat. v1.1 ini ANY ANY
[ 3] AMX Mod X RUN - amxmodx_mm_i386. v1.9.0.5 ini Start ANY
[ 4] WHBlocker RUN - whblocker_mm_i38 v1.5.697 ini Chlvl ANY
[ 5] Rechecker RUN - rechecker_mm_i38 v2.5 ini Chlvl ANY
[ 6] Revoice RUN - revoice_mm_i386. v0.1.0.3 ini Start Never
[ 7] ReSemiclip RUN - resemiclip_mm_i3 v2.3.9 ini Chlvl ANY
[ 8] ProcessCmds RUN - processcmds_mm_i v1.1.9 ini Start Never
[ 9] ReSRDetector RUN - resrdetector_mm_ v0.1.0 ini Chlvl ANY
[10] MySQL RUN - mysql_amxx_i386. v1.9.0.5 pl3 ANY ANY
[11] ReAPI RUN - reapi_amxx_i386. v5.19.0. pl3 ANY Never
[12] FakeMeta RUN - fakemeta_amxx_i3 v1.9.0.5 pl3 ANY ANY
[13] Ham Sandwich RUN - hamsandwich_amxx v1.9.0.5 pl3 ANY ANY
[14] ReAimDetector RUN - reaimdetector_am v0.2.2 pl3 ANY Never
[15] Engine RUN - engine_amxx_i386 v1.9.0.5 pl3 ANY ANY
[16] CSX RUN - csx_amxx_i386.so v1.9.0.5 pl3 ANY ANY
[17] CStrike RUN - cstrike_amxx_i38 v1.9.0.5 pl3 ANY ANY
[18] Fun RUN - fun_amxx_i386.so v1.9.0.5 pl3 ANY ANY
18 plugins, 18 running
Список плагинов
name                    version     author            file             status   
[ 1] Admin Loader 3.5 neygomon admin_loader.am running
[ 2] FreshBans 1.4.2b kanagava fresh_bans.amxx running
[ 3] DopBan 3.0.6b kanagava dop_ban306_183. running
[ 4] ReAimDetector API 0.2.2 ReHLDS Team reaimdetector.a running
[ 5] Aliases checker 1.0.6 kanagava alias_detector_ running
[ 6] [190] Cvar On Map 20.06.06 SKAJIbnEJIb cvar_on_map.amx running
[ 7] [190] Screen Player 20.06.06 SKAJIbnEJIb screen_player.a running
[ 8] ScreenMaker 1.1 neygomon screen_maker.am running
[ 9] Map Manager: Block com 1.0.1 Nordic Warrior map_manager_blo stopped
[ 10] Night Mode 1.2.3 Radius night_mode.amxx running
[ 11] [190] DemoRecorder RBS 20.06.06 SKAJIbnEJIb demorecorder_rb running
[ 12] Rank Menu 1.1 h1k3 rankmenu.amxx running
[ 13] [190] Army Ranks Ultim 20.06.06 SKAJIbnEJIb army_ranks_ulti running
[ 14] [190] Jobs RBS 20.06.06 SKAJIbnEJIb jobs_rbs.amxx running
[ 15] Jobs 1.0 di.alyabev jobs.amxx running
[ 16] [190] Ultimate Informe 21.03.23 SKAJIbnEJIb ultimate_inform running
[ 17] [190] Bets RBS 20.10.24BE SKAJIbnEJIb bets_rbs.amxx running
[ 18] [190] Skill ELO 20.06.06 SKAJIbnEJIb skill_elo.amxx running
[ 19] [190] CsStats MySQL 20.06.06 SKAJIbnEJIb csstats_mysql.a running
[ 20] [190] CsStats Editor 20.06.06 SKAJIbnEJIb csstats_editor. running
[ 21] [190] Top Award RBS 20.06.06 SKAJIbnEJIb topaward_rbs.am running
[ 22] [190] Kill Assist RBS 20.06.06 SKAJIbnEJIb & Di killassist_rbs. running
[ 23] [190] ESP RBS 20.06.06 SKAJIbnEJIb & Ko esp_rbs.amxx running
[ 24] [190] Ultimate Weapons 21.03.23 SKAJIbnEJIb ultimate_weapon running
[ 25] [Ultimate] Addon: Weap 0.0.2 ThisPublicbaby ultimate_addon_ running
[ 26] [190] VIP RBS 20.07.20 SKAJIbnEJIb vip_rbs.amxx running
[ 27] SF Warn Menu 0.1.4g serfreeman1337 sf_admin_warns. running
[ 28] Menus Front-End 20.06.06 SKAJIbnEJIb & AM amxmodmenu_rbs. running
[ 29] Damager Advanced 1.1.1 Radius (based on damager_advance running
[ 30] [190] Stats Configurat 20.06.06 SKAJIbnEJIb & AM statscfg_rbs.am running
[ 31] [190] StatsX RBS 21.03.23 SKAJIbnEJIb & AM statsx_rbs.amxx running
[ 32] [190] Map Spawns Edito 20.06.06 SKAJIbnEJIb & iG MapSpawnsEditor running
[ 33] [190] Parachute RBS 20.06.06 SKAJIbnEJIb & KR parachute_rbs.a running
[ 34] [190] AdminChat RBS 20.06.06 SKAJIbnEJIb adminchat_rbs.a running
[ 35] [183] Afk Time 17.10.30 Sanlerus afk_time.amxx running
[ 36] [183] MapsMenu RBS 19.09.01 SKAJIbnEJIb & AM mapsmenu_rbs.am running
[ 37] [190] AdminCmd RBS 20.06.06 SKAJIbnEJIb & AM admincmd_rbs.am running
[ 38] Pause Plugins 1.8.2 AMXX Dev Team pausecfg.amxx running
[ 39] CS Misc. Stats 1.8.2 AMXX Dev Team miscstats.amxx running
[ 40] Restrict Weapons 1.8.2 Leo_[BH] restmenu.amxx running
[ 41] [190] Warmup RBS 21.03.23 SKAJIbnEJIb warmup_rbs.amxx running
[ 42] [190] Stimulation RBS 20.06.06 SKAJIbnEJIb stimulation_rbs running
[ 43] Extra stimul 2.0 di.alyabev stimul_extra.am running
[ 44] Advert Messages 1.2 neygomon adverts.amxx running
[ 45] [190] CsStats ResetSco 20.06.06 SKAJIbnEJIb csstats_resetsc running
[ 46] [183] VoteBan L4D 17.10.30 Sanlerus voteban_l4d.amx running
[ 47] [183] Crux Ansata 17.10.30 Sanlerus crux_ansata.amx running
[ 48] Auto Team Balance Adva 1.5.1 Radius auto_team_balan running
[ 49] C4 Timer on roundtime 0.3.3a neygomon c4timer.amxx running
[ 50] [190] Ultimate Flags 21.03.24BE SKAJIbnEJIb ultimate_flags. running
[ 51] Night Adm lite 1.6 Aki_Lucky night_admin.amx running
[ 52] Kills Counter 0.3 serfreeman1337 kills_counter.a running
[ 53] AdminRR 2.0 SS AdminRR.amxx running
[ 54] [190] WeaponMenu RBS 20.06.30 SKAJIbnEJIb weaponmenu_rbs. running
[ 55] No Players Map 1.03 neygomon no_players_map. running
[ 56] Nade Messages 1.0 v3x nademessages.am running
[ 57] Smoke: HealthNade 0.0.3 wopox1337 Smoke_HealthNad running
[ 58] [190] Radio RBS 20.06.06 SKAJIbnEJIb radio_rbs.amxx running
[ 59] [190] Blind RBS 20.06.06 SKAJIbnEJIb blind_rbs.amxx running
[ 60] [190] Admin Fun DM 21.03.23 SKAJIbnEJIb & Sh afundm.amxx running
[ 61] [190] Ultimate Knife 21.03.23 SKAJIbnEJIb ultimate_knife. running
[ 62] [190] Ultimate Models 21.03.23 SKAJIbnEJIb ultimate_models running
[ 63] [190] No Team Flash 20.06.06 SKAJIbnEJIb NoTeamFlash.amx running
[ 64] [190] Chat Controller 20.06.06 SKAJIbnEJIb chat_controller running
[ 65] Killer ScreenFade 0.0.5 Vaqtincha reapi_killer_sc running
[ 66] [DD] Quick defuse 1.0 Deadly|Darkness dd_qdefuse.amxx running
[ 67] Block Chat 0.1 c-s.net.ua block_chat.amxx running
[ 68] Unprecacher CSR 1.0 Leo_[BH] unprecacher_csr running
[ 69] [190] Name Change Time 1.0.0 Vaqtincha block_change_ni running
[ 70] [190] Snipers RBS 20.06.06 SKAJIbnEJIb snipers_rbs.amx running
[ 71] [190] C4 Destroyer 21.03.23 SKAJIbnEJIb c4_destroyer.am running
[ 72] Night and Day Sky 1.0 Leo_[BH] night_day_sky.a running
[ 73] Transfer Addons 1.0 SKAJIbnEJIb transfer_health running
[ 74] [190] Transfer RBS 21.03.25 SKAJIbnEJIb transfer_rbs.am running
[ 75] Map Manager: Core 3.0.9 Mistrick map_manager_cor running
[ 76] Map Manager: Scheduler 0.1.5 Mistrick map_manager_sch running
[ 77] Map Manager: Rtv 0.1.1 Mistrick map_manager_rtv running
[ 78] Map Manager: Nominatio 0.1.2-e3 Mistrick / Nordi map_manager_nom running
[ 79] Map Manager: BlockList 0.0.3 edit Mistrick / Nordi map_manager_blo running
[ 80] Map Manager: Online so 0.0.2 Mistrick map_manager_onl running
[ 81] Map Manager: Effects 0.0.9 edit Mistrick / Nordi map_manager_eff running
[ 82] Map Manager: Informer 0.0.5 edit Mistrick map_manager_inf running
[ 83] Map Manager: Advanced 0.0.5 edit Mistrick / Nordi map_manager_adv running
[ 84] Map Manager: GUI 0.0.4 Mistrick map_manager_gui running
[ 85] [183] Ultimate Gag 19.11.04BE SKAJIbnEJIb ultimate_gag.am running
[ 86] [190] Chat RBS 20.10.24BE SKAJIbnEJIb chat_rbs.amxx running
86 plugins, 85 running
Автор плагина
Mistrick
Версия плагина
3.0.7
Исходный код
/*
Credits: [WPMG]PRoSToTeM@, Sanlerus
Models, sprites for test by 8dp
*/
#include <amxmodx>
#include <fakemeta>
#include <engine>
#include <map_manager>

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

#define PLUGIN "Map Manager: GUI"
#define VERSION "0.0.4"
#define AUTHOR "Mistrick"

#pragma semicolon 1

#define get_num(%0) get_pcvar_num(g_pCvars[%0])
#define get_float(%0) get_pcvar_float(g_pCvars[%0])
#define hide_ent(%0) set_pev(%0, pev_effects, pev(%0, pev_effects) | EF_NODRAW)
#define show_ent(%0) set_pev(%0, pev_effects, pev(%0, pev_effects) & ~EF_NODRAW)

#define BOX_MODEL "models/map_manager/blackbox2.mdl"
#define MODEL_CURSOR "sprites/map_manager/cursor2.spr"

#define FILE_PACKS "mappacks.ini"

#define MAX_MAP_CUBES 9

#define MAX_CURSOR_X 140.0
#define MAX_CURSOR_Y 103.0
#define CURSOR_SENSITIVITY 8

#define UNKNOWN_MAP_FRAME 0.0
#define EXTEND_MAP_FRAME 1.0

#define COORD_X 0
#define COORD_Y 1

new const SELECTED_COLOR[3] = {55, 200, 55};

enum _:FramesStruct {
BeginFrame,
EndFrame
};

enum {
UNKNOWN_MAP,
PACK_MAP,
CURRENT_MAP
};

enum Cvars {
CURSOR_SENS,
HIDE_MAP_PREFIX,
SHOW_SELECTS,
SHOW_PERCENT
};

new g_pCvars[Cvars];

new g_pPointOfView;
new g_pCursorEntity;

new Float:g_vecCursorPos[33][3];
new Float:g_vecPOVOrigin[3];

new g_bShowGUI[33];
new g_iCurEnt[33];

enum _:CubeInfo {
Name[MAPNAME_LENGTH],
Float:Begin,
Float:End
};

new g_eCubesInfo[MAX_MAP_CUBES][CubeInfo];
new g_pMapCubes[MAX_MAP_CUBES];
new Float:g_fMapCubesOrigin[MAX_MAP_CUBES][3];

new Float:g_fDhudCoords[MAX_MAP_CUBES][2];
new g_bShowName[MAX_MAP_CUBES];

new g_iMapsCount;
new g_bVoted[33];

new g_iCurPos[33];
new Float:g_fCurFrame[33];

enum _:PackStruct {
Path[64],
Float:Scale,
Trie:Maps
};

new Array:g_aPacks;

new bool:g_bShowSelects;
new g_iCurMap;

new g_sCurMap[MAPNAME_LENGTH];
new g_sPrefix[32];

enum Forwards {
AddToFullPack_Pre,
AddToFullPack_Post,
CmdStart_Post,
CheckVisibility_Pre
};

new g_hForwards[Forwards];

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);

// TODO: cvars
g_pCvars[CURSOR_SENS] = register_cvar("mapm_cursor_sens", "2.5");
g_pCvars[HIDE_MAP_PREFIX] = register_cvar("mapm_hide_map_prefix", "1"); // TODO
}
public plugin_cfg()
{
mapm_get_prefix(g_sPrefix, charsmax(g_sPrefix));

g_pCvars[SHOW_SELECTS] = get_cvar_pointer("mapm_show_selects");
g_pCvars[SHOW_PERCENT] = get_cvar_pointer("mapm_show_percent");
}
public plugin_precache()
{
precache_model(BOX_MODEL);
precache_model(MODEL_CURSOR);

g_pPointOfView = create_entity("info_target");
set_pev(g_pPointOfView, pev_classname, "PointOfView");
entity_set_model(g_pPointOfView, BOX_MODEL);
entity_set_size(g_pPointOfView, Float:{ -5.0, -5.0, -5.0 }, Float:{ 5.0, 5.0, 5.0 });
set_pev(g_pPointOfView, pev_effects, EF_BRIGHTLIGHT);

g_pCursorEntity = create_entity("info_target");
set_pev(g_pCursorEntity, pev_classname, "CursorEntity");
set_pev(g_pCursorEntity, pev_scale, 0.1);
entity_set_model(g_pCursorEntity, MODEL_CURSOR);

for(new i; i < sizeof(g_pMapCubes); i++) {
g_pMapCubes[i] = create_entity("info_target");
set_pev(g_pMapCubes[i], pev_classname, "MapCube");
set_pev(g_pMapCubes[i], pev_scale, 0.2);
set_pev(g_pMapCubes[i], pev_effects, EF_BRIGHTLIGHT);
entity_set_size(g_pMapCubes[i], Float:{ -5.0, -5.0, -5.0 }, Float:{ 5.0, 5.0, 5.0 });
}

new Float:origin[3] = { -4000.0, -3800.0, -4000.0 };

entity_set_origin(g_pPointOfView, origin);
g_vecPOVOrigin = origin;

// TODO: Move offsets to defines
origin[0] += 144.0;
origin[1] += 96.0;
origin[2] += 48.0;

for(new i; i < sizeof(g_pMapCubes); i++) {
entity_set_origin(g_pMapCubes[i], origin);
g_fMapCubesOrigin[i] = origin;

origin[1] -= 96.0;

if((i + 1) % 3 == 0) {
origin[2] -= 48.0;
origin[1] += 96.0 * 3.0;
}
}

get_mapname(g_sCurMap, charsmax(g_sCurMap));

load_packs();

get_dhud_coords();
hide_gui();
}

get_dhud_coords()
{
new Float:start[3];
pev(g_pPointOfView, pev_origin, start);
start[1] += MAX_CURSOR_X;
start[2] += MAX_CURSOR_Y;

new Float:cube[3], Float:diff[2];

for(new i; i < sizeof(g_pMapCubes); i++) {
cube = g_fMapCubesOrigin[i];
diff[COORD_X] = start[1] - cube[1];
diff[COORD_Y] = start[2] - cube[2];

g_fDhudCoords[i][COORD_X] = diff[COORD_X] / (MAX_CURSOR_X * 2.0) - 0.07;
g_fDhudCoords[i][COORD_Y] = diff[COORD_Y] / (MAX_CURSOR_Y * 2.0);
g_fDhudCoords[i][COORD_Y] += (g_fDhudCoords[i][COORD_Y] > 0.5) ? 0.058 : 0.073;

// server_print("%d - %f %f", i, g_fDhudCoords[i][COORD_X], g_fDhudCoords[i][COORD_Y]);
}
}

load_packs()
{
new file_path[256]; get_localinfo("amxx_configsdir", file_path, charsmax(file_path));
format(file_path, charsmax(file_path), "%s/%s", file_path, FILE_PACKS);

if(!file_exists(file_path)) {
new error[192]; formatex(error, charsmax(error), "File doesn't exist ^"%s^".", file_path);
set_fail_state(error);
return 0;
}

new f = fopen(file_path, "rt");

if(!f) {
set_fail_state("Can't read map packs file.");
return 0;
}

g_aPacks = ArrayCreate(PackStruct, 1);

new text[128], pack_info[PackStruct], map[MAPNAME_LENGTH], frames_info[FramesStruct], cur_frame, frames, str_frames[8];

while(!feof(f)) {
fgets(f, text, charsmax(text));
trim(text);

if(!text[0] || text[0] == ';') {
continue;
}

// found new pack
if(containi(text, ".spr") != -1) {
new Float:scale, str_scale[8];
parse(text, pack_info[Path], charsmax(pack_info[Path]), str_scale, charsmax(str_scale));

scale = str_to_float(str_scale);
if(!scale) {
scale = 0.1;
}

pack_info[Scale] = _:scale;
pack_info[Maps] = _:TrieCreate();
ArrayPushArray(g_aPacks, pack_info);
precache_model(pack_info[Path]);
cur_frame = 2;
// log_amx("pack: %s, scale: %f", pack_info[Path], scale);
continue;
}

parse(text, map, charsmax(map), str_frames, charsmax(str_frames));

frames = str_to_num(str_frames);
if(!frames) {
frames = 1;
}

frames_info[BeginFrame] = cur_frame;
frames_info[EndFrame] = cur_frame + frames - 1;

// load maps to last pack
TrieSetArray(pack_info[Maps], map, frames_info, sizeof(frames_info));
// log_amx("map: %s, begin: %d, end: %d", map, frames_info[BeginFrame], frames_info[EndFrame]);

cur_frame = frames_info[EndFrame] + 1;
str_frames = "";
}
fclose(f);

return 1;
}

find_map_frame(map[], pack[], plen, &Float:scale,&Float:begin, &Float:end)
{
new pack_info[PackStruct];
if(equali(map, g_sCurMap)) {
ArrayGetArray(g_aPacks, 0, pack_info);
copy(pack, plen, pack_info[Path]);
scale = pack_info[Scale];
begin = end = EXTEND_MAP_FRAME;
return CURRENT_MAP;
}

new size = ArraySize(g_aPacks), frames_info[FramesStruct];
for(new i; i < size; i++) {
ArrayGetArray(g_aPacks, i, pack_info);
if(TrieGetArray(pack_info[Maps], map, frames_info, sizeof(frames_info))) {
copy(pack, plen, pack_info[Path]);
scale = pack_info[Scale];
begin = float(frames_info[BeginFrame]);
end = float(frames_info[EndFrame]);
return PACK_MAP;
}
}

copy(pack, plen, pack_info[Path]);
scale = pack_info[Scale];
begin = end = UNKNOWN_MAP_FRAME;

return UNKNOWN_MAP;
}

public mapm_vote_started(type)
{
mapm_block_show_vote();

show_gui();

g_iMapsCount = mapm_get_count_maps_in_vote();
g_iCurMap = -1;

new map[MAPNAME_LENGTH];
new pack[64], Float:scale, Float:frames_begin, Float:frames_end, ret;

for(new i; i < g_iMapsCount; i++) {
mapm_get_voteitem_info(i, map, charsmax(map));

ret = find_map_frame(map, pack, charsmax(pack), scale, frames_begin, frames_end);

if(ret == CURRENT_MAP) {
g_iCurMap = i;
}

g_bShowName[i] = !ret;

entity_set_model(g_pMapCubes[i], pack);
set_pev(g_pMapCubes[i], pev_frame, frames_begin);
set_pev(g_pMapCubes[i], pev_scale, scale);

copy(g_eCubesInfo[i][Name], charsmax(g_eCubesInfo[][Name]), map);
g_eCubesInfo[i][Begin] = _:frames_begin;
g_eCubesInfo[i][End] = _:frames_end;
}

arrayset(g_bVoted, false, sizeof(g_bVoted));

new players[32], pnum;
get_players(players, pnum, "ch");

for(new i, id; i < pnum; i++) {
id = players[i];
g_bShowGUI[id] = true;
attach_view(id, g_pPointOfView);
}

g_bShowSelects = bool:get_num(SHOW_SELECTS);

switch_hud(0, false);

g_hForwards[AddToFullPack_Pre] = register_forward(FM_AddToFullPack, "fm_add_to_full_pack_pre", false);
g_hForwards[AddToFullPack_Post] = register_forward(FM_AddToFullPack, "fm_add_to_full_pack_post", true);
g_hForwards[CmdStart_Post] = register_forward(FM_CmdStart, "fm_cmd_start_post", true);
g_hForwards[CheckVisibility_Pre] = register_forward(FM_CheckVisibility, "fm_check_visibility_pre", false);
}

public mapm_countdown(type, time)
{
if(type != COUNTDOWN_VOTETIME) {
return;
}

const Float:TIME = 1.0;

for(new i; i < g_iMapsCount; i++) {
// TODO: show percent
if(!g_bShowName[i]) {
continue;
}
set_dhudmessage(255, 255, 255, g_fDhudCoords[i][COORD_X], g_fDhudCoords[i][COORD_Y], 0, _, TIME);
show_dhudmessage(0, "%s", g_eCubesInfo[i][Name]);
}
}

hide_gui()
{
for(new i; i < MAX_MAP_CUBES; i++) {
hide_ent(g_pMapCubes[i]);
}
hide_ent(g_pCursorEntity);
hide_ent(g_pPointOfView);
}

show_gui()
{
for(new i; i < MAX_MAP_CUBES; i++) {
show_ent(g_pMapCubes[i]);
}
show_ent(g_pCursorEntity);
show_ent(g_pPointOfView);
}

disable_gui()
{
new players[32], pnum;
get_players(players, pnum, "ch");

for(new i, id; i < pnum; i++) {
id = players[i];
g_bShowGUI[id] = false;
attach_view(id, id);
}

for(new i; i < 8; i++) {
show_dhudmessage(0, "");
}

switch_hud(0, true);

unregister_forward(FM_AddToFullPack, g_hForwards[AddToFullPack_Pre], false);
unregister_forward(FM_AddToFullPack, g_hForwards[AddToFullPack_Post], true);
unregister_forward(FM_CmdStart, g_hForwards[CmdStart_Post], true);
unregister_forward(FM_CheckVisibility, g_hForwards[CheckVisibility_Pre], false);

hide_gui();
}

public mapm_vote_finished(const map[], type, total_votes)
{
disable_gui();
}

public mapm_vote_canceled(type)
{
disable_gui();
}

stock is_inside(Float:corigin[3], Float:borigin[3], Float:w, Float:h)
{
if(floatabs(corigin[1] - borigin[1]) <= w && floatabs(corigin[2] - borigin[2]) <= h) {
return true;
}
return false;
}

public fm_cmd_start_post(id, cmd, seed)
{
if (!g_bShowGUI[id]) {
return FMRES_IGNORED;
}

static Float:old_viewangles[33][3], old_buttons[33];
new Float:view_angles[3], buttons;
get_uc(cmd, UC_ViewAngles, view_angles);
buttons = get_uc(cmd, UC_Buttons);

new Float:flDelta = (view_angles[1] - old_viewangles[id][1]);
if (flDelta > 180.0) {
flDelta -= 360.0;
} else if (flDelta < -180.0) {
flDelta += 360.0;
}

g_vecCursorPos[id][1] += flDelta * CURSOR_SENSITIVITY;
g_vecCursorPos[id][2] += -(view_angles[0] - old_viewangles[id][0]) * CURSOR_SENSITIVITY;

g_vecCursorPos[id][1] = floatclamp(g_vecCursorPos[id][1], -MAX_CURSOR_X, MAX_CURSOR_X);
g_vecCursorPos[id][2] = floatclamp(g_vecCursorPos[id][2], -MAX_CURSOR_Y, MAX_CURSOR_Y);

if(!g_bVoted[id]) {
new Float:origin[3], Float:coord[3];
coord[0] = g_vecCursorPos[id][0] + g_vecPOVOrigin[0] + 144.0;
coord[1] = g_vecCursorPos[id][1] + g_vecPOVOrigin[1];
coord[2] = g_vecCursorPos[id][2] + g_vecPOVOrigin[2];

new pos = -1;
for(new i; i < g_iMapsCount; i++) {
origin = g_fMapCubesOrigin[i];
// TODO: find better sizes
if(is_inside(coord, origin, 28.0, 24.0)) {
pos = i;
}
}

if(pos >= 0 && pos != g_iCurPos[id]) {
g_iCurPos[id] = pos;
g_iCurEnt[id] = g_pMapCubes[pos];
g_fCurFrame[id] = g_eCubesInfo[pos][Begin];
} else if (pos == -1 && g_iCurPos[id] >= 0) {
g_iCurPos[id] = -1;
g_iCurEnt[id] = 0;
}

if(buttons & IN_ATTACK && !(old_buttons[id] & IN_ATTACK) && pos != -1) {
// console_print(id, "x: %f, y: %f, z: %f", coord[0], coord[1], coord[2]);
if(g_bShowSelects) {
new name[32]; get_user_name(id, name, charsmax(name));
if(pos == g_iCurMap) {
client_print_color(0, id, "%s^3 %L", g_sPrefix, LANG_PLAYER, "MAPM_CHOSE_EXTEND", name);
} else {
client_print_color(0, id, "%s^3 %L", g_sPrefix, LANG_PLAYER, "MAPM_CHOSE_MAP", name, g_eCubesInfo[pos][Name]);
}
}
g_bVoted[id] = true;
mapm_add_vote_to_item(pos, 1);
}
}

old_viewangles[id] = view_angles;
old_buttons[id] = buttons;

return FMRES_IGNORED;
}

is_gui_part(ent)
{
if(ent == g_pCursorEntity || ent == g_pPointOfView) {
return true;
}
for(new i; i < sizeof(g_pMapCubes); i++) {
if(ent == g_pMapCubes[i]) {
return true;
}
}
return false;
}
is_not_included(ent)
{
for(new i = g_iMapsCount; i < sizeof(g_pMapCubes); i++) {
if(ent == g_pMapCubes[i]) {
return true;
}
}
return false;
}

public fm_add_to_full_pack_pre(es, e, ent, host, flags, player, pSet)
{
if(!g_bShowGUI[host] && is_gui_part(ent)) {
return FMRES_SUPERCEDE;
}
if(g_bShowGUI[host] && is_not_included(ent)) {
return FMRES_SUPERCEDE;
}
return FMRES_IGNORED;
}

public fm_add_to_full_pack_post(es, e, ent, host, flags, player, pSet)
{
if(g_bShowGUI[host])
{
if(ent == g_iCurEnt[host] /* && !g_bVoted[host] */)
{
// set_rendering(g_pMapCubes[pos], kRenderFxGlowShell, 255, 0, 0, kRenderNormal, 20);
set_es(es, ES_RenderMode, kRenderNormal);
set_es(es, ES_RenderAmt, 20);
set_es(es, ES_RenderColor, SELECTED_COLOR);
set_es(es, ES_RenderFx, kRenderFxGlowShell);

new pos = g_iCurPos[host];

if(g_bVoted[host] || g_eCubesInfo[pos][Begin] == g_eCubesInfo[pos][End]) {
return FMRES_IGNORED;
}

static Float:frame_rate = 0.5;
static Float:last_anim[33];

new Float:ftime = get_gametime();

if(ftime - last_anim[host] >= frame_rate) {
last_anim[host] = ftime;
if(g_fCurFrame[host] < g_eCubesInfo[pos][End]) {
g_fCurFrame[host]++;
} else if(g_fCurFrame[host] == g_eCubesInfo[pos][End]) {
g_fCurFrame[host] = g_eCubesInfo[pos][Begin];
}
// log_amx("pos: %d, cur fr %f", pos, g_fCurFrame[host]);
}
set_es(es, ES_Frame, g_fCurFrame[host]);
}
else if(ent == g_pCursorEntity) {
new Float:origin[3];
origin[0] = g_vecCursorPos[host][0] + g_vecPOVOrigin[0] + 143.0;
origin[1] = g_vecCursorPos[host][1] + g_vecPOVOrigin[1];
origin[2] = g_vecCursorPos[host][2] + g_vecPOVOrigin[2];

set_es(es, ES_Origin, origin);
}
}
return FMRES_IGNORED;
}

public fm_check_visibility_pre(pEnt, pSet)
{
if (is_gui_part(pEnt)) {
forward_return(FMV_CELL, 1);
return FMRES_SUPERCEDE;
}
return FMRES_IGNORED;
}

public switch_hud(id, enable)
{
static msg_hide_weapon;
static hud_flags = (1<<0) | (1<<1) | (1<<3) | (1<<4) | (1<<5) | (1<<6);
if(!msg_hide_weapon) {
msg_hide_weapon = get_user_msgid("HideWeapon");
}
message_begin((id) ? MSG_ONE : MSG_ALL, msg_hide_weapon, _, id);
write_byte(enable ? 0 : hud_flags);
message_end();
}
Было голосование за смену карты, через GUI, с картинками карт, потом второе сразу, на втором у всех мышка зависла и никто не смог проголосовать.
Может кто сталкивался и знает как решить?
 

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

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