/***** SETTING DEFINE START *****/
/***** SETTING DEFINE END *****/
m_iVote[MAX_PLAYERS + 1],
Float:m_fWait[MAX_PLAYERS + 1],
new g_pServerVar[server_info_s];
new Float:g_pServerBox[server_box_s][coord_s];
get_mapname(g_pServerVar[m_szMap],31);
if(equal(g_pServerVar[m_szMap],"de_dust2"))
state stpfnSpawn:Enabled;
precache_model(SPRITE_WALL);
register_plugin("Mode 2x2","1.9","s1lent");
register_clcmd("say /mode","cmdMode");
register_clcmd("say /box","cmdMenuBox",ADMIN_RCON,"<Управление объектами, Создание/Изменение/Удаление>");
register_clcmd("say /change","cmdModeChange",ADMIN_VOTE,"<Смена режима Mode 2x2, Открыть/Закрыть карту>");
register_menucmd(register_menuid("Main Edit Menu"),0x3FF,"mainEditHandler");
register_menucmd(register_menuid("Setting Menu"),0x3FF,"settingHandler");
register_menucmd(register_menuid("Properties Menu"),0x3FF,"propertiesHandler");
register_dictionary("mode.txt");
g_pServerVar[m_iMaxpl] = get_maxplayers();
g_pServerVar[m_fNext] = _:(get_gametime() + (VOTE_TIMEWAIT * 60.0));
state stpfnSpawn:Disabled;
get_localinfo("amxx_configsdir",g_pServerVar[m_szFile],63);
add(g_pServerVar[m_szFile],63,"/mode/");
if(!dir_exists(g_pServerVar[m_szFile]))
mkdir(g_pServerVar[m_szFile]);
formatex(g_pServerVar[m_szFile],63,"%s%s.ini",g_pServerVar[m_szFile],g_pServerVar[m_szMap]);
if(file_exists(g_pServerVar[m_szFile]))
g_pServerVar[m_iNone] = boxLoad();
showBox(g_pServerVar[m_iStatus] = box_open,.bShow = false);
formatex(g_pServerVar[m_szDescr],63,"Mode: %s_2x2",g_pServerVar[m_szMap]);
register_forward(FM_GetGameDescription,"pfnGetGameDescription");
register_touch(CLASSNAME_WALL,"player","pfnTouch");
register_touch("weaponbox",CLASSNAME_WALL,"pfnTouchWeaponBox");
register_menucmd(register_menuid("Mode Menu"),0x03,"modemenu");
register_event("HLTV","RoundNew","a","1=0","2=0");
register_event("TextMsg","GameCommencing","a","2=#Game_Commencing","2=#Game_will_restart_in");
if(task_exists(TASK_MODE_VOTE))
remove_task(TASK_MODE_VOTE);
if(task_exists(TASK_MODE_START))
remove_task(TASK_MODE_START);
if(g_pServerVar[m_iThink] && !g_pServerVar[m_iNone])
boxSave(0); // Force save box
public client_disconnect(id)
if(!g_pServerVar[m_iNone])
if(g_pServerVar[m_iClose] == id)
g_pServerVar[m_iClose] = 0;
if(g_pServerVar[m_iVote][id])
g_pServerVar[m_iVote][id] = 0;
g_pServerVar[m_iBlocked] = blocked_s:block_commencing;
showBox((g_pServerVar[m_iStatus] = status_s:box_open),.bShow = false);
if(g_pServerVar[m_iBlocked] > blocked_s:block_admin_change)
for(new a = 1; a <= g_pServerVar[m_iMaxpl]; a++)
if(!is_user_connected(a) || !IsUserFlags(a,ADMIN_VOTE) || !IsUserTeam(a))
if(g_pServerVar[m_iClose] != a)
g_pServerVar[m_iBlocked] = blocked_s:block_none;
showBox((g_pServerVar[m_iStatus] = status_s:box_close),true);
if(g_pServerVar[m_iBlocked] == blocked_s:block_commencing)
g_pServerVar[m_iBlocked] = blocked_s:block_none;
if(g_pServerVar[m_iBlocked])
switch(g_pServerVar[m_iBlocked])
showBox(g_pServerVar[m_iStatus],true);
g_pServerVar[m_iBlocked] = blocked_s:block_roundnew;
g_pServerVar[m_iBlocked] = blocked_s:block_none;
showBox(g_pServerVar[m_iStatus],true);
g_pServerVar[m_iBlocked] = blocked_s:block_permament;
if(g_pServerVar[m_iStatus] == status_s:box_open)
showBox((g_pServerVar[m_iStatus] = status_s:box_close),true);
if(g_pServerVar[m_iStatus] == status_s:box_close)
showBox((g_pServerVar[m_iStatus] = status_s:box_open),true);
if(!equal(g_pServerVar[m_szMap],"de_dust2"))
entity_get_string(ent,EV_SZ_classname,classname,31);
if(equali(classname,"info_player_deathmatch"))
static Float:vec[coord_s];
entity_get_vector(ent,EV_VEC_origin,vec);
static Float:looking[][coord_s] =
{-1024.0, -800.0, 176.0},
{-1024.0, -704.0, 176.0},
{-1024.0, -896.0, 192.0},
for(new b = 0; b < sizeof(looking) / 2; b++)
if(VectorEqual(vec,looking[b]))
entity_set_vector(ent,EV_VEC_origin,looking[b + 3]);
STATEMENT_FALLBACK(pfn_spawn,0,stpfnSpawn:Disabled)
if(!is_valid_ent(g_pServerVar[m_iEntid]) || !is_valid_ent(ent) || g_pServerVar[m_iEntid] != ent)
if(g_pServerVar[m_iEntid] != ent)
static Float:b_mins[coord_s],Float:b_maxs[coord_s],Float:b_origin[coord_s];
entity_get_vector(ent,EV_VEC_origin,b_origin);
entity_get_vector(ent,EV_VEC_mins,b_mins);
entity_get_vector(ent,EV_VEC_maxs,b_maxs);
engfunc(EngFunc_MessageBegin,MSG_BROADCAST,SVC_TEMPENTITY,b_origin);
engfunc(EngFunc_WriteCoord,(b_mins[x] += b_origin[x]));
engfunc(EngFunc_WriteCoord,(b_mins[y] += b_origin[y]));
engfunc(EngFunc_WriteCoord,(b_mins[z] += b_origin[z]));
engfunc(EngFunc_WriteCoord,(b_maxs[x] += b_origin[x]));
engfunc(EngFunc_WriteCoord,(b_maxs[y] += b_origin[y]));
engfunc(EngFunc_WriteCoord,(b_maxs[z] += b_origin[z]));
return entity_set_float(ent,EV_FL_nextthink,get_gametime() + 0.1);
STATEMENT_FALLBACK(pfnThink,0,stpfnThink:Disabled)
public pfnTouchWeaponBox(ent,id)
if(!is_valid_ent(ent) || !is_valid_ent(id)) // why do it?!
get_global_vector(GL_v_forward,velocity);
velocity[x] = -velocity[x] * STRONG_PUSH;
velocity[y] = -velocity[y] * STRONG_PUSH;
velocity[z] = -velocity[z] * STRONG_PUSH;
entity_set_vector(ent,EV_VEC_velocity,velocity);
STATEMENT_FALLBACK(pfnTouchWeaponBox,0,stMode:Disabled)
public pfnGetGameDescription()
if(g_pServerVar[m_iStatus] != status_s:box_close)
forward_return(FMV_STRING,g_pServerVar[m_szDescr]);
STATEMENT_FALLBACK(pfnGetGameDescription,0,stMode:Disabled)
if(!is_valid_ent(ent) || !IsUserAValid(id)) // why do it?!
static Float:currentTime;
currentTime = get_gametime();
if(currentTime > g_pServerVar[m_fWait][id])
g_pServerVar[m_fWait][id] = _:(currentTime + MESSAGE_TIMEWAIT);
return client_print_color(id,DontChange,"%L %L",id,"MODE_PREFIX",id,"MODE_MESSAGE_TOUCH");
STATEMENT_FALLBACK(pfnTouch,0,stMode:Disabled)
public cmdModeChange(id,level,cid)
if(!IsUserFlags(id,level))
if(!g_pServerVar[m_iNone])
return client_print_color(id,DontChange,"%L %L",id,"MODE_PREFIX",id,"MODE_NOT_USED");
if(g_pServerVar[m_iClose] != id)
if(is_user_connected(g_pServerVar[m_iClose]))
get_user_name(id,name,31);
return client_print_color(id,DontChange,"%L %L",id,"MODE_PREFIX",id,"MODE_ADMIN_BUSY_CHANGE",name);
switch(g_pServerVar[m_iBlocked])
case block_vote: return client_print_color(id,DontChange,"%L %L",id,"MODE_PREFIX",id,"MODE_VOTE");
case block_start_vote: return client_print_color(id,DontChange,"%L %L",id,"MODE_PREFIX",id,"MODE_START_VOTE");
case block_success_vote: return client_print_color(id,DontChange,"%L %L",id,"MODE_PREFIX",id,"MODE_WAIT_NEW_ROUND");
case block_admin_change: return client_print_color(id,DontChange,"%L %L",id,"MODE_PREFIX",id,"MODE_ADMIN_CHANGED",id,(g_pServerVar[m_iStatus] == status_s:box_close) ? "MODE_ADMIN_CLOSED" : "MODE_ADMIN_OPENED");
g_pServerVar[m_iBlocked] = blocked_s:block_admin_change;
g_pServerVar[m_fNext] = _:(get_gametime() + (VOTE_TIMEWAIT * 60.0));
g_pServerVar[m_iStatus] ^= status_s:box_close;
g_pServerVar[m_iClose] = (g_pServerVar[m_iStatus] == status_s:box_open) ? id : 0;
get_user_name(id,name,31);
for(new a = 1; a <= g_pServerVar[m_iMaxpl]; a++)
if(!is_user_connected(a) || !IsUserFlags(a,ADMIN_VOTE))
client_print_color(a,DontChange + id,"%L %L",a,"MODE_PREFIX",a,"MODE_ADMIN_CHANGED_ADMINS",name,a,(g_pServerVar[m_iStatus] == status_s:box_close) ? "MODE_ADMIN_CLOSED" : "MODE_ADMIN_OPENED");
if(!g_pServerVar[m_iNone])
return client_print_color(id,DontChange,"%L %L",id,"MODE_PREFIX",id,"MODE_NOT_USED");
switch(g_pServerVar[m_iBlocked])
case block_vote: return client_print_color(id,DontChange,"%L %L",id,"MODE_PREFIX",id,"MODE_VOTE");
case block_start_vote: return client_print_color(id,DontChange,"%L %L",id,"MODE_PREFIX",id,"MODE_START_VOTE");
case block_admin_change: return client_print_color(id,DontChange,"%L %L",id,"MODE_PREFIX",id,"MODE_ADMIN_CHANGED",id,(g_pServerVar[m_iStatus] == status_s:box_close) ? "MODE_ADMIN_CLOSED" : "MODE_ADMIN_OPENED");
new Float:flCurrent = get_gametime();
if(g_pServerVar[m_fNext] > flCurrent)
getChangeleft(id,floatround(g_pServerVar[m_fNext] - flCurrent),ibuf,63);
return client_print_color(id,DontChange,"%L %L",id,"MODE_PREFIX",id,"MODE_VOTE_LEFT",ibuf);
if(g_pServerVar[m_iVote][id])
client_print_color(id,DontChange,"%L %L",id,"MODE_PREFIX",id,"MODE_VOTE_ALREADY",g_pServerVar[m_iAll],num);
g_pServerVar[m_iVote][id] = 1;
get_user_name(id,name,31);
for(new a = 1; a <= g_pServerVar[m_iMaxpl]; a++)
if(!is_user_connected(a))
client_print_color(a,DontChange + id,"%L %L",id,"MODE_PREFIX",id,"MODE_VOTED",name,id,(g_pServerVar[m_iStatus] == status_s:box_close) ? "MODE_VOTE_OPENED" : "MODE_VOTE_CLOSED",g_pServerVar[m_iAll],num);
if(num <= g_pServerVar[m_iAll])
g_pServerVar[m_iCount] = MODE_COUNT_START;
g_pServerVar[m_iBlocked] = blocked_s:block_vote;
set_task(MODE_TIME_START,"taskidMenu",TASK_MODE_START);
client_print_color(0,DontChange,"%L %L",LANG_PLAYER,"MODE_PREFIX",LANG_PLAYER,"MODE_MESSAGE_VOTE_START",10);
if(0 < g_pServerVar[m_iCount]--)
num_to_word(g_pServerVar[m_iCount] + 1,speak,23);
client_cmd(0,"spk \"fvox/%s\"",speak);
formatex(menu,127,"%L",LANG_PLAYER,"MODE_VOTE_PRESTART_MENU",LANG_PLAYER,(g_pServerVar[m_iStatus] == status_s:box_close) ? "MODE_TITLE_OPENED" : "MODE_TITLE_CLOSED",g_pServerVar[m_iCount] + 1);
show_menu(0,0x3FF,menu,2,"Mode Menu");
set_task(1.0,"taskidMenu",TASK_MODE_START);
g_pServerVar[m_iBlocked] = 2;
formatex(menu,127,"%L",LANG_PLAYER,"MODE_VOTE_POSTSTART_MENU",LANG_PLAYER,(g_pServerVar[m_iStatus] == status_s:box_close) ? "MODE_TITLE_OPENED" : "MODE_TITLE_CLOSED");
set_task(20.0,"taskidResult",TASK_MODE_VOTE);
show_menu(0,0x3,menu,18,"Mode Menu");
if(g_pServerVar[m_iBlocked] == blocked_s:block_vote)
return client_cmd(id,"slot%d",key + 1);
get_user_name(id,name,31);
client_print_color(0,DontChange + id,"%L",id,"MODE_VOTE_FORMAT",name,id,key ? "MODE_VOTE_NO" : "MODE_VOTE_YES");
g_pServerVar[m_iVoting][key]++;
g_pServerVar[m_iAll] = 0;
g_pServerVar[m_fNext] = _:(get_gametime() + (VOTE_TIMEWAIT * 60.0));
for(new id = 1; id <= g_pServerVar[m_iMaxpl]; id++)
g_pServerVar[m_iVote][id] = 0;
if(g_pServerVar[m_iVoting][vote_no] > g_pServerVar[m_iVoting][vote_yes])
g_pServerVar[m_iBlocked] = blocked_s:block_success_vote;
g_pServerVar[m_iStatus] ^= status_s:box_close;
client_print_color(0,DontChange,"%L %L",LANG_PLAYER,"MODE_PREFIX",LANG_PLAYER,"MODE_VOTE_RESULT",
g_pServerVar[m_iVoting][vote_no],
g_pServerVar[m_iVoting][vote_yes],
g_pServerVar[m_iVoting][vote_no] + g_pServerVar[m_iVoting][vote_yes]);
client_print_color(0,DontChange,"%L %L",
LANG_PLAYER,"MODE_PREFIX",
LANG_PLAYER,"MODE_VOTE_SUCCESS",
LANG_PLAYER,(g_pServerVar[m_iStatus] == status_s:box_close) ? "MODE_RESULT_CLOSED" : "MODE_RESULT_OPENED");
else if(g_pServerVar[m_iVoting][vote_no] < g_pServerVar[m_iVoting][vote_yes])
g_pServerVar[m_iBlocked] = blocked_s:block_none;
client_print_color(0,DontChange,"%L %L",LANG_PLAYER,"MODE_PREFIX",LANG_PLAYER,"MODE_VOTE_RESULT",
g_pServerVar[m_iVoting][vote_no],
g_pServerVar[m_iVoting][vote_yes],
g_pServerVar[m_iVoting][vote_no] + g_pServerVar[m_iVoting][vote_yes]);
client_print_color(0,DontChange,"%L %L",LANG_PLAYER,"MODE_PREFIX",LANG_PLAYER,"MODE_VOTE_FAILED");
g_pServerVar[m_iBlocked] = blocked_s:block_none;
client_print_color(0,DontChange,"%L %L",LANG_PLAYER,"MODE_PREFIX",LANG_PLAYER,"MODE_VOTE_FAILED");
public cmdMenuBox(id,level,cid)
if(!IsUserFlags(id,level))
if(!g_pServerVar[m_iThink])
g_pServerVar[m_iThink] = register_think(CLASSNAME_WALL,"pfnThink");
return showMainEditMenu(id);
"%L",id,"MODE_DEV_MENU_MAIN",
g_pServerVar[m_iEntid] > 0 ? "\\d" : "\\w",
g_pServerVar[m_iBox] == 0 ? "\\d" : "\\w",
g_pServerVar[m_iBox] == 0 ? "\\d" : "\\w",
id,g_pServerVar[m_iEntid] == 0 ? "MODE_DEV_CHANGE" : "MODE_DEV_SAVE",
g_pServerVar[m_iEntid] == 0 ? "\\d" : "\\w",
(g_pServerVar[m_iBox] == 0 || g_pServerVar[m_iEntid] > 0) ? "\\d" : "\\w",
g_pServerVar[m_iCopy] == 0 ? "\\d" : "\\w",
(g_pServerVar[m_iBox] == 0 || g_pServerVar[m_iEntid] > 0) ? "\\d" : "\\w"
return show_menu(id,0x3FF,menu,-1,"Main Edit Menu");
public mainEditHandler(id,key)
if(g_pServerVar[m_iEntid] > 0)
client_print(id,print_center,"%L",id,"MODE_DEV_FAILED_5");
new Float:p_origin[coord_s],ent = createWall(.bParse = false);
entity_get_vector(id,EV_VEC_origin,p_origin);
g_pServerVar[m_iEntid] = ent;
state stpfnThink:Enabled;
entity_set_vector(ent,EV_VEC_origin,p_origin);
entity_set_vector(ent,EV_VEC_rendercolor,Vector(255.0,100.0,100.0));
get_user_aiming(id,ent,dummy);
entity_get_string(ent,EV_SZ_classname,classname,31);
if(equali(classname,CLASSNAME_WALL))
if(--g_pServerVar[m_iBox] < 0)
g_pServerVar[m_iBox] = 0;
if(g_pServerVar[m_iEntid] == ent)
g_pServerVar[m_iEntid] = 0;
client_print(id,print_center,"%L",id,"MODE_DEV_SUCCESS_1","SOLID_BBOX");
else client_print(id,print_center,"%L",id,"MODE_DEV_FAILED_1");
else if(is_valid_ent(g_pServerVar[m_iEntid]))
new ent = g_pServerVar[m_iEntid];
new Float:v_absmins[coord_s],Float:v_absmaxs[coord_s],Float:e_absmin[coord_s],Float:e_absmax[coord_s];
entity_get_vector(id,EV_VEC_absmin,v_absmins);
entity_get_vector(id,EV_VEC_absmax,v_absmaxs);
entity_get_vector(ent,EV_VEC_absmin,e_absmin);
entity_get_vector(ent,EV_VEC_absmax,e_absmax);
if(VectorDT(e_absmin,e_absmax,v_absmins,v_absmaxs))
g_pServerVar[m_iEntid] = 0;
client_print(id,print_center,"%L",id,"MODE_DEV_SUCCESS_1",(entity_get_int(ent,EV_INT_solid) == SOLID_NOT) ? "SOLID_NOT" : "SOLID_BBOX");
else client_print(id,print_center,"%L",id,"MODE_DEV_FAILED_1");
if(g_pServerVar[m_iEntid] == 0)
state stpfnThink:Disabled;
if(is_valid_ent(g_pServerVar[m_iEntid]))
state stpfnThink:Disabled;
entity_set_int(g_pServerVar[m_iEntid],EV_INT_solid,SOLID_BBOX);
entity_set_vector(g_pServerVar[m_iEntid],EV_VEC_rendercolor,Vector(0.0,0.0,0.0));
entity_set_size(g_pServerVar[m_iEntid],g_pServerBox[m_fMins],g_pServerBox[m_fMaxs]);
g_pServerVar[m_iEntid] = 0;
g_pServerVar[m_fScale] = _:0.250;
g_pServerBox[m_fMaxs][x] = 32.0;
g_pServerBox[m_fMaxs][y] = 32.0;
g_pServerBox[m_fMaxs][z] = 32.0;
g_pServerBox[m_fMins][x] = -32.0;
g_pServerBox[m_fMins][y] = -32.0;
g_pServerBox[m_fMins][z] = -32.0;
g_pServerBox[m_fOrigin][x] = 0.0;
g_pServerBox[m_fOrigin][y] = 0.0;
g_pServerBox[m_fOrigin][z] = 0.0;
g_pServerBox[m_fAngles][x] = 0.0;
g_pServerBox[m_fAngles][y] = 0.0;
g_pServerBox[m_fAngles][z] = 0.0;
client_print(id,print_center,"%L",id,"MODE_DEV_SUCCESS_4");
get_user_aiming(id,ent,body);
entity_get_string(ent,EV_SZ_classname,classname,31);
if(equali(classname,CLASSNAME_WALL))
state stpfnThink:Enabled;
g_pServerVar[m_iEntid] = ent;
entity_get_vector(ent,EV_VEC_mins,g_pServerBox[m_fMins]);
entity_get_vector(ent,EV_VEC_maxs,g_pServerBox[m_fMaxs]);
entity_get_vector(ent,EV_VEC_origin,g_pServerBox[m_fOrigin]);
entity_get_vector(ent,EV_VEC_angles,g_pServerBox[m_fAngles]);
g_pServerVar[m_fScale] = _:(entity_get_float(ent,EV_FL_scale));
entity_set_int(ent,EV_INT_solid,SOLID_NOT);
entity_set_float(ent,EV_FL_nextthink,get_gametime() + 0.1);
entity_set_vector(ent,EV_VEC_rendercolor,Vector(255.0,100.0,100.0));
entity_set_size(ent,g_pServerBox[m_fMins],g_pServerBox[m_fMaxs]);
client_print(id,print_center,"%L",id,"MODE_DEV_SUCCESS_5");
else client_print(id,print_center,"%L",id,"MODE_DEV_FAILED_1");
else client_print(id,print_center,"%L",id,"MODE_DEV_FAILED_1");
if(!g_pServerVar[m_iEntid])
client_print(id,print_center,"%L",id,"MODE_DEV_FAILED_4");
return showPropertiesMenu(id);
return showSettingsMenu(id);
if(g_pServerVar[m_iEntid] > 0)
client_print(id,print_center,"%L",id,"MODE_DEV_FAILED_5");
get_user_aiming(id,ent,dummy);
entity_get_string(ent,EV_SZ_classname,classname,31);
if(equali(classname,CLASSNAME_WALL))
if(g_pServerVar[m_iCopy] == ent)
client_print(id,print_center,"%L",id,"MODE_DEV_FAILED_2");
g_pServerVar[m_iCopy] = ent;
client_print(id,print_center,"%L",id,"MODE_DEV_SUCCESS_2");
else client_print(id,print_center,"%L",id,"MODE_DEV_FAILED_1");
else client_print(id,print_center,"%L",id,"MODE_DEV_FAILED_1");
if(g_pServerVar[m_iEntid] > 0)
client_print(id,print_center,"%L",id,"MODE_DEV_FAILED_5");
if(!is_valid_ent(g_pServerVar[m_iCopy]))
client_print(id,print_center,"%L",id,"MODE_DEV_FAILED_3");
new Float:p_origin[coord_s],ent = createWall(.bParse = false);
entity_get_vector(id,EV_VEC_origin,p_origin);
g_pServerVar[m_iEntid] = ent;
state stpfnThink:Enabled;
entity_get_vector(g_pServerVar[m_iCopy],EV_VEC_mins,g_pServerBox[m_fMins]);
entity_get_vector(g_pServerVar[m_iCopy],EV_VEC_maxs,g_pServerBox[m_fMaxs]);
entity_get_vector(g_pServerVar[m_iCopy],EV_VEC_angles,g_pServerBox[m_fAngles]);
g_pServerVar[m_fScale] = _:(entity_get_float(g_pServerVar[m_iCopy],EV_FL_scale));
g_pServerVar[m_iSprite] = floatround(entity_get_float(g_pServerVar[m_iCopy],EV_FL_frame));
entity_set_vector(ent,EV_VEC_origin,p_origin);
entity_set_vector(ent,EV_VEC_rendercolor,Vector(255.0,100.0,100.0));
entity_set_vector(ent,EV_VEC_mins,g_pServerBox[m_fMins]);
entity_set_vector(ent,EV_VEC_maxs,g_pServerBox[m_fMaxs]);
entity_set_vector(ent,EV_VEC_angles,g_pServerBox[m_fAngles]);
new iFlags = entity_get_int(g_pServerVar[m_iCopy],EV_INT_effects);
entity_set_int(ent,EV_INT_effects,iFlags);
entity_set_float(ent,EV_FL_scale,g_pServerVar[m_fScale]);
entity_set_float(ent,EV_FL_frame,float(g_pServerVar[m_iSprite]));
if(!g_pServerVar[m_iBox])
client_print(id,print_center,"%L",id,"MODE_DEV_FAILED_4");
else if(g_pServerVar[m_iEntid])
client_print(id,print_center,"%L",id,"MODE_DEV_FAILED_5");
return showMainEditMenu(id);
len = formatex(menu,511,"%L",id,"MODE_DEV_MENU_TITLE");
switch(g_pServerVar[m_iSetting])
new Float:iSize = (g_pServerVar[m_iType] == 0) ? 10.0 : (g_pServerVar[m_iType] == 1) ? 5.0 : (g_pServerVar[m_iType] == 2) ? 1.0 : 0.1;
len += formatex(menu[len],511 - len,"%L",id,"MODE_DEV_MENU_COORD",
g_pServerBox[m_fOrigin][x],
g_pServerBox[m_fOrigin][y],
g_pServerBox[m_fOrigin][z],iSize);
new Float:iSize = (g_pServerVar[m_iType] == 0) ? 45.0 : (g_pServerVar[m_iType] == 1) ? 15.0 : (g_pServerVar[m_iType] == 2) ? 1.0 : 0.5;
len += formatex(menu[len],511 - len,"%L",id,"MODE_DEV_MENU_ANGLES",
g_pServerBox[m_fAngles][x],
g_pServerBox[m_fAngles][y],
g_pServerBox[m_fAngles][z],iSize);
new Float:iSize = (g_pServerVar[m_iType] == 0) ? 10.0 : (g_pServerVar[m_iType] == 1) ? 5.0 : (g_pServerVar[m_iType] == 2) ? 1.0 : 0.5;
len += formatex(menu[len],511 - len,"%L",id,"MODE_DEV_MENU_SIZE",
g_pServerBox[m_fMins][x],
g_pServerBox[m_fMins][y],
g_pServerBox[m_fMins][z],
g_pServerBox[m_fMaxs][x],
g_pServerBox[m_fMaxs][y],
g_pServerBox[m_fMaxs][z],iSize);
new Float:iSize = ((g_pServerVar[m_iType] == 0) ? 0.5 : (g_pServerVar[m_iType] == 1) ? 0.1 : (g_pServerVar[m_iType] == 2) ? 0.0101 : 0.0051);
switch(g_pServerVar[m_iType])
len += formatex(menu[len],511 - len,"%L",id,"MODE_DEV_MENU_SCALE_1",
g_pServerVar[m_fScale],iSize,iSize,iSize);
len += formatex(menu[len],511 - len,"%L",id,"MODE_DEV_MENU_SCALE_2",
g_pServerVar[m_fScale],iSize,iSize,iSize);
len += formatex(menu[len],511 - len,"%L",id,"MODE_DEV_MENU_SCALE_3",
g_pServerVar[m_fScale],iSize,iSize,iSize);
formatex(menu[len],511 - len,"%L",id,"MODE_DEV_MENU_ADDON",id,
(g_pServerVar[m_iSetting] == 0) ?
(g_pServerVar[m_iSetting] == 1) ?
(g_pServerVar[m_iSetting] == 2 && g_pServerVar[m_bAdvanced]) ?
(g_pServerVar[m_iSetting] == 3 && g_pServerVar[m_bAdvanced]) ?
(g_pServerVar[m_iSetting] == 3) ?
id,(g_pServerVar[m_iSprite] == 0) ?
(g_pServerVar[m_iSprite] == 1) ?
return show_menu(id,(g_pServerVar[m_iSetting] < 4) ? 0x3FF : 0x3C3,menu,-1,"Properties Menu");
public propertiesHandler(id,key)
return showMainEditMenu(id);
entity_get_vector(g_pServerVar[m_iEntid],EV_VEC_origin,g_pServerBox[m_fOrigin]);
entity_get_vector(g_pServerVar[m_iEntid],EV_VEC_angles,g_pServerBox[m_fAngles]);
entity_get_vector(g_pServerVar[m_iEntid],EV_VEC_maxs,g_pServerBox[m_fMaxs]);
g_pServerVar[m_fScale] = _:(entity_get_float(g_pServerVar[m_iEntid],EV_FL_scale));
switch(g_pServerVar[m_iSetting])
new Float:iSize = (g_pServerVar[m_iType] == 0) ? 10.0 : (g_pServerVar[m_iType] == 1) ? 5.0 : (g_pServerVar[m_iType] == 2) ? 1.0 : 0.1;
case 0: g_pServerBox[m_fOrigin][x] += iSize;
case 1: g_pServerBox[m_fOrigin][y] += iSize;
case 2: g_pServerBox[m_fOrigin][z] += iSize;
case 3: g_pServerBox[m_fOrigin][x] -= iSize;
case 4: g_pServerBox[m_fOrigin][y] -= iSize;
case 5: g_pServerBox[m_fOrigin][z] -= iSize;
if(++g_pServerVar[m_iType] > 3)
g_pServerVar[m_iType] = 0;
if(++g_pServerVar[m_iSetting] > 4)
g_pServerVar[m_iSetting] = 0;
g_pServerVar[m_iSetting] = (g_pServerVar[m_iSprite] > 1 && g_pServerVar[m_iSetting] == 1) ? 2 + ((g_pServerVar[m_bAdvanced] == false) ? 1 : 0) : g_pServerVar[m_iSetting];
new Float:iSize = (g_pServerVar[m_iType] == 0) ? 45.0 : (g_pServerVar[m_iType] == 1) ? 15.0 : (g_pServerVar[m_iType] == 2) ? 1.0 : 0.5;
case 0: g_pServerBox[m_fAngles][x] += iSize;
case 1: g_pServerBox[m_fAngles][y] += iSize;
case 2: g_pServerBox[m_fAngles][z] += iSize;
case 3: g_pServerBox[m_fAngles][x] -= iSize;
case 4: g_pServerBox[m_fAngles][y] -= iSize;
case 5: g_pServerBox[m_fAngles][z] -= iSize;
if(++g_pServerVar[m_iType] > 3)
g_pServerVar[m_iType] = 0;
if(++g_pServerVar[m_iSetting] > 4)
g_pServerVar[m_iSetting] = 0;
g_pServerVar[m_iSetting] = (g_pServerVar[m_iSetting] == 2 && g_pServerVar[m_bAdvanced] == false) ? 3 : g_pServerVar[m_iSetting];
new Float:iSize = (g_pServerVar[m_iType] == 0) ? 10.0 : (g_pServerVar[m_iType] == 1) ? 5.0 : (g_pServerVar[m_iType] == 2) ? 1.0 : 0.5;
case 0: g_pServerBox[m_fMins][x] -= iSize;
case 1: g_pServerBox[m_fMins][y] -= iSize;
case 2: g_pServerBox[m_fMins][z] -= iSize;
case 3: g_pServerBox[m_fMins][x] += iSize;
case 4: g_pServerBox[m_fMins][y] += iSize;
case 5: g_pServerBox[m_fMins][z] += iSize;
if(++g_pServerVar[m_iType] > 3)
g_pServerVar[m_iType] = 0;
if(++g_pServerVar[m_iSetting] > 4)
g_pServerVar[m_iSetting] = 0;
new Float:iSize = (g_pServerVar[m_iType] == 0) ? 10.0 : (g_pServerVar[m_iType] == 1) ? 5.0 : (g_pServerVar[m_iType] == 2) ? 1.0 : 0.5;
case 0: g_pServerBox[m_fMaxs][x] += iSize;
case 1: g_pServerBox[m_fMaxs][y] += iSize;
case 2: g_pServerBox[m_fMaxs][z] += iSize;
case 3: g_pServerBox[m_fMaxs][x] -= iSize;
case 4: g_pServerBox[m_fMaxs][y] -= iSize;
case 5: g_pServerBox[m_fMaxs][z] -= iSize;
if(++g_pServerVar[m_iType] > 3)
g_pServerVar[m_iType] = 0;
if(++g_pServerVar[m_iSetting] > 4)
g_pServerVar[m_iSetting] = 0;
g_pServerVar[m_iSetting] = (g_pServerVar[m_iSprite] > 1 && g_pServerVar[m_iSetting] == 4) ? 0 : g_pServerVar[m_iSetting];
new Float:iSize = (g_pServerVar[m_iType] == 0) ? 0.5 : (g_pServerVar[m_iType] == 1) ? 0.1 : (g_pServerVar[m_iType] == 2) ? 0.0101 : 0.0051;
if(iSize > g_pServerVar[m_fScale])
if(++g_pServerVar[m_iType] > 3)
g_pServerVar[m_iType] = 0;
iSize = (g_pServerVar[m_iType] == 0) ? 0.5 : (g_pServerVar[m_iType] == 1) ? 0.1 : (g_pServerVar[m_iType] == 2) ? 0.0101 : 0.0051;
case 0: g_pServerVar[m_fScale] += iSize;
case 1: g_pServerVar[m_fScale] -= iSize;
if(++g_pServerVar[m_iType] > 3)
g_pServerVar[m_iType] = 0;
if(++g_pServerVar[m_iSetting] > 4)
g_pServerVar[m_iSetting] = 0;
if(is_valid_ent(g_pServerVar[m_iEntid]))
if(++g_pServerVar[m_iSprite] > 2)
g_pServerVar[m_iSprite] = 0;
new iFlags = entity_get_int(g_pServerVar[m_iEntid],EV_INT_effects);
if(g_pServerVar[m_iSprite] > 1)
entity_set_int(g_pServerVar[m_iEntid],EV_INT_effects,iFlags|EF_NODRAW);
entity_set_int(g_pServerVar[m_iEntid],EV_INT_effects,iFlags&~EF_NODRAW);
entity_set_float(g_pServerVar[m_iEntid],EV_FL_frame,float(g_pServerVar[m_iSprite]));
if(g_pServerVar[m_fScale] < 0.0051)
g_pServerVar[m_fScale] = _:0.0051;
if(g_pServerVar[m_bAdvanced])
if(g_pServerBox[m_fMins][x] > 0.0)
g_pServerBox[m_fMins][x] = 0.0;
else if(g_pServerBox[m_fMins][y] > 0.0)
g_pServerBox[m_fMins][y] = 0.0;
else if(g_pServerBox[m_fMins][z] > 0.0)
g_pServerBox[m_fMins][z] = 0.0;
if(g_pServerBox[m_fMaxs][x] < 0.0)
g_pServerBox[m_fMaxs][x] = 0.0;
else if(g_pServerBox[m_fMaxs][y] < 0.0)
g_pServerBox[m_fMaxs][y] = 0.0;
else if(g_pServerBox[m_fMaxs][z] < 0.0)
g_pServerBox[m_fMaxs][z] = 0.0;
if(g_pServerBox[m_fMaxs][x] < 1.0)
g_pServerBox[m_fMaxs][x] = 1.0;
else if(g_pServerBox[m_fMaxs][y] < 1.0)
g_pServerBox[m_fMaxs][y] = 1.0;
else if(g_pServerBox[m_fMaxs][z] < 1.0)
g_pServerBox[m_fMaxs][z] = 1.0;
if(g_pServerBox[m_fAngles][x] >= 360.0 || g_pServerBox[m_fAngles][x] <= -360.0)
g_pServerBox[m_fAngles][x] = 0.0;
if(g_pServerBox[m_fAngles][y] >= 360.0 || g_pServerBox[m_fAngles][y] <= -360.0)
g_pServerBox[m_fAngles][y] = 0.0;
if(g_pServerBox[m_fAngles][z] >= 360.0 || g_pServerBox[m_fAngles][z] <= -360.0)
g_pServerBox[m_fAngles][z] = 0.0;
if(!g_pServerVar[m_bAdvanced])
g_pServerBox[m_fMins][x] = -g_pServerBox[m_fMaxs][x];
g_pServerBox[m_fMins][y] = -g_pServerBox[m_fMaxs][y];
g_pServerBox[m_fMins][z] = -g_pServerBox[m_fMaxs][z];
entity_set_float(g_pServerVar[m_iEntid],EV_FL_scale,g_pServerVar[m_fScale]);
entity_set_vector(g_pServerVar[m_iEntid],EV_VEC_angles,g_pServerBox[m_fAngles]);
entity_set_float(g_pServerVar[m_iEntid],EV_FL_nextthink,get_gametime() + 0.1);
entity_set_int(g_pServerVar[m_iEntid],EV_INT_solid,g_pServerVar[m_iSolid] ? SOLID_BBOX : SOLID_NOT);
entity_set_size(g_pServerVar[m_iEntid],g_pServerBox[m_fMins],g_pServerBox[m_fMaxs]);
entity_set_vector(g_pServerVar[m_iEntid],EV_VEC_origin,g_pServerBox[m_fOrigin]);
return showPropertiesMenu(id);
formatex(menu,511,"%L",id,"MODE_DEV_MENU_CONFIG",
id,g_pServerVar[m_iEntid] == 0 ? "MODE_DEV_SOLID" : "MODE_DEV_SOLID_D",
g_pServerVar[m_iSolid] ? "SOLID_BBOX" : "SOLID_NOT",
g_pServerVar[m_iBox] == 0 ? "\\d" : "\\w",
id,(g_pServerVar[m_iStatus] == status_s:box_close) ? "MODE_DEV_HIDE" : "MODE_DEV_SHOW",
id,entity_get_int(id,EV_INT_movetype) == MOVETYPE_NOCLIP ? "MODE_DEV_YES" : "MODE_DEV_NO",
id,g_pServerVar[m_bAdvanced] ? "MODE_DEV_YES" : "MODE_DEV_NO"
return show_menu(id,MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_0,menu,-1,"Setting Menu");
public settingHandler(id,key)
if(!g_pServerVar[m_iEntid])
client_print(id,print_center,"%L",id,"MODE_DEV_FAILED_4");
entity_set_float(g_pServerVar[m_iEntid],EV_FL_nextthink,get_gametime() + 0.1);
entity_set_int(g_pServerVar[m_iEntid],EV_INT_solid,(g_pServerVar[m_iSolid] ^= 1) ? SOLID_BBOX : SOLID_NOT);
entity_set_size(g_pServerVar[m_iEntid],g_pServerBox[m_fMins],g_pServerBox[m_fMaxs]);
client_print(id,print_center,"%L",id,"MODE_DEV_SUCCESS_6",g_pServerVar[m_iSolid] ? "SOLID_BBOX" : "SOLID_NOT");
showBoxDeveloper((g_pServerVar[m_iStatus] ^= status_s:box_close));
if(++g_pServerVar[m_iOnline] > g_pServerVar[m_iMaxpl])
g_pServerVar[m_iOnline] = 0;
entity_set_int(id,EV_INT_movetype,(entity_get_int(id,EV_INT_movetype) == MOVETYPE_NOCLIP) ? MOVETYPE_WALK : MOVETYPE_NOCLIP);
case 4: g_pServerVar[m_bAdvanced] ^= true;
case 9: return showMainEditMenu(id);
return showSettingsMenu(id);
getChangeleft(id,time,output[],len)
new minute = 0,second = 0;
new ibuf[2][33],ending[22],num = -1;
getEnding(minute,"MODE_MINUT","MODE_MINUTE","MODE_MINUTES",21,ending);
formatex(ibuf[++num],32,"%i %L",minute,id,ending);
getEnding(second,"MODE_SECOND","MODE_SECUNDE","MODE_SECONDS",21,ending);
formatex(ibuf[++num],32,"%i %L",second,id,ending);
case 0: formatex(output,len,"%s",ibuf[0]);
case 1: formatex(output,len,"%L",id,"MODE_AND",ibuf[0],ibuf[1]);
else formatex(output,len,"0 %L",id,"MODE_SECOND");
getEnding(num,const a[],const b[],const c[],lenght,output[])
new num100 = num % 100,num10 = num % 10,ibuf[22];
if(num100 >= 5 && num100 <= 20 || num10 == 0 || num10 >= 5 && num10 <= 9)
else if(num10 >= 2 && num10 <= 4)
return formatex(output,lenght,"%s",ibuf);
if(file_exists(g_pServerVar[m_szFile]))
delete_file(g_pServerVar[m_szFile]);
new ibuf[1024],Float:frame,Float:p_origin[coord_s],Float:p_angles[coord_s],Float:p_mins[coord_s],Float:p_maxs[coord_s],Float:p_scale,p_sprite,count,ent = -1;
formatex(ibuf,1023,"ONLINE=%d",g_pServerVar[m_iOnline]);
write_file(g_pServerVar[m_szFile],ibuf,0);
while((ent = find_ent_by_class(ent,CLASSNAME_WALL)))
if(g_pServerVar[m_iEntid] == ent)
entity_get_vector(ent,EV_VEC_origin,p_origin);
entity_get_vector(ent,EV_VEC_angles,p_angles);
entity_get_vector(ent,EV_VEC_mins,p_mins);
entity_get_vector(ent,EV_VEC_maxs,p_maxs);
p_scale = entity_get_float(ent,EV_FL_scale);
frame = entity_get_float(ent,EV_FL_frame);
p_sprite = floatround(frame);
formatex(ibuf,1023,"\"%f\" \"%f\" \"%f\" \"%f\" \"%f\" \"%f\" \"%f\" \"%f\" \"%f\" \"%f\" \"%f\" \"%f\" \"%f\" \"%d\"",p_origin[x],p_origin[y],p_origin[z],p_angles[x],p_angles[y],p_angles[z],p_mins[x],p_mins[y],p_mins[z],p_maxs[x],p_maxs[y],p_maxs[z],p_scale,p_sprite);
write_file(g_pServerVar[m_szFile],ibuf,-1);
client_print(id,print_center,"%L",id,"MODE_DEV_SUCCESS_3");
new ibuf[2048],key[32],value[32],p_origin[coord_s][6],p_angles[coord_s][6],p_mins[coord_s][6],p_maxs[coord_s][6],p_scale[6],p_sprite[6];
new file = fopen(g_pServerVar[m_szFile],"r");
if(!ibuf[0] || ibuf[0] == ';')
strtok(ibuf,key,31,value,31,'=');
g_pServerVar[m_iOnline] = str_to_num(value);
g_pServerBox[m_fOrigin][x] = str_to_float(p_origin[x]);
g_pServerBox[m_fOrigin][y] = str_to_float(p_origin[y]);
g_pServerBox[m_fOrigin][z] = str_to_float(p_origin[z]);
g_pServerBox[m_fAngles][x] = str_to_float(p_angles[x]);
g_pServerBox[m_fAngles][y] = str_to_float(p_angles[y]);
g_pServerBox[m_fAngles][z] = str_to_float(p_angles[z]);
g_pServerBox[m_fMins][x] = str_to_float(p_mins[x]);
g_pServerBox[m_fMins][y] = str_to_float(p_mins[y]);
g_pServerBox[m_fMins][z] = str_to_float(p_mins[z]);
g_pServerBox[m_fMaxs][x] = str_to_float(p_maxs[x]);
g_pServerBox[m_fMaxs][y] = str_to_float(p_maxs[y]);
g_pServerBox[m_fMaxs][z] = str_to_float(p_maxs[z]);
g_pServerVar[m_fScale] = _:(str_to_float(p_scale));
g_pServerVar[m_iSprite] = str_to_num(p_sprite);
createWall(.bParse = true);
for(new index = 1; index <= g_pServerVar[m_iMaxpl]; index++)
if(!is_user_connected(index) || !IsUserTeam(index))
showBoxDeveloper(status_s:st)
while((iEnt = find_ent_by_class(iEnt,CLASSNAME_WALL)))
entity_set_int(iEnt,EV_INT_solid,st == status_s:box_close ? SOLID_BBOX : SOLID_NOT);
if(g_pServerVar[m_iEntid] == iEnt || entity_get_float(iEnt,EV_FL_frame) > 1.0)
iFlags = entity_get_int(iEnt,EV_INT_effects);
entity_set_int(iEnt,EV_INT_effects,st == status_s:box_close ? iFlags &~ EF_NODRAW : iFlags|EF_NODRAW);
showBox(status_s:st,bool:bShow)
while((iEnt = find_ent_by_class(iEnt,CLASSNAME_WALL)))
entity_set_int(iEnt,EV_INT_solid,st == status_s:box_close ? SOLID_BBOX : SOLID_NOT);
if(entity_get_float(iEnt,EV_FL_frame) > 1)
iFlags = entity_get_int(iEnt,EV_INT_effects);
entity_set_int(iEnt,EV_INT_effects,st == status_s:box_close ? iFlags &~ EF_NODRAW : iFlags|EF_NODRAW);
set_dhudmessage(COLOR_MAP_OPEN,MESSAGE_MAP_STATUS,2,0.1,2.0,0.05,0.2);
show_dhudmessage(0,"%L",LANG_PLAYER,"MODE_MESSAGE_MAP_OPENED");
set_dhudmessage(COLOR_MAP_CLOSE,MESSAGE_MAP_STATUS,2,0.1,2.0,0.05,0.2);
show_dhudmessage(0,"%L",LANG_PLAYER,"MODE_MESSAGE_MAP_CLOSED");
new ent = create_entity("func_wall");
entity_set_string(ent,EV_SZ_classname,CLASSNAME_WALL);
entity_set_int(ent,EV_INT_movetype,MOVETYPE_FLY);
entity_set_model(ent,SPRITE_WALL);
entity_set_size(ent,g_pServerBox[m_fMins],g_pServerBox[m_fMaxs]);
entity_set_float(ent,EV_FL_scale,g_pServerVar[m_fScale]);
entity_set_vector(ent,EV_VEC_angles,g_pServerBox[m_fAngles]);
entity_set_int(ent,EV_INT_solid,SOLID_BBOX);
if(g_pServerVar[m_iSprite] > 1)
entity_set_int(ent,EV_INT_effects,entity_get_int(ent,EV_INT_effects)|EF_NODRAW);
entity_set_float(ent,EV_FL_frame,float(g_pServerVar[m_iSprite]));
entity_set_int(ent,EV_INT_rendermode,kRenderTransAdd);
entity_set_float(ent,EV_FL_renderamt,175.0);
entity_set_vector(ent,EV_VEC_origin,g_pServerBox[m_fOrigin]);
g_pServerBox[m_fAngles][x] = 0.0;
g_pServerBox[m_fAngles][y] = 0.0;
g_pServerBox[m_fAngles][z] = 0.0;
g_pServerBox[m_fMaxs][x] = 32.0;
g_pServerBox[m_fMaxs][y] = 32.0;
g_pServerBox[m_fMaxs][z] = 32.0;
g_pServerBox[m_fMins][x] = -32.0;
g_pServerBox[m_fMins][y] = -32.0;
g_pServerBox[m_fMins][z] = -32.0;
g_pServerVar[m_fScale] = _:0.250;
entity_set_model(ent,SPRITE_WALL);
entity_set_size(ent,g_pServerBox[m_fMins],g_pServerBox[m_fMaxs]);
entity_set_float(ent,EV_FL_scale,g_pServerVar[m_fScale]);
entity_set_vector(ent,EV_VEC_angles,g_pServerBox[m_fAngles]);
entity_set_int(ent,EV_INT_solid,SOLID_NOT);
entity_set_float(ent,EV_FL_frame,float(g_pServerVar[m_iSprite]));
entity_set_int(ent,EV_INT_rendermode,kRenderTransAdd);
entity_set_float(ent,EV_FL_renderamt,175.0);
entity_set_float(ent,EV_FL_nextthink,get_gametime() + 0.1);