KZ Change Map (set_task problem)

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
14
Реакции
1
Ошибка
no log, random crash server.
ОС
Linux
Amx Mod X
AMX Mod X 1.9.0.5294 (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: Dec 3 2021 15:54:56
Built from: https://github.com/alliedmodders/amxmodx/commit/363871a
Build ID: 5294:363871a
Core mode: JIT+ASM32
Билд
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.13.0.788-dev
Build date: 07:36:33 Jul 12 2023 (3378)
Build from: https://github.com/dreamstalker/rehlds/commit/f955b07
ReGamedll
ReGameDLL version: 5.26.0.668-dev
Build date: 19:02:48 Dec 31 2023
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/d3c0ec8
Версия Metamod
Metamod-r v1.3.0.149, API (5:13)
Metamod-r build: 11:31:17 Apr 23 2024
Metamod-r from: https://github.com/theAsmodai/metamod-r/commit/603a257
Список метамодулей
Currently loaded plugins:
description stat pend file vers src load unload
[ 1] AMX Mod X RUN - amxmodx_mm_i386.so v1.9.0.5294 ini Start ANY
[ 2] MySQL RUN - mysql_amxx_i386.so v1.9.0.5294 pl1 ANY ANY
[ 3] Fun RUN - fun_amxx_i386.so v1.9.0.5294 pl1 ANY ANY
[ 4] Engine RUN - engine_amxx_i386.so v1.9.0.5294 pl1 ANY ANY
[ 5] FakeMeta RUN - fakemeta_amxx_i386.so v1.9.0.5294 pl1 ANY ANY
[ 6] GeoIP RUN - geoip_amxx_i386.so v1.9.0.5294 pl1 ANY ANY
[ 7] CStrike RUN - cstrike_amxx_i386.so v1.9.0.5294 pl1 ANY ANY
[ 8] CSX RUN - csx_amxx_i386.so v1.9.0.5294 pl1 ANY ANY
[ 9] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.9.0.5294 pl1 ANY ANY
9 plugins, 9 running
Список плагинов
Currently loaded plugins:
name version author file status
[ 1] Admin Base 1.9.0.5294 AMXX Dev Team admin.amxx running
[ 2] Admin Commands 1.9.0.5294 AMXX Dev Team admincmd.amxx running
[ 3] Admin Help 1.9.0.5294 AMXX Dev Team adminhelp.amxx running
[ 4] Slots Reservation 1.9.0.5294 AMXX Dev Team adminslots.amxx running
[ 5] Multi-Lingual System 1.9.0.5294 AMXX Dev Team multilingual.am running
[ 6] Menus Front-End 1.9.0.5294 AMXX Dev Team menufront.amxx running
[ 7] Commands Menu 1.9.0.5294 AMXX Dev Team cmdmenu.amxx running
[ 8] Players Menu 1.9.0.5294 AMXX Dev Team plmenu.amxx running
[ 9] Maps Menu 1.9.0.5294 AMXX Dev Team mapsmenu.amxx running
[ 10] Plugin Menu 1.9.0.5294 AMXX Dev Team pluginmenu.amxx running
[ 11] Admin Chat 1.9.0.5294 AMXX Dev Team adminchat.amxx running
[ 12] Anti Flood 1.9.0.5294 AMXX Dev Team antiflood.amxx running
[ 13] Scrolling Message 1.9.0.5294 AMXX Dev Team scrollmsg.amxx running
[ 14] Info. Messages 1.9.0.5294 AMXX Dev Team imessage.amxx running
[ 15] Admin Votes 1.9.0.5294 AMXX Dev Team adminvote.amxx running
[ 16] NextMap 1.9.0.5294 AMXX Dev Team nextmap.amxx running
[ 17] Nextmap Chooser 1.9.0.5294 AMXX Dev Team mapchooser.amxx running
[ 18] TimeLeft 1.9.0.5294 AMXX Dev Team timeleft.amxx running
[ 19] Pause Plugins 1.9.0.5294 AMXX Dev Team pausecfg.amxx running
[ 20] Stats Configuration 1.9.0.5294 AMXX Dev Team statscfg.amxx running
[ 21] StatsX 1.9.0.5294 AMXX Dev Team statsx.amxx running
[ 22] KZ Change Map 0.2 premium kz_change_map.a running
[ 23] Map Manager: Core 3.3.1 Mistrick map_manager_cor running
[ 24] Map Manager: Scheduler 0.2.3 Mistrick map_manager_sch running
[ 25] Map Manager: Rtv 0.1.5 Mistrick map_manager_rtv running
[ 26] Map Manager: Nominatio 0.3.6 Mistrick map_manager_nom running
[ 27] Map Manager: BlockList 0.0.4 Mistrick map_manager_blo running
[ 28] Map Manager: Online so 0.0.4 Mistrick map_manager_onl running
[ 29] Map Manager: Effects 0.1.3 Mistrick map_manager_eff running
[ 30] Map Manager: Informer 0.0.5 Mistrick map_manager_inf running
[ 31] Map Manager: Sounds 0.0.3 Mistrick map_manager_sou running
31 plugins, 31 running
Автор плагина
elit59
Версия плагина
0.2
Исходный код
#include <amxmodx>
#include <amxmisc>
#include <map_manager>

enum _:DATA
{
KZ_MINIMUM_USER,
KZ_MAXIMUM_USER,
Float:KZ_CHANGE_TASK,
Float:KZ_CHANGE_TASK2
};

new kz_cvar[DATA]

public plugin_init()
{
register_plugin("KZ Change Map", "0.2", "elit59");

bind_pcvar_num(create_cvar("kz_min_players", "0"), kz_cvar[KZ_MINIMUM_USER]);
bind_pcvar_num(create_cvar("kz_max_players", "1"), kz_cvar[KZ_MAXIMUM_USER]);
bind_pcvar_num(create_cvar("kz_change_map", "120.0"), kz_cvar[KZ_CHANGE_TASK]);
bind_pcvar_num(create_cvar("kz_change_map2", "10.0"), kz_cvar[KZ_CHANGE_TASK2]);

AutoExecConfig(true);

set_task_ex(kz_cvar[KZ_CHANGE_TASK], "KZ_MIN_VOTE", .flags = SetTask_Repeat);
}

public KZ_MIN_VOTE(id)
{
new iPlayersNum = get_playersnum_ex(GetPlayers_ExcludeBots | GetPlayers_ExcludeHLTV);

if(iPlayersNum <= kz_cvar[KZ_MINIMUM_USER])
{
mapm_stop_vote()
client_print_color(id, print_team_default, "^4[KZ] ^1Server detects players online. No Change Map!");
set_task_ex(kz_cvar[KZ_CHANGE_TASK2], "KZ_MAX_VOTE", .flags = SetTask_Repeat);
}
}

public KZ_MAX_VOTE(id)
{
new iPlayersNum = get_playersnum_ex(GetPlayers_ExcludeBots | GetPlayers_ExcludeHLTV);

if(iPlayersNum >= kz_cvar[KZ_MAXIMUM_USER])
{
mapm_start_vote(id)
client_print_color(id, print_team_default, "^4[KZ] Server is empty. Voting in progress.....");
}
}
Hello. I started a plugin, but for some reason set_task or set_task_ex just doesn't work.
what might be the problem? code is not 100% because I selected the parts from several plugins.
 
В этой теме было размещено решение! Перейти к решению.
Сообщения
3,593
Реакции
1,576
Помог
141 раз(а)
You have a task index of 0, and you are trying to do something with it
 
Сообщения
3,593
Реакции
1,576
Помог
141 раз(а)
elit59, never mind, I didn't get the code right.

I think the problem is that you are using bind_pcvar_num to bind float values.
 
Сообщения
14
Реакции
1
elit59, never mind, I didn't get the code right.

I think the problem is that you are using bind_pcvar_num to bind float values.
there were problems around set_task.
that's how I solved it.

Код:
#include <amxmodx>
#include <amxmisc>
#include <map_manager>
enum _:DATA
{
    KZ_MinUser,
    KZ_MaxUser,
    Float:KZ_Vote
};
new kz_cvar[DATA];
public plugin_init()
{
    register_plugin("KZ Change Map", "1.0", "premium");
    bind_pcvar_num(create_cvar("kz_min_players", "0", .description = "KZ Min Player on Vote"), kz_cvar[KZ_MinUser])
    bind_pcvar_num(create_cvar("kz_max_players", "1", .description = "KZ Max Player on Vote"), kz_cvar[KZ_MaxUser])
    bind_pcvar_float(create_cvar("kz_vote_time", "900.0", .description = "KZ Voting time (15 sec)"), kz_cvar[KZ_Vote])
    AutoExecConfig(true);
    
    set_task_ex(kz_cvar[KZ_Vote], "KZ_VoteCheck", .flags = SetTask_Repeat);
}
public KZ_VoteCheck(id)
{
    new iPlayersNum = get_playersnum_ex(GetPlayers_ExcludeBots | GetPlayers_ExcludeHLTV);    
    if(iPlayersNum >= kz_cvar[KZ_MaxUser])
    {
        mapm_stop_vote()
        client_print_color(id, print_team_default, "^4[KZ] ^1Server detects players online. No Change Map!");
    }
    else if(iPlayersNum <= kz_cvar[KZ_MaxUser])
    {
        mapm_start_vote(id)
        client_print_color(id, print_team_default, "^4[KZ] Server is empty. Voting in progress.....");
    }
}
there must be a better solution than this. so it's good now
29 Июл 2024
there were problems around set_task.
that's how I solved it.

Код:
#include <amxmodx>
#include <amxmisc>
#include <map_manager>
enum _:DATA
{
    KZ_MinUser,
    KZ_MaxUser,
    Float:KZ_Vote
};
new kz_cvar[DATA];
public plugin_init()
{
    register_plugin("KZ Change Map", "1.0", "premium");
    bind_pcvar_num(create_cvar("kz_min_players", "0", .description = "KZ Min Player on Vote"), kz_cvar[KZ_MinUser])
    bind_pcvar_num(create_cvar("kz_max_players", "1", .description = "KZ Max Player on Vote"), kz_cvar[KZ_MaxUser])
    bind_pcvar_float(create_cvar("kz_vote_time", "900.0", .description = "KZ Voting time (15 sec)"), kz_cvar[KZ_Vote])
    AutoExecConfig(true);
   
    set_task_ex(kz_cvar[KZ_Vote], "KZ_VoteCheck", .flags = SetTask_Repeat);
}
public KZ_VoteCheck(id)
{
    new iPlayersNum = get_playersnum_ex(GetPlayers_ExcludeBots | GetPlayers_ExcludeHLTV);   
    if(iPlayersNum >= kz_cvar[KZ_MaxUser])
    {
        mapm_stop_vote()
        client_print_color(id, print_team_default, "^4[KZ] ^1Server detects players online. No Change Map!");
    }
    else if(iPlayersNum <= kz_cvar[KZ_MaxUser])
    {
        mapm_start_vote(id)
        client_print_color(id, print_team_default, "^4[KZ] Server is empty. Voting in progress.....");
    }
}
 
Статус
В этой теме нельзя размещать новые ответы.

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

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