Преработка на "Team Select" дава грешка в error.log

В този раздел можете да подавате всякакви заявки за намиране, изработка или преработка на плъгини/модове.
Отговори
Потребителски аватар

Автор на темата
M36
Потребител
Потребител
Мнения: 62
Регистриран: 19 фев 2019, 11:34
Се отблагодари: 7 пъти

Преработка на "Team Select" дава грешка в error.log

Мнение от M36 » 29 юни 2019, 13:08

Добър ден , плъгинът ми дава следната грешка :
[ReAPI] rg_join_team: player 1 is not connected
[AMXX] Displaying debug trace (plugin "reapi_auto_connect.amxx", version "1.5.0")
[AMXX] Run time error 10: native error (native "rg_join_team")
[AMXX] [0] reapi_auto_connect.sma::client_putinserver (line 79)
[ReAPI] rg_join_team: player 2 is not connected
[AMXX] Displaying debug trace (plugin "reapi_auto_connect.amxx", version "1.5.0")
[AMXX] Run time error 10: native error (native "rg_join_team")
[AMXX] [0] reapi_auto_connect.sma::client_putinserver (line 79)
ето и плъгина:

Код: Избери всички

/**
*
* Name: Team Menu
* Version: 1.5.0 (04.02.2019)
* Author: F@nt0M
* Description: The plugin show custom team select menu instead of default
*
* Requirements: ReHLDS, ReGameDLL, AmxModX 1.9.0, ReAPI
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>
*
*/

#include <amxmodx>
#include <reapi>

enum { MODE_NORMAL_TEAM, MODE_RANDOM_TEAM }
enum { SPEC_ALWAYS, SPEC_AFTER_JOIN }

new HookChain:HookShowMenuPre
new Mode, Spectators, Appearance, Unlimited, Float:TimeLimit, AdminFlags = ADMIN_BAN, Autojoin, AutojoinImminity = ADMIN_BAN
new Float:NextChooseTeamTime[MAX_PLAYERS + 1]

public plugin_init() 
{
	register_plugin("Team Select", "1.5.0", "F@nt0M")
	register_dictionary("reapi_auto_connect.txt")

	RegisterHookChain(RG_ShowVGUIMenu, "ShowVGUIMenu_Pre", false)
	RegisterHookChain(RG_HandleMenu_ChooseTeam, "HandleMenu_ChooseTeam_Pre", false)
	RegisterHookChain(RG_HandleMenu_ChooseTeam, "HandleMenu_ChooseTeam_Post", true)
	DisableHookChain(HookShowMenuPre = RegisterHookChain(RG_ShowMenu, "ShowMenu_Pre", false))

	new pcvar
	pcvar = create_cvar("amx_ts_mode", "0", FCVAR_SERVER, fmt("%L", LANG_SERVER, "TS_MODE_DESC"), true, 0.0, true, 1.0)
	bind_pcvar_num(pcvar, Mode)

	pcvar = create_cvar("amx_ts_spec", "0", FCVAR_SERVER, fmt("%L", LANG_SERVER, "TS_SPEC_DESC"), true, 0.0, true, 1.0)
	bind_pcvar_num(pcvar, Spectators)

	pcvar = create_cvar("amx_ts_appearance", "0", FCVAR_SERVER, fmt("%L", LANG_SERVER, "TS_APPEARANCE_DESC"), true, 0.0, true, 1.0)
	bind_pcvar_num(pcvar, Appearance)

	pcvar = create_cvar("amx_ts_unlimited", "1", FCVAR_SERVER, fmt("%L", LANG_SERVER, "TS_UNLIMITED_DESC"), true, 0.0, true, 1.0)
	bind_pcvar_num(pcvar, Unlimited)

	pcvar = create_cvar("amx_ts_time_limit", "45.0", FCVAR_SERVER, fmt("%L", LANG_SERVER, "TS_TIME_LIMIT_DESC"), true, 0.0)
	bind_pcvar_float(pcvar, TimeLimit)

	pcvar = create_cvar("amx_ts_autojoin", "1", FCVAR_SERVER, fmt("%L", LANG_SERVER, "TS_AUTOJOIN_DESC"), true, 0.0, true, 1.0)
	bind_pcvar_num(pcvar, Autojoin)

	pcvar = create_cvar("amx_ts_admin_flags", "b", FCVAR_SERVER, fmt("%L", LANG_SERVER, "TS_FLAGS_DESC"))
	hook_cvar_change(pcvar, "HookChangeFlag")

	pcvar = create_cvar("amx_ts_autojoin_immunity", "b", FCVAR_SERVER, fmt("%L", LANG_SERVER, "TS_AUTOJOIN_IMMUNITY_DESC"), true, 0.0, true, 1.0)
	hook_cvar_change(pcvar, "HookChangeImmunity")
}

public HookChangeFlag(const pcvar, const oldValue[], const newValue[]) AdminFlags = read_flags(newValue);
public HookChangeImmunity(const pcvar, const oldValue[], const newValue[]) AutojoinImminity = read_flags(newValue);

public client_putinserver(id)
{
	NextChooseTeamTime[id] = 0.0;
	if (!Autojoin) return
	if (AutojoinImminity && (get_user_flags(id) & AutojoinImminity == AutojoinImminity)) return
	rg_join_team(id, rg_get_join_team_priority())
}

public ShowVGUIMenu_Pre(const id, VGUIMenu:menuType) 
{
	if (is_user_bot(id) || menuType != VGUI_Menu_Team) return HC_CONTINUE

	if (TimeLimit && NextChooseTeamTime[id] >= get_gametime()) 
	{
		client_printex(id, print_center, "#Only_1_Team_Change")
		return HC_SUPERCEDE
	}

	new bool:newPlayer = bool:(TeamName:get_member(id, m_iTeam) == TEAM_UNASSIGNED)
	SetGlobalTransTarget(id)

	new menu[MAX_MENU_LENGTH], keys
	new len = formatex(menu, charsmax(menu), "\w%l^n^n", "TS_SELECT_TEAM")
	if (Mode == MODE_NORMAL_TEAM) 
	{
		len += formatex(menu[len], charsmax(menu) - len, "\d[\r1\d] \r%l \d[\y%d\d]^n", "TS_TEAM_T", get_member_game(m_iNumTerrorist))
		len += formatex(menu[len], charsmax(menu) - len, "\d[\r2\d] \r%l \d[\y%d\d]^n", "TS_TEAM_CT", get_member_game(m_iNumCT))
		keys |= MENU_KEY_1 | MENU_KEY_2
	} 
	else 
	{
		len += formatex(menu[len], charsmax(menu) - len, "\d[\r1\d] \r%l^n", newPlayer ? "TS_ENTER_GAME" : "TS_CHANGE_TEAM")
		keys |= MENU_KEY_1
	}

	if (Spectators == SPEC_ALWAYS || (Spectators == SPEC_AFTER_JOIN && !newPlayer) || (AdminFlags && (get_user_flags(id) & AdminFlags) == AdminFlags))
	{
		len += formatex(menu[len], charsmax(menu) - len, "^n\d[\r6\d] \w%l^n", "TS_SPECTATOR")
		keys |= MENU_KEY_6
	}

	if (!newPlayer)
	{
		len += formatex(menu[len], charsmax(menu) - len, "^n^n\d[\r0\d] \w%l^n", "TS_CLOSE")
		keys |= MENU_KEY_0
	}

	set_member(id, m_bForceShowMenu, true)
	SetHookChainArg(3, ATYPE_INTEGER, keys)
	SetHookChainArg(4, ATYPE_STRING, menu)

	if (strlen(menu) > 192) EnableHookChain(HookShowMenuPre)
	return HC_CONTINUE
}

// Fix menu limit in ReGameDLL (https://github.com/s1lentq/ReGameDLL_CS/blob/9d89a347fa22662b716697c97150ddea2bd00d99/regamedll/dlls/client.cpp#L394)
public ShowMenu_Pre(const id, const keys, const time, const needMore, const menu[])
{
	DisableHookChain(HookShowMenuPre)
	show_menu(id, keys, menu, time)
	set_member(id, m_iMenu, Menu_ChooseTeam) // AMXX overide m_iMenu after show_menu
	return HC_SUPERCEDE
}

public HandleMenu_ChooseTeam_Pre(const id, const MenuChooseTeam:slot) {
	if (is_user_bot(id)) return HC_CONTINUE

	if (slot == MenuChoose_Spec)
	{
		if (is_user_alive(id)) user_silentkill(id)
	}
	else 
	{
		if (Mode == MODE_RANDOM_TEAM)
		{
			new MenuChooseTeam:team
			switch (TeamName:get_member(id, m_iTeam)) {
				case TEAM_TERRORIST: team = MenuChoose_CT
				case TEAM_CT: team = MenuChoose_T
				default: team = MenuChoose_AutoSelect
			}
			SetHookChainArg(2, ATYPE_INTEGER, team)
		}

		if (!Appearance)
		{
			if (is_user_alive(id)) user_silentkill(id)
			set_member_game(m_bSkipShowMenu, true)
		}
	}
	return HC_CONTINUE
}

public HandleMenu_ChooseTeam_Post(const id, const MenuChooseTeam:slot)
{
	if (!GetHookChainReturn(ATYPE_INTEGER)) return
	if (Unlimited) set_member(id, m_bTeamChanged, false)
	
	NextChooseTeamTime[id] = get_gametime() + TimeLimit
	if (slot == MenuChoose_Spec || Appearance) return

	set_member_game(m_bSkipShowMenu, false)
	if (get_member(id, m_bJustConnected))
	{
		set_member(id, m_iJoiningState, GETINTOGAME)
		set_member(id, m_bJustConnected, false)
	}
	set_member(id, m_iMenu, Menu_ChooseAppearance)
	rg_internal_cmd(id, "joinclass", "5")
}
Благодаря предварително!

Отговори

Върни се в “Заявки за плъгини”

Кой е на линия

Потребители, разглеждащи този форум: Няма регистрирани потребители и 2 госта