Ошибка в плагине [ZL] CoreFunction (Alexander.3)

Сообщения
81
Реакции
24
Ошибка
L 02/22/2020 - 21:32:12: Start of error session.
L 02/22/2020 - 21:32:12: Info (map "$2000$") (file "addons/amxmodx/logs/error_20200222.log")
L 02/22/2020 - 21:32:12: [AMXX] Displaying debug trace (plugin "zl_core.amxx", version "2.0.2")
L 02/22/2020 - 21:32:12: [AMXX] Run time error 11: divide
L 02/22/2020 - 21:32:12: [AMXX] [0] zl_core.sma::zl_vote_count (line 408)
L 02/22/2020 - 21:32:12: [AMXX] [1] zl_core.sma::formatex_title (line 403)
L 02/22/2020 - 21:32:12: [AMXX] [2] zl_core.sma::vote_menu (line 148)
ОС
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.693-dev
Build date: 18:20:58 Jan 28 2020 (2117)
Build from: https://github.com/dreamstalker/rehlds/commit/c4cecf5
ReGamedll
ReGameDLL version: 5.14.0.454-dev+m
Build date: 17:39:55 Feb 19 2020
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/05cf0f7
Версия 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
Список метамодулей
description      stat pend  file                        vers             src  load  unload
[ 1] VoiceTranscoder RUN - vtc.so v2017RC5 ini ANY ANY
[ 2] AMX Mod X RUN - amxmodx_mm_i386.so v1.9.0.5263 ini Start ANY
[ 3] Reunion RUN - reunion_mm_i386.so v0.1.0.92 ini Start Never
[ 4] ReSemiclip RUN - resemiclip_mm_i386.so v2.3.9 ini Chlvl ANY
[ 5] ReAuthCheck RUN - reauthcheck_mm_i386.so v0.1.6 ini Start Never
[ 6] WHBlocker RUN - whblocker_mm_i386.so v1.5.696 ini Chlvl ANY
[ 7] Rechecker RUN - rechecker_mm_i386.so v2.5 ini Chlvl ANY
[ 8] ReSRDetector RUN - resrdetector_mm_i386.so v0.1.0 ini Chlvl ANY
[ 9] Fun RUN - fun_amxx_i386.so v1.9.0.5263 pl2 ANY ANY
[10] CStrike RUN - cstrike_amxx_i386.so v1.9.0.5263 pl2 ANY ANY
[11] CSX RUN - csx_amxx_i386.so v1.9.0.5263 pl2 ANY ANY
[12] Engine RUN - engine_amxx_i386.so v1.9.0.5263 pl2 ANY ANY
[13] FakeMeta RUN - fakemeta_amxx_i386.so v1.9.0.5263 pl2 ANY ANY
[14] GeoIP RUN - geoip_amxx_i386.so v1.9.0.5263 pl2 ANY ANY
[15] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.9.0.5263 pl2 ANY ANY
[16] MySQL RUN - mysql_amxx_i386.so v1.9.0.5263 pl2 ANY ANY
[17] SQLite RUN - sqlite_amxx_i386.so v1.9.0.5263 pl2 ANY ANY
[18] VTC AMXX API RUN - VtcApi_amxx_i386.so v2017 RC2 pl2 ANY ANY
[19] ReAPI RUN - reapi_amxx_i386.so v5.12.0.192-dev pl2 ANY Never
[20] ReAimDetector RUN - reaimdetector_amxx_i386.so v0.2.2 pl2 ANY Never
20 plugins, 20 running
Список плагинов
name                    version     author            file             status   
[ 1] [190] AMXBans RBS 19.11.29 SKAJIbnEJIb & La amxbans_rbs.amx running
[ 2] [190] Cvar On Map 19.12.07 SKAJIbnEJIb cvar_on_map.amx running
[ 3] ReAimDetector API 0.2.2 ReHLDS Team reaimdetector.a running
[ 4] [190] Ultimate Weapons 19.11.29 SKAJIbnEJIb ultimate_weapon running
[ 5] Voteban CSR 0.8.5beta Leo_[BH] csr_voteban.amx running
[ 6] [183] MapChooser RBS 18.10.05 SKAJIbnEJIb & UF mapchooser_rbs. running
[ 7] [183] NextMap 18.09.25 SKAJIbnEJIb & AM nextmap.amxx running
[ 8] [183] TimeLeft 18.09.25 SKAJIbnEJIb & AM timeleft.amxx running
[ 9] HLDS Weapon FIX 1.1 [WPMG]PRoSToTeM@ hldsweaponfix.a running
[ 10] [183] Skill ELO 19.09.06 SKAJIbnEJIb skill_elo.amxx running
[ 11] Menus Front-End 18.12.18 AMXX Dev Team & amxmodmenu_rbs. running
[ 12] [190] AdminCmd RBS 19.11.29 SKAJIbnEJIb & AM admincmd_rbs.am running
[ 13] Commands Menu 1.9.0.5263 AMXX Dev Team cmdmenu.amxx running
[ 14] [183] MapsMenu RBS 19.09.01 SKAJIbnEJIb & AM mapsmenu_rbs.am running
[ 15] Admin Chat 1.9.0.5263 AMXX Dev Team adminchat.amxx running
[ 16] Scrolling Message 1.9.0.5263 AMXX Dev Team scrollmsg.amxx running
[ 17] Info. Messages 1.9.0.5263 AMXX Dev Team imessage.amxx running
[ 18] CS Misc. Stats 1.9.0.5263 AMXX Dev Team miscstats.amxx running
[ 19] MultiJump 1.1 twistedeuphoria multijump.amxx running
[ 20] AMXX Gag 1.3 xPaw & Exolent gagmenu.amxx running
[ 21] [190] BonusMenu RBS 19.12.09 SKAJIbnEJIb bonusmenu_rbs.a running
[ 22] [190] Army Ranks Ultim 19.11.29 SKAJIbnEJIb army_ranks_ulti running
[ 23] [190] Chat RBS 19.12.23 SKAJIbnEJIb chat_rbs.amxx running
[ 24] [183] Chat Addons 19.08.01 SKAJIbnEJIb chat_addons.amx running
[ 25] [183] Stats Configurat 18.05.15 SKAJIbnEJIb & AM statscfg_rbs.am running
[ 26] [183] StatsX RBS 19.08.28 SKAJIbnEJIb & AM statsx_rbs.amxx running
[ 27] [183] CsStats MySQL 19.08.27 SKAJIbnEJIb csstats_mysql.a running
[ 28] [183] AR Vampire 17.08.22 SKAJIbnEJIb ar_vampire.amxx running
[ 29] [183] No Team Flash 19.10.03 SKAJIbnEJIb NoTeamFlash.amx running
[ 30] [183] Ultimate Flags 19.10.30 SKAJIbnEJIb ultimate_flags. running
[ 31] [183] Stimulation RBS 19.11.02 SKAJIbnEJIb stimulation_rbs running
[ 32] [183] BonusTime RBS 18.10.10 SKAJIbnEJIb bonustime_rbs.a running
[ 33] [183] Top Award RBS 19.08.28 SKAJIbnEJIb topaward_rbs.am running
[ 34] [183] AC Spectator ESP 17.08.09 SKAJIbnEJIb & Ko ac_esp.amxx running
[ 35] Autoresponder/Advertis 0.5 MaximusBrood ad_manager.amxx running
[ 36] [183] Damager RBS 19.08.30 SKAJIbnEJIb damager_rbs.amx running
[ 37] [183] CsStats ResetSco 18.03.24 SKAJIbnEJIb csstats_resetsc running
[ 38] Admin Check 1.51 OneEyed admin_check.amx running
[ 39] Chat Colour Menu 2.0 host-v.ru colourmenu.amxx running
[ 40] Ultimate Sounds 1.7 Dizzy / Bmann_42 ultimate_sounds running
[ 41] Hide 'Fire in the hole 1.1 xPaw & SKAJIbnEJ hide_fith.amxx running
[ 42] [183] Parachute RBS 17.12.12 KRoT@L/JTP10181 parachute_rbs.a running
[ 43] Weapons MaxClip 0.3.0 ConnorMcLeod weapons_maxclip running
[ 44] Smoke FIX 0.1 many Smoke_FIX.amxx running
[ 45] Silly C4 1.1 Cheap_Suit sillyc4.amxx running
[ 46] [183] Screen Player 19.11.04 SKAJIbnEJIb screen_player.a running
[ 47] Weaponmenu 1.0 UNREAL weaponmenu_new. running
[ 48] GHW Auto Message Displ 2.1 GHW_Chronic reklama.amxx running
[ 49] Bomb Timer 3.2 Twe3k plent_bomb.amxx running
[ 50] [190] AfkKicker RBS 19.12.23BE SKAJIbnEJIb afkkicker_rbs.a running
[ 51] [183] Ultimate Knife 19.11.12 SKAJIbnEJIb ultimate_knife. running
[ 52] Map Spawns Editor 1.0.16 iG_os Map_Spawns_Edit running
[ 53] MultiManager Fix 1.5 Asmodai & UFPS.T multimanager_fi running
[ 54] Auto recording demo 2.0 IzI | Bonaqua (R amx_autodemorec running
[ 55] Permanent message 1.1 He3aBuCuM permanent_messa running
[ 56] [183] SlayLosers RBS 19.09.02 SKAJIbnEJIb & d3 slaylosers_rbs. running
[ 57] [183] VoteRR RBS 17.08.11 kalash1k & SKAJI voterr_rbs.amxx running
[ 58] [183] Spect Bot 17.08.28 SKAJIbnEJIb & Bo SpectBot.amxx running
[ 59] [ReAPI] IDEAL VIP 1.4.6 host-v.ru VIP.amxx running
[ 60] Join_Music 1.2.3 White Panther join.amxx running
[ 61] Mode 2x2 2.5re s1lent mode.amxx running
[ 62] ComboSprites 0.5 Chrescoe1 combo_sprtes.am running
[ 63] Death Sprite 1.0 DarkGL skull.amxx running
[ 64] Flashbang Dynamic Ligh 0.21 Avalanche flashbang_dligh running
[ 65] Kill Effect 0.2 neugomon kill_effect.amx running
[ 66] [183] Servers List 17.10.30 Sho0ter & SKAJIb servers_list.am running
[ 67] Slots Reservation 1.9.0.5263 AMXX Dev Team adminslots.amxx running
[ 68] Team Grenade Trail 1.2 Numb grenadetrail.am running
[ 69] Colors Menu 1.5 host-v.ru color.amxx running
[ 70] [DD] Quick defuse 1.0 Deadly|Darkness dd_qdefuse.amxx running
[ 71] Snowball 0.6 alpha s1lent snowball.amxx running
[ 72] [ZL] CoreFunction 3.0.0 host-v.ru zl_core.amxx debug
[ 73] ScorpionBoss 1.0.1 Alexander.3 zl_boss_scorpio stopped
73 plugins, 72 running
Автор плагина
Alexander.3
Версия плагина
2.0.2
Исходный код
#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >
#include < nvault >
#include < cstrike >

#define PLUGIN "[ZL] CoreFunction"
#define VERSION "2.0.2"
#define AUTHOR "Alexander.3"

/* ALL SETTING */
#define CMD_BOSS "say /boss"

/* Macro */
//#define MAPCHOOSER
//#define DEBUG

/* MAP SETTING */
#define MAP_ALIEN "zl_boss_alien"
#define MAP_APACHE "zl_boss_apache"
#define MAP_OBERON "zl_boss_oberon_v2"
#define MAP_REVENANT "zl_boss_revenant"
#define MAP_ANGRA "zl_boss_angra"
#define MAP_ENVYMASK "megaololo"
#define MAP_ILLIDAN "zl_boss_illidan_alpha"
#define MAP_SCORPION "zl_boss_scorpion_alpha"

#define MAP_P_REVENANT "zl_boss_p_revenant_alpha"


////////////////////////
/*------- CODE -------*/
/*---- DONT CHANGE ---*/
////////////////////////
#define m_iId 43
#define m_iPrimaryAmmoType 49
#define m_iPlayerTeam 114
#define m_iNumRespawns 365
#define m_pActiveItem 373
#define m_rgAmmoCBasePlayer 376
#define b_mNum 10
#define b_bmin 1
#define b_bmax 2
#define v_name "boss_time"
#define f_config "zl_core.ini"

#if defined MAPCHOOSER
native zl_vote_start()
#endif

/* global */
static g_PlayerCount, g_MaxPlayer, g_timer_forward, g_blood[2],
g_cvar[4], Float:g_fcvar, g_cfg_cvar[3], Float:g_cfg_fcvar,
g_cfg_szmap[24]

/* vote */
static bool:g_vote_true, g_voteid[33], g_vote[b_mNum], g_CallBack,
g_vote_all, g_vote_vault, g_vote_time, Array:BossMap

/* respawn */
static bool:g_respawn_preapre = true

public plugin_precache() {
register_plugin(PLUGIN, VERSION, AUTHOR)

g_cvar[0] = get_cvar_num("mp_autoteambalance")
g_cvar[1] = get_cvar_num("mp_limitteams")
g_cvar[2] = get_cvar_num("mp_startmoney")
g_cvar[3] = get_cvar_num("mp_friendlyfire")
g_fcvar = get_cvar_float("mp_buytime")
g_MaxPlayer = get_maxplayers()
config_load()

if (native_zl_map_boss() > 0) {
RegisterHam(Ham_TraceAttack, "info_target", "Hook_TraceAttack")
RegisterHam(Ham_Killed, "info_target", "Hook_Killed")
RegisterHam(Ham_Killed, "player", "Hook_Killed", 1)
register_message(get_user_msgid("AmmoX"), "MSG_AmmoX")

g_blood[0] = precache_model("sprites/blood.spr")
g_blood[1] = precache_model("sprites/bloodspray.spr")
g_timer_forward = CreateMultiForward("zl_timer", ET_CONTINUE, FP_CELL, FP_CELL)
new task = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "func_wall"))
set_pev(task, pev_classname, "zl_classname_timer")
set_pev(task, pev_nextthink, get_gametime() + 1.0)
RegisterHamFromEntity(Ham_Think, task, "Hook_Think")

set_cvar_num("mp_autoteambalance", 0)
set_cvar_num("mp_limitteams", 0)
set_cvar_num("mp_startmoney", 50000)
set_cvar_num("mp_friendlyfire", 0)
set_cvar_float("mp_buytime", 99.99)
} else {
BossMap = ArrayCreate(128)

if(is_plugin_loaded("zl_alienboss.amxx", true) != -1) ArrayPushString(BossMap, MAP_ALIEN)
if(is_plugin_loaded("zl_apacheboss.amxx", true) != -1) ArrayPushString(BossMap, MAP_APACHE)
if(is_plugin_loaded("zl_oberonboss.amxx", true) != -1) ArrayPushString(BossMap, MAP_OBERON)
if(is_plugin_loaded("zl_revenantboss.amxx", true) != -1) ArrayPushString(BossMap, MAP_REVENANT)
if(is_plugin_loaded("zl_boss_angra.amxx", true) != -1) ArrayPushString(BossMap, MAP_ANGRA)
if(is_plugin_loaded("zl_boss_envymask.amxx", true) != -1) ArrayPushString(BossMap, MAP_ENVYMASK)
if(is_plugin_loaded("zl_boss_illidan.amxx", true) != -1) ArrayPushString(BossMap, MAP_ILLIDAN)
if(is_plugin_loaded("zl_boss_scorpion.amxx", true) != -1) ArrayPushString(BossMap, MAP_SCORPION)
if(is_plugin_loaded("zl_boss_p_revenant.amxx", true) != -1) ArrayPushString(BossMap, MAP_P_REVENANT)

register_logevent("RoundEnd", 2, "1=Round_End")
register_clcmd(CMD_BOSS, "vote_menu")
g_CallBack = menu_makecallback("vote_menu_callback")
g_vote_vault = nvault_open("zl_boss")
g_vote_time = nvault_get(g_vote_vault, v_name)

set_cvar_num("mp_autoteambalance", g_cvar[0])
set_cvar_num("mp_limitteams", g_cvar[1])
set_cvar_num("mp_startmoney", g_cvar[2])
set_cvar_num("mp_friendlyfire", g_cvar[3])
set_cvar_float("mp_buytime", g_fcvar)
}
}

public RoundEnd() {
if (!g_vote_true)
return

new szBossMap[32], szTime[16]
formatex(szTime, charsmax(szTime), "%d", get_systime() + (g_cfg_cvar[1] * 60))
nvault_pset(g_vote_vault, v_name, szTime)
ArrayGetString(BossMap, (zl_vote_winner() == -1) ? 0 : zl_vote_winner(), szBossMap, charsmax(szBossMap))
log_amx(szBossMap)
server_cmd("amx_map ^"%s^"", szBossMap)
}

public vote_menu(id) {
if (g_vote_true) {
zl_colorchat(id, "!g[BOSS] !nГолосование завершено!")
return
}

if (zl_vote_time() > 0) {
zl_colorchat(id, "!g[BOSS] !nГолосование станет доступно через !g%d минут", ((zl_vote_time() / 60) > 0) ? (zl_vote_time() / 60) : 1)
return
}

static menu

if (!menu)menu = menu_create("^t", "vote_menu_handle")
else { menu_display(id, menu); return; }

formatex_title(menu)

new i, BossNum = ArraySize(BossMap)

for(i = 0; i < BossNum; ++i) menu_additem(menu, "", _, _, g_CallBack)
menu_display(id, menu)
}

public vote_menu_handle(id, menu, key) {
/* if (key == MENU_EXIT || g_vote_true) {
//menu_destroy(menu)
if (is_user_connected(id))
menu_cancel(id)

return PLUGIN_HANDLED
}*/

if (key == MENU_EXIT)
return PLUGIN_HANDLED

if (g_vote_true) {
menu_cancel(id)
return PLUGIN_HANDLED
}

if (g_voteid[id]) {
g_vote[g_voteid[id]]--
g_voteid[id] = key + 1
g_vote[g_voteid[id]]++
} else {
static szName[32], szMap[32]
get_user_name(id, szName, charsmax(szName))
ArrayGetString(BossMap, key, szMap, charsmax(szMap))
g_voteid[id] = key + 1
g_vote[key + 1]++
g_vote_all++
zl_colorchat(0, "!g[BOSS] !t%s !nПроголосовал за!g %s !nВсего !g[%d/%d] !nголосов.", szName, szMap, g_vote_all, zl_vote_count(g_cfg_fcvar))
}

if (g_vote_all >= zl_vote_count(g_cfg_fcvar)) {
static szWinner[32]
ArrayGetString(BossMap, zl_vote_winner(), szWinner, charsmax(szWinner))
set_hudmessage(227, 177, 168, 0.12, 0.05, 2, 1.0, 7.0, 0.1, 0.1, -1)
show_hudmessage(0, "Голосование завершено!^n\
Следующий босс: %s^n^n\
Последний раунд!", szWinner)

g_vote_true = true
menu_destroy(menu)
return PLUGIN_HANDLED
}
formatex_title(menu)
menu_display(id, menu)
return PLUGIN_CONTINUE
}

public vote_menu_callback(id, menu, key) {
static szMap[64]
ArrayGetString(BossMap, key, szMap, charsmax(szMap))

if (g_voteid[id] == (key + 1) || g_vote_true) {
format(szMap, charsmax(szMap), "\d%s \r[%d \y(%d%%)\r]", szMap, g_vote[key + 1], zl_vote_proc(key))
menu_item_setname(menu, key, szMap)
return ITEM_DISABLED
} else {
format(szMap, charsmax(szMap), "\w%s \r[%d \y(%d%%)\r]", szMap, g_vote[key + 1], zl_vote_proc(key))
menu_item_setname(menu, key, szMap)
return ITEM_ENABLED
}
}

public MSG_AmmoX(msg, dest, id) {
if (dest != MSG_ONE || !is_user_alive(id))
return PLUGIN_CONTINUE

new AmmoIndex = get_msg_arg_int(1)

if (AmmoIndex > 10) {
set_pdata_int(id, m_rgAmmoCBasePlayer + AmmoIndex, 0, 5)
return PLUGIN_CONTINUE
}

set_pdata_int(id, m_rgAmmoCBasePlayer + AmmoIndex, 250, 5)
return PLUGIN_CONTINUE
}

public client_putinserver(id) {
if (!g_respawn_preapre) {
if (native_zl_player_alive() <= 0) {
is_map_valid(g_cfg_szmap) ? server_cmd("amx_map ^"%s^"", g_cfg_szmap) : server_cmd("restart")
return
}
set_pdata_int(id, m_iNumRespawns, 1)
}
g_PlayerCount++
}

public client_disconnected(id) {
if (native_zl_map_boss() <= 0) {
if (g_voteid[id]) {
g_vote[g_voteid[id]] = 0
g_voteid[id] = 0
g_vote_all--
}
}
g_PlayerCount--
}

public plugin_end() {
if (native_zl_map_boss() > 0) {
set_cvar_num("mp_autoteambalance", g_cvar[0])
set_cvar_num("mp_limitteams", g_cvar[1])
set_cvar_num("mp_startmoney", g_cvar[2])
set_cvar_float("mp_buytime", g_fcvar)
} else {
if (!g_vote_true) {
new szTime[32]
formatex(szTime, charsmax(szTime), "%d", (zl_vote_time() > 0) ? (get_systime() + zl_vote_time()) : (get_systime()))
nvault_pset(g_vote_vault, v_name, szTime)
}
nvault_close(g_vote_vault)
}
}

public plugin_natives() {
register_native("zl_boss_map", "native_zl_map_boss", 1)
register_native("zl_boss_valid", "native_zl_valid_boss", 1)
register_native("zl_player_alive", "native_zl_player_alive", 1)
register_native("zl_player_random", "native_zl_random_player", 1)
register_native("zl_player_count", "native_zl_player_count", 1)
register_native("zl_colorchat", "native_zl_color_chat", 1)
}

public native_zl_map_boss() {
static MapName[64], Map_Boss

if (MapName[0])
return Map_Boss

get_mapname(MapName, 63)

if (contain(MapName, MAP_OBERON) != -1) Map_Boss = 1
if (contain(MapName, MAP_ALIEN) != -1) Map_Boss = 2
if (contain(MapName, MAP_ANGRA) != -1) Map_Boss = 3
if (contain(MapName, MAP_REVENANT) != -1) Map_Boss = 4
if (contain(MapName, MAP_ENVYMASK) != -1) Map_Boss = 5
if (contain(MapName, MAP_ILLIDAN) != -1) Map_Boss = 6
if (contain(MapName, MAP_SCORPION) != -1) Map_Boss = 7

if (contain(MapName, MAP_P_REVENANT) != -1) Map_Boss = 50

#if defined DEBUG
log_amx("DEBUG: Map id: %d | Map Name: %s", Map_Boss, MapName)
#endif

return Map_Boss
}

public native_zl_valid_boss(index) {
new ClassName[32]
pev(index, pev_classname, ClassName, charsmax(ClassName))

if (ClassName[0] == 'o' && ClassName[5] == 'n' && ClassName[7] == 'b') return 1
if (ClassName[0] == 'a' && ClassName[4] == 'n' && ClassName[6] == 'b') return 2
if (ClassName[0] == 'A' && ClassName[4] == 'a' && ClassName[5] == 'B') return 3
if (ClassName[0] == 'R' && ClassName[2] == 'v' && ClassName[8] == 'B') return 4
if (ClassName[0] == 'b' && ClassName[5] == 'z' && ClassName[9] == 's' || ClassName[0] == 'b' && ClassName[5] == 'n' && ClassName[8] == 'd') return 5
if (ClassName[0] == 'b' && ClassName[5] == 'i' && ClassName[9] == 'd') return 6
if (ClassName[0] == 'b' && ClassName[5] == 's' && ClassName[9] == 'p') return 7
if (ClassName[0] == 'b' && ClassName[5] == 'p' && ClassName[14] == 't') return 50
return 0
}

public native_zl_random_player() {
new Index
Index = GetRandomAlive(random_num(1, native_zl_player_alive()))
return Index
}

public native_zl_player_alive() {
new iAlive, id, CsTeams:team
for (id = 1; id <= g_MaxPlayer; id++) {
if (!is_user_alive(id) || is_user_bot(id))
continue

team = cs_get_user_team(id)

if (team == CS_TEAM_SPECTATOR || team == CS_TEAM_UNASSIGNED)
continue

iAlive++
}
return iAlive
}

GetRandomAlive(target_index) {
new iAlive, id, CsTeams:team
for (id = 1; id <= g_MaxPlayer; id++) {
if (!is_user_alive(id) || is_user_bot(id))
continue

team = cs_get_user_team(id)

if (team == CS_TEAM_SPECTATOR || team == CS_TEAM_UNASSIGNED)
continue


iAlive++

if (iAlive == target_index)
return id
}
return -1
}

public native_zl_player_count()
return g_PlayerCount

public native_zl_color_chat( iPlayer, szMessage[ ], any:... ) {
for( new i = 2; i <= numargs(); ++i )
param_convert(i)

static szBuffer[512]
vformat(szBuffer, charsmax( szBuffer ), szMessage, 3)
zl_colorchat(iPlayer, szBuffer)
}

stock zl_colorchat( iPlayer, szMessage[ ], any:... ) {
static szBuffer[512]
vformat(szBuffer, charsmax( szBuffer ), szMessage, 3 );

replace_all(szBuffer, charsmax(szBuffer), "!t", "^3")
replace_all(szBuffer, charsmax(szBuffer), "!n", "^1")
replace_all(szBuffer, charsmax(szBuffer), "!g", "^4")

if( iPlayer ) {
message_begin( MSG_ONE, 76, _, iPlayer );
write_byte( iPlayer );
write_string( szBuffer );
message_end( );
} else {
for( new iPlayers = 33; iPlayers > 0; iPlayers-- ) {
if( !is_user_connected( iPlayers ) )
continue;

message_begin( MSG_ONE, 76, _, iPlayers );
write_byte( iPlayers );
write_string( szBuffer );
message_end( );
}
}
}

formatex_title(menu) {
static szTitle[64]
formatex(szTitle, charsmax(szTitle), "\rМеню Босса ^nГолосов: %d/%d [%d%%]", g_vote_all, zl_vote_count(g_cfg_fcvar), g_vote_all * 100 / zl_vote_count(g_cfg_fcvar))
menu_setprop(menu, MPROP_TITLE, szTitle)
}

zl_vote_count(Float:procent)
return floatround(procent / 100.0 * float(g_PlayerCount), floatround_ceil)

zl_vote_proc(key)
return g_vote_all ? floatround(floatmul(float(g_vote[key + 1]) / float(g_vote_all), 100.0)) : 0

zl_vote_winner() {
new buffer = 0, s = 0, i = 0, m = ArraySize(BossMap)
for(i = 1; i <= m; ++i) {
if (g_vote[i] > buffer) {
buffer = g_vote[i]
s = i
}
}
return s - 1
}

zl_vote_time()
return g_vote_time - get_systime()

public Hook_Think(ent) {
if (!native_zl_player_alive()) {
set_pev(ent, pev_nextthink, get_gametime() + 1.0)
return
}
static szName[32]
pev(ent, pev_classname, szName, charsmax(szName))
if (szName[0] == 'z' && szName[1] == 'l' && szName[14] == 'i' && szName[17] == 'r') {
static Prepare = 2, ret
set_pev(ent, pev_nextthink, get_gametime() + 1.0)
switch(Prepare) {
case 2: {
g_cfg_cvar[0]--
client_print(0, print_center, "Ожидание до начала боя: %d секунд", g_cfg_cvar[0])
if(g_cfg_cvar[0] <= 0) {
Prepare--
g_respawn_preapre = false
}
}
case 1: {
Prepare--
g_cfg_cvar[0]++
}
case 0:g_cfg_cvar[0]++
default: g_cfg_cvar[0]++
}

message_begin(MSG_ALL, get_user_msgid("RoundTime"))
write_short(g_cfg_cvar[0])
message_end()

ExecuteForward(g_timer_forward, ret, g_cfg_cvar[0], Prepare)
if(ret) Prepare = ret
}
}

config_load() {
static path[64]
get_localinfo("amxx_configsdir", path, charsmax(path))
format(path, charsmax(path), "%s/zl/%s", path, f_config)

if (!file_exists(path)) {
new error[100]
formatex(error, charsmax(error), "Cannot load customization file %s!", path)
set_fail_state(error)
return
}

static linedata[1024], key[64], value[960]
new file = fopen(path, "rt")

while (file && !feof(file)) {
fgets(file, linedata, charsmax(linedata))
replace(linedata, charsmax(linedata), "^n", "")

if (!linedata[0] || linedata[0] == '/') continue;

strtok(linedata, key, charsmax(key), value, charsmax(value), '=')
trim(key)
trim(value)

if (equal(key, "PREPARE"))
g_cfg_cvar[0] = str_to_num(value)
else if (equal(key, "BOSS_COLOR"))
g_cfg_cvar[2] = str_to_num(value)
else if (equal(key, "SZ_MAP"))
parse(value, g_cfg_szmap, charsmax(g_cfg_szmap))
else if (equal(key, "VOTE_PROCENT"))
g_cfg_fcvar = str_to_float(value)
else if (equal(key, "VOTE_TIME"))
g_cfg_cvar[1] = str_to_num(value)
}
if (file) fclose(file)
}

public Hook_TraceAttack(boss, player, Float:dmg, Float:direction[3], tr, damage_type) {
if (!native_zl_valid_boss( boss ))
return HAM_IGNORED

static Float:End[3]
get_tr2(tr, TR_vecEndPos, End)

if (pev(boss, pev_euser2) == 1) {
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_SPARKS)
engfunc(EngFunc_WriteCoord, End[0])
engfunc(EngFunc_WriteCoord, End[1])
engfunc(EngFunc_WriteCoord, End[2])
message_end()
return HAM_IGNORED
}

if (pev(boss, pev_deadflag) == DEAD_NO && pev(boss, pev_takedamage) == DAMAGE_NO) {
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_SPARKS)
engfunc(EngFunc_WriteCoord, End[0])
engfunc(EngFunc_WriteCoord, End[1])
engfunc(EngFunc_WriteCoord, End[2])
message_end()
return HAM_SUPERCEDE
}

message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
write_byte(TE_BLOODSPRITE)
engfunc(EngFunc_WriteCoord, End[0])
engfunc(EngFunc_WriteCoord, End[1])
engfunc(EngFunc_WriteCoord, End[2])
write_short(g_blood[0])
write_short(g_blood[1])
write_byte(g_cfg_cvar[2])
write_byte(random_num(b_bmin, b_bmax))
message_end()
return HAM_IGNORED
}

public Hook_Killed(victim, attacker, corpse) {
if (native_zl_player_alive() <= 0) {
set_task(6.0, "changemap")
return HAM_IGNORED
}

if (!native_zl_valid_boss(victim))
return HAM_IGNORED

if (pev(victim, pev_deadflag) == DEAD_DYING)
return HAM_IGNORED


set_pev(victim, pev_solid, SOLID_NOT)
set_pev(victim, pev_velocity, {0.0, 0.0, 0.0})

static e = -1
while ( (e = engfunc(EngFunc_FindEntityByString, e, "classname", "classname_zombie")) )
if(pev_valid(e)) engfunc(EngFunc_RemoveEntity, e)


switch(native_zl_map_boss()) {
case 1: zl_anim(victim, 16, 1.0)
case 2: zl_anim(victim, 1, 1.0)
case 5: { // Neid and Zavist
new szBossType[32], g_Neid, g_Zavist
pev(victim, pev_classname, szBossType, charsmax(szBossType))

g_Neid = engfunc(EngFunc_FindEntityByString, g_Neid, "classname", "boss_neid")
g_Zavist = engfunc(EngFunc_FindEntityByString, g_Zavist, "classname", "boss_zavist")

if (pev(g_Neid, pev_deadflag) == DEAD_DYING && pev(g_Zavist, pev_deadflag) == DEAD_DYING) {
set_task(20.0, "changemap")
return HAM_SUPERCEDE
}

set_pev(victim, pev_deadflag, DEAD_DYING)
if (equal(szBossType, "boss_neid")) {
zl_anim(victim, 35, 1.0)
set_pev(g_Neid, pev_nextthink, get_gametime() + 7.4)
}
if (equal(szBossType, "boss_zavist")) {
zl_anim(victim, 28, 1.0)
set_pev(g_Zavist, pev_nextthink, get_gametime() + 13.2)
}
return HAM_SUPERCEDE
}
case 6: zl_anim(victim, 15, 1.0)
case 7: zl_anim(victim, 20, 1.0)
}

set_pev(victim, pev_deadflag, DEAD_DYING)
set_task(20.0, "changemap")
return HAM_SUPERCEDE
}

public changemap() {
#if defined MAPCHOOSER
zl_vote_start()
#else
is_map_valid(g_cfg_szmap) ? server_cmd("changelevel ^"%s^"", g_cfg_szmap) : server_cmd("restart")
#endif
}

stock zl_anim(ent, sequence, Float:speed) {
set_pev(ent, pev_sequence, sequence)
set_pev(ent, pev_animtime, get_gametime())
set_pev(ent, pev_framerate, speed)
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/
Была ошибка

Код:
L 09/11/2019 - 13:33:18: Start of error session.
L 09/11/2019 - 13:33:18: Info (map "$2000$") (file "addons/amxmodx/logs/error_20190911.log")
L 09/11/2019 - 13:33:18: [AMXX] Run time error 11 (plugin "zl_core.amxx") - debug not enabled!
L 09/11/2019 - 13:33:18: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
Включил debug Выдало более подробный отчёт.

Код:
L 02/22/2020 - 21:32:12: Start of error session.
L 02/22/2020 - 21:32:12: Info (map "$2000$") (file "addons/amxmodx/logs/error_20200222.log")
L 02/22/2020 - 21:32:12: [AMXX] Displaying debug trace (plugin "zl_core.amxx", version "2.0.2")
L 02/22/2020 - 21:32:12: [AMXX] Run time error 11: divide
L 02/22/2020 - 21:32:12: [AMXX]    [0] zl_core.sma::zl_vote_count (line 408)
L 02/22/2020 - 21:32:12: [AMXX]    [1] zl_core.sma::formatex_title (line 403)
L 02/22/2020 - 21:32:12: [AMXX]    [2] zl_core.sma::vote_menu (line 148)
Подскажите скриптёры как исправить?

PS: Была тема https://dev-cs.ru/threads/7599/ Там сообщество немного помогло с компиляцией.
 
Сообщения
81
Реакции
24
Не делить на ноль.
По подробнее можно пожалуйста? Желательно часть исправленного уже кода. В скриптенге не разбираюсь поэтому лучше живой пример (Где что убрать заменить отредактировать)
 
Сообщения
1,701
Реакции
1,512
Помог
26 раз(а)
sas333, там где указано.
 
Сообщения
8
Реакции
1
Помог
1 раз(а)
Замени client_putinserver на client_connect , строка 234
 
Сообщения
81
Реакции
24
Замени client_putinserver на client_connect , строка 234
Спасибо.
Только вопрос, это ошибка дополнительная или относится к той что я указал? Просто судя по логу там на строчку 234 ни чего не указывает.
 
Сообщения
1,701
Реакции
1,512
Помог
26 раз(а)
VOTE_PROCENT поставь не 0
 
Сообщения
81
Реакции
24
VOTE_PROCENT поставь не 0
стоит 70 процентов. ( в конфиге)

Код:
VOTE_PROCENT = 70.0 // Кол-во людей в % которые должны проголосовать для смены карты
3 Май 2020
может нужно просто 70 поставить? а то сейчас стоит с нулём (70.0)
 
Сообщения
1,701
Реакции
1,512
Помог
26 раз(а)
sas333, может не читается?
 
Сообщения
81
Реакции
24
fl0wer, Да вроде читается. там только показывает процент 100 в меню но при этом ещё и отображает в чате игроков

acuLfpdyq2o.jpgAHOjbJfn4xM.jpg
3 Май 2020
На скриншоте я один на сервере, но ещё один бот есть в спекторах, поэтому показывает в чате один из двух проголосовало но хотя по процентам видно что 100 процентов
 
Сообщения
1,701
Реакции
1,512
Помог
26 раз(а)
Так попробуй
Код:
zl_vote_count(Float:procent)
{
    if (!g_PlayerCount)
        return 0;
    
    return floatround(procent / 100.0 * float(g_PlayerCount), floatround_ceil)
}
 
Сообщения
443
Реакции
319
Помог
13 раз(а)
Перестань слушать глупые советы.
C++:
new bool:isFullyConnected[33];

public client_putinserver(id) {
    if (!g_respawn_preapre) {
        if (native_zl_player_alive() <= 0) {
            is_map_valid(g_cfg_szmap) ?  server_cmd("amx_map ^"%s^"", g_cfg_szmap) : server_cmd("restart")
            return
        }
        set_pdata_int(id, m_iNumRespawns, 1)
    }
    isFullyConnected[id]=true;
    g_PlayerCount++;
}

public client_disconnected(id) {
    if(!isFullyConnected[id])return;
    isFullyConnected[id]=false;
    if (native_zl_map_boss() <= 0) {
        if (g_voteid[id]) {
            g_vote[g_voteid[id]] = 0
            g_voteid[id] = 0
            g_vote_all--
        }
    }
    g_PlayerCount--;
}
 
Последнее редактирование:
Сообщения
81
Реакции
24
Shel, что то fl0wer не понравилось. и правда уже запутался)) Так в итоге где правильно?
 
Сообщения
443
Реакции
319
Помог
13 раз(а)
Ну если хочется использовать: Как почистить унитаз? Засунь руку и почисти - используй предложенные до этого варианты, если хочется: возьми ершик и почисти - используй последний.
 
Сообщения
443
Реакции
319
Помог
13 раз(а)
Единственным кто хотя бы чуть близко подошел к решению проблемы был: edward.
 
Сообщения
1,701
Реакции
1,512
Помог
26 раз(а)
@Shel, что то @fl0wer не понравилось. и правда уже запутался)) Так в итоге где правильно?
Мне не понравилось токсичное сообщение от Shel и его костыли в коде, меняющие первоначальный функционал, потому что ошибка состоит в определенной функции в делении на 0. Если нужно переписать без багов этот старый код, то https://dev-cs.ru/forums/90/
 

d3m37r4

111111
Сообщения
1,454
Реакции
1,194
Помог
10 раз(а)
По подробнее можно пожалуйста? Желательно часть исправленного уже кода. В скриптенге не разбираюсь поэтому лучше живой пример (Где что убрать заменить отредактировать)
А на кснете вроде какие-то преватные плугены с хилкой "пилишь"
 

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

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