My timer not works

Сообщения
10
Реакции
0
Ошибка
My timer not works
ОС
Linux
Amx Mod X
AMX Mod X 1.9.0.5249
Билд
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.10.0.760-dev
Build date: 13:06:48 Jun 23 2021 (2629)
Build from: https://github.com/dreamstalker/rehlds/commit/9508c83
ReGamedll
NONE
Версия 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
Список метамодулей
Currently loaded plugins:
description stat pend file vers src load unload
[ 1] SafeNameAndChat RUN - SafeNameAndChat.so v1.1 ini ANY ANY
[ 2] Reunion RUN - reunion_mm_i386.so v0.1.0.137 ini Start Never
[ 3] NetBufExtender RUN - nbex.so v1.0 ini ANY Never
[ 4] UserInfoNetOptimizer RUN - uino.so v1.0 ini ANY Never
[ 5] LocalizeBug Fix RUN - localizebugfix_mm_i386.so v2.4 ini Start Never
[ 6] ReAuthCheck RUN - reauthcheck_mm_i386.so v0.1.6 ini Start Never
[ 7] AMX Mod X RUN - amxmodx_mm_i386.so v1.9.0.5249 ini Start ANY
[ 8] WHBlocker RUN - whblocker_mm_i386.so v1.5.697 ini Chlvl ANY
[ 9] MySQL RUN - mysql_amxx_i386.so v1.9.0.5271 pl7 ANY ANY
[10] Fun RUN - fun_amxx_i386.so v1.9.0.5271 pl7 ANY ANY
[11] Engine RUN - engine_amxx_i386.so v1.9.0.5271 pl7 ANY ANY
[12] FakeMeta RUN - fakemeta_amxx_i386.so v1.9.0.5271 pl7 ANY ANY
[13] GeoIP RUN - geoip_amxx_i386.so v1.9.0.5271 pl7 ANY ANY
[14] CStrike RUN - cstrike_amxx_i386.so v1.9.0.5271 pl7 ANY ANY
[15] CSX RUN - csx_amxx_i386.so v1.9.0.5271 pl7 ANY ANY
[16] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.9.0.5271 pl7 ANY ANY
[17] ReAPI RUN - reapi_amxx_i386.so v5.19.0.217-dev pl7 ANY Never
[18] SxGeo RUN - sxgeo_amxx_i386.so v2.2 pl7 ANY Never
18 plugins, 18 running
Список плагинов
[ 74] unknown                 unknown     unknown           zp_voteboss.amx  running
Автор плагина
Me (Carbon)
Версия плагина
0.1
Исходный код
#include <amxmodx>
#include <PrintChat>
#include <amxmisc>
#include <engine>
#include <hamsandwich>
#include <xs>
#include <cstrike>
#include <fakemeta>
#include <fakemeta_util>
#include <fun>

#define VOTES 12

#define HOURS 3
#define MINUTES 0
#define SECONDS 0

new g_iTime;
new g_iBoss;
new g_iVotes;
new g_iPlayerVote[33];
new g_szMaps[][] =
{
"zs_frozen_boss",
"zs_cronowing_skvd",
"zs_light_zombie_boss"
}

public plugin_init()
{
// register_menucmd(register_menuid("VoteBoss"), MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_4 | MENU_KEY_0, "MenuVoteBoss");

register_clcmd("vtboss", "ClCmdVtboss");
register_clcmd("say /boss", "ClCmdVtboss");
register_clcmd("say_team /boss", "ClCmdVtboss");

register_event("HLTV", "EventRoundStart", "a", "1=0", "2=0");

new szTime[12];

if (get_localinfo("vtbss", szTime, charsmax(szTime))) g_iTime = str_to_num(szTime);

if (get_systime() < g_iTime) set_task(float(g_iTime - get_systime()), "TaskCanVote");
else set_task(120.0, "TaskAdv", _, _, _, "b");

register_dictionary("zp_voteboss.txt");
}

public TaskCanVote()
{
PrintChat(0, "%L", LANG_PLAYER, "#VtbossCanVote");

PrintChat(0, "%L", LANG_PLAYER, "#VtbossAdv");

set_task(120.0, "TaskAdv", _, _, _, "b");
}

public TaskAdv()
{
PrintChat(0, "%L", LANG_PLAYER, "#VtbossAdv");
}

public client_disconnected(iEntity)
{
if (g_iPlayerVote[iEntity])
{
g_iVotes--;

g_iPlayerVote[iEntity] = 0;
}
}

public ClCmdVtboss(iEntity)
{
if (g_iPlayerVote[iEntity])
{
PrintChat(iEntity, "%L", iEntity, "#VtbossYouAlready");

return PLUGIN_HANDLED;
}

if (g_iBoss)
{
PrintChat(iEntity, "%L", iEntity, "#VtbossAlready");

return PLUGIN_HANDLED;
}

new iTime = g_iTime - get_systime();

if (iTime > 0)
{
new iMinutes = (iTime / 60) + ((iTime % 60) ? 1 : 0);
new iHours = (iMinutes / 60);

iMinutes %= 60;

if (iHours) PrintChat(iEntity, "%L", iEntity, "#VtbossWaitHours", iHours, iMinutes);
else PrintChat(iEntity, "%L", iEntity, "#VtbossWaitMinutes", iMinutes);

return PLUGIN_HANDLED;
}

g_iPlayerVote[iEntity] = 1;

if (++g_iVotes == VOTES)
{
new szLang[32];

g_iBoss = random_num(0,2);

formatex(szLang, charsmax(szLang), "#VtbossNext%d", g_iBoss+1);

PrintChat(0, "%L", LANG_PLAYER, szLang);

remove_task();

client_printcolor(0, "!g[Commander] !tMap Changing to %s", g_szMaps[g_iBoss])
server_cmd("changelevel %s", g_szMaps[g_iBoss]);

new szTime[12]

num_to_str(get_systime() + HOURS * 3600 + MINUTES * 60 + SECONDS, szTime, charsmax(szTime));

set_localinfo("vtbss", szTime);

//return PLUGIN_HANDLED;
}

new szLang[32];

formatex(szLang, charsmax(szLang), "#VtbossChosen%d", 1);

PrintChat(0, "%L", LANG_PLAYER, szLang, VOTES - g_iVotes);

return PLUGIN_HANDLED;
}

public EventRoundStart()
{
if (g_iBoss)
{

client_printcolor(0, "!g[Commander] !tMap Changing to %s", g_szMaps[g_iBoss])
server_cmd("changelevel %s", g_szMaps[g_iBoss]);

new szTime[12]

num_to_str(get_systime() + HOURS * 3600 + MINUTES * 60 + SECONDS, szTime, charsmax(szTime));

set_localinfo("vtbss", szTime);
}
}

stock client_printcolor(const id,const input[], any:...)
{
new msg[191], players[32], count = 1;
vformat(msg,190,input,3);
replace_all(msg,190,"!g","^4");// green
replace_all(msg,190,"!n","^1");// normal
replace_all(msg,190,"!t","^3");// team

if (id) players[0] = id; else get_players(players,count,"ch");
for (new i=0;i<count;i++)
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE,get_user_msgid("SayText"),_,players[i]);
write_byte(players[i]);
write_string(msg);
message_end();
}
}

/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang2057\\ f0\\ fs16 \n\\ par }
*/
Hello,

Normally in my plugin players after switch to boss zs_ maps, they should vote for /boss again after each 3 hour. but now that function not works and they can vote for boss every map even we played boss map recently (last map). i need help for t make it work again as expected
 

iPlague

♿️
Сообщения
230
Реакции
130
Помог
2 раз(а)
Код:
if (get_localinfo("vtbss", szTime, charsmax(szTime))) g_iTime = str_to_num(szTime);
server_print("!!!!!!!!!!!! %s !!!!!!!!!!!!", szTime);

set_localinfo("vtbss", szTime);
server_print("!!!!!!!!!!!! %s !!!!!!!!!!!!", szTime);
 
Последнее редактирование:

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

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