Advert Messages дублирование первой строки

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
649
Реакции
150
Ошибка
Дублируется первая строка из файла.
ОС
Linux
Amx Mod X
AMX Mod X 1.10.0.5252
Билд
ReHLDS version: 3.4.0.669-dev
ReGamedll
ReGameDLL version: 5.7.0.328-dev
Версия Metamod
Metamod-r v1.3.0.128, API (5:13)
Список метамодулей
Currently loaded plugins:
description stat pend file vers src load unload
[ 1] Reunion RUN - reunion_mm_i386.so v0.1.0.133 ini Start Never
[ 2] ReAuthCheck RUN - reauthcheck_mm_i386.so v0.1.6 ini Start Never
[ 3] Rechecker RUN - rechecker_mm_i386.so v2.5 ini Chlvl ANY
[ 4] Revoice RUN - revoice_mm_i386.so v0.1.0.32 ini Start Never
[ 5] AMX Mod X RUN - amxmodx_mm_i386.so v1.10.0.5252 ini Start ANY
[ 6] MySQL RUN - mysql_amxx_i386.so v1.10.0.5252 pl5 ANY ANY
[ 7] SQLite RUN - sqlite_amxx_i386.so v1.10.0.5252 pl5 ANY ANY
[ 8] Fun RUN - fun_amxx_i386.so v1.10.0.5252 pl5 ANY ANY
[ 9] Engine RUN - engine_amxx_i386.so v1.10.0.5252 pl5 ANY ANY
[10] FakeMeta RUN - fakemeta_amxx_i386.so v1.10.0.5252 pl5 ANY ANY
[11] CStrike RUN - cstrike_amxx_i386.so v1.10.0.5252 pl5 ANY ANY
[12] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.10.0.5252 pl5 ANY ANY
[13] ReAPI RUN - reapi_amxx_i386.so v5.8.0.166-dev pl5 ANY Never
[14] GeoIP RUN - geoip_amxx_i386.so v1.10.0.5252 pl5 ANY ANY

[15] whois RUN - whois_amxx_i386.so v0.2.270 pl5 ANY ANY
[16] CURL AMXX RUN - curl_amxx_i386.so v1.1.0 pl5 ANY ANY
16 plugins, 16 running
Список плагинов
Currently loaded plugins:
name version author file status
[ 1] fb_forwards 0.1.4 Kanagava & Realu fb_forwards.amx running
[ 2] WebHS 0.1 kanagava fb_web_online.a running
[ 3] FreshBans 1.4.0b kanagava fresh_bans_140_ running
[ 4] SF Warn Menu 0.1.4g_edi serfreeman1337/N sf_admin_warns. running
[ 5] CSStatsX SQL 0.7.4+1 serfreeman1337 csstatsx_sql.am running
[ 6] Rank Menu 1.1 h1k3 rankmenu.amxx running
[ 7] AES: StatsX 0.5 Vega serfreeman1337 statsx_cstrike. running
[ 8] Multi-Rendering System [ReAPI] 0. Subb98/Nordic Wa multirendering. running
[ 9] Admin Load 3.10.0 [email protected] adminload.amxx running
[ 10] Admin Commands 1.10.0.525 AMXX Dev Team admincmd.amxx running
[ 11] Admin Help 1.10.0.525 AMXX Dev Team adminhelp.amxx running
[ 12] Menus Front-End 1.10.0.525 AMXX Dev Team menufront.amxx running
[ 13] Commands Menu 1.10.0.525 AMXX Dev Team cmdmenu.amxx running
[ 14] Players Menu 1.10.0.525 AMXX Dev Team plmenu.amxx running

[ 15] Teleport Menu 1.10.0.525 AMXX Dev Team telemenu.amxx running
[ 16] Maps Menu 1.10.0.525 AMXX Dev Team mapsmenu.amxx running
[ 17] Admin Chat 1.10.0.525 AMXX Dev Team adminchat.amxx running
[ 18] Anti Flood 1.10.0.525 AMXX Dev Team antiflood.amxx running
[ 19] Admin Votes 1.10.0.525 AMXX Dev Team adminvote.amxx running
[ 20] Pause Plugins 1.10.0.525 AMXX Dev Team pausecfg.amxx running
[ 21] Stats Configuration 1.10.0.525 AMXX Dev Team statscfg.amxx running
[ 22] unknown unknown unknown 35hp_16.amxx stopped
[ 23] AdminMenu 1.1 Nordic Warrior adminmenu.amxx running
[ 24] Admin menu central 0.2 Nordic Warrior adminmenu_centr running
[ 25] Advanced Lottery 0.5.1 Nordic Warrior advanced_lotter running
[ 26] [ReAPI] Advanced Team 0.1.0 Vaqtincha AdvancedTeamCho running
[ 27] Advert Messages 1.22 neygomon adverts.amxx running
[ 28] AFK Protection 2.3.3 rapara13/Nordic afk.amxx running
[ 29] AimInfo 2.1 xPaw/Nordic Warr aim_info.amxx running

[ 30] Ball 1.2.1 xPaw/Nordic Warr ball.amxx running
[ 31] BhopHack Detector 0.1 Mistrick bhophack_detect running
[ 32] [Reapi] Block Advert 1.4 neygomon block_advert.am running
[ 33] Bypass Guard 24.05.2019 mx?! bypass_guard_ip running
[ 34] CameraChanger Lite 0.1 Nordic Warrior camera_changer. running
[ 35] Advanced Client Checke 0.3.7e Mistrick cmdchecker.amxx running
[ 36] Connect Exec 1.1 AleX/Nordic Warr connect_exec.am running
[ 37] Chat Manager 4.4 OciXCrom crx_chatmanager running
[ 38] CM: Toggle Chat 4.1 OciXCrom crx_chatmanager running
[ 39] OciXCrom's Rank System 3.4 OciXCrom crx_ranksystem. running
[ 40] Knife Models 3.1 OciXCrom crx_knife_model running
[ 41] [ReAPI] Custom Models 1.6.1 neugomon custom_models.a running
[ 42] Demo Recorder 2.4.0 [email protected] demo_recorder.a running
[ 43] Fix for sky 1.0 Nordic Warrior fix_maps.amxx running
[ 44] Gag System 1.1 TheRedShoko @ AM gag_system.amxx running

[ 45] GameName Changer 1.0 neugomon gamename.amxx running
[ 46] High Ping Kicker 1.0 OLO/shadow/Nordi high_ping_kicke running
[ 47] iFLY 1.0 arttty7 iFLY.amxx debug
[ 48] iHOOK 1.0 arttty7 iHOOK.amxx running
[ 49] Invisible Spectator 1.0 ReHLDS Team invisible_spect running
[ 50] Kill Distance 0.4 Nightscream/Nord kill_distance.a running
[ 51] Knife Duel Arena 1.32 bionext knife_duel_aren debug
[ 52] Knife Duel Arena Edito 1.0 bionext knife_duel_aren paused
[ 53] Knife Duel Arena Edito 0.2 Nordic Warrior knife_duel_aren running
[ 54] Knife Duel Arena Block 0.2 bionext/Nordic W knife_duel_aren running
[ 55] Language Menu 1.0 [email protected] langmenu.amxx running
[ 56] Light Menu 0.3 Nordic Warrior light_menu.amxx running
[ 57] Mind Games 1.1 fifayer/Nordic W MindGames.amxx running
[ 58] Money System Best t3rkecorejz MoneySystem.amx running
[ 59] Mute Menu 12.02.2019 w0w/Nordic Warri mute_menu.amxx running

[ 60] New Grab 1.0 Nordic Warrior/N new_grab.amxx running
[ 61] KillStreakAnnouncer 0.3 Nordic Warrior nkillstreak.amx running
[ 62] Knife Menu 1.3 Nordic Warrior nknifemenu.amxx running
[ 63] Knife shop 0.2.1 Nordic Warrior nknifeshop.amxx running
[ 64] Online Helper 2.1.3 Nordic Warrior online_helper.a running
[ 65] Paint Marker 1.1 w0w paint_marker.am running
[ 66] [ReAPI] Parachute 1.1 ReHLDS Team parachute.amxx running
[ 67] Pingwinowa bombka 0.1 diablix pingwin.amxx running
[ 68] Poll 1.1 Nunfy poll.amxx debug
[ 69] Random Skies 1.1 rmk by N.W. randomskies.amx running
[ 70] ReChecker Logging 1.0 custom rc_logging.amxx running
[ 71] Reset Score 1.0 Nordic Warrior reset_score.amx running
[ 72] Spectator Bots 2.1 SISA spectator_bots. running
[ 73] SteamID Limiter 0.4 Mistrick steamid_limiter running
[ 74] Money Transfer 1.2 x3/Nordic Warrio tm.amxx debug

[ 75] Train Killer 1.2 Pastout!/Nordic trainkiller.amx running
[ 76] VipMenu 1.0 Nordic Warrior vipmenu.amxx running
[ 77] Yet Another Voteban 1.8 AndrewZ/voed yet_another_vot running
[ 78] Map Manager: Core 3.0.1 Mistrick map_manager_cor running
[ 79] Map Manager: Scheduler 0.1.0 Mistrick map_manager_sch running
[ 80] Map Manager: Rtv 0.0.4 Mistrick map_manager_rtv running
[ 81] Map Manager: Nominatio 0.0.8 Mistrick map_manager_nom running
[ 82] Map Manager: Online so 0.0.2 Mistrick map_manager_onl running
[ 83] Map Manager: Effects 0.0.8 Mistrick map_manager_eff running
[ 84] Map Manager: Informer 0.0.5 Mistrick map_manager_inf running
[ 85] Map Manager: Advanced 0.0.4 Mistrick map_manager_adv running
85 plugins, 83 running
Список модулей
Currently loaded modules:
name version author status
[ 1] MySQL 1.10.0.525 AMX Mod X Dev Team running
[ 2] SQLite 1.10.0.525 AMX Mod X Dev Team running
[ 3] Fun 1.10.0.525 AMX Mod X Dev Team running
[ 4] Engine 1.10.0.525 AMX Mod X Dev Team running
[ 5] FakeMeta 1.10.0.525 AMX Mod X Dev Team running
[ 6] nVault 1.10.0.525 AMX Mod X Dev Team running
[ 7] CStrike 1.10.0.525 AMX Mod X Dev Team running
[ 8] dummy_csx 1.0 AGHL.RU Dev Team running
[ 9] Ham Sandwich 1.10.0.525 AMX Mod X Dev Team running
[10] ReAPI 5.8.0.166- Asmodai & s1lent running
[11] GeoIP 1.10.0.525 AMX Mod X Dev Team running
[12] whois 0.2.270 AGHL.RU Dev Team running
[13] CURL AMXX 1.1.0 Polarhigh running
[14] RegEx 1.10.0.525 AMX Mod X Dev Team running
[15] JSON 1.10.0.525 AMX Mod X Dev Team running
15 modules, 15 correct
Автор плагина
Neygomon
Версия плагина
1.22
Исходник
#include <amxmodx>

#define REPEAT_TIME 70.0 // Время между сообщениями
#define MAX_MSG 256 // Не трогать!!!

new adMessages[MAX_MSG][191];
new ad_count, iMessgCount;

public plugin_init()
{
register_plugin("Advert Messages", "1.22", "neygomon")
set_task(REPEAT_TIME, "advert", .flags="b");
}

public plugin_cfg()
{
new file = fopen("addons/amxmodx/configs/adverts.ini", "rt");
if(file)
{
new string[192], message[191];
while(ad_count < MAX_MSG && !feof(file))
{
fgets(file, string, charsmax(string));

if(string[0] != ';' && parse(string, message, charsmax(message)))
{
while(replace(message, charsmax(message), "!n", "^1")) {}
while(replace(message, charsmax(message), "!t", "^3")) {}
while(replace(message, charsmax(message), "!g", "^4")) {}
formatex(adMessages[ad_count++], charsmax(adMessages[]), "^1%s", message);
}
}
fclose(file);
if(!ad_count) set_fail_state("Messages not found! Check file ^"addons/amxmodx/configs/adverts.ini^"");
}
else set_fail_state("File ^"addons/amxmodx/configs/adverts.ini^" not found!");
}

public advert()
{
client_print_color(0, print_team_default, "%s", adMessages[iMessgCount == ad_count ? (iMessgCount = 0) : iMessgCount++]);
}
Дублируется первая строка из файла с сообщениями. При втором и более цикле сообщений.

17358


Файл:
17359
 
В этой теме было размещено решение! Перейти к решению.
Сообщения
146
Реакции
126
sbelov020,
C++:
- client_print_color(0, print_team_default, "%s", adMessages[iMessgCount == ad_count ? (iMessgCount = 0) : iMessgCount++]);
+ client_print_color(0, print_team_default, "%s", adMessages[iMessgCount == ad_count ? (iMessgCount = 0) : ++iMessgCount]);
 
Статус
В этой теме нельзя размещать новые ответы.

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

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