Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Run time error 10: native error (native "menu_display") #18

Closed
alexplesoiu opened this issue Aug 30, 2020 · 15 comments
Closed

Run time error 10: native error (native "menu_display") #18

alexplesoiu opened this issue Aug 30, 2020 · 15 comments

Comments

@alexplesoiu
Copy link

alexplesoiu commented Aug 30, 2020

Hi, i just installed latest amxmodx version ("amxmodx_version" = "1.10.0.5406") and pugmode with no other plugin!
However, sometimes when i type !startpug or .vote the menu isn't displayed bcs of some native error

Log:
L 08/31/2020 - 02:22:13: Invalid menu id -1(2)
L 08/31/2020 - 02:22:13: [AMXX] Displaying debug trace (plugin "PugMenus.amxx", version "3.1.1")
L 08/31/2020 - 02:22:13: [AMXX] Run time error 10: native error (native "menu_display")
L 08/31/2020 - 02:22:13: [AMXX] [0] PugMenus.inc::PUG_DisplayMenuClient (line 64)

Modules:
FakeMeta 1.10.0.540 AMX Mod X Dev Team running
CStrike 1.10.0.540 AMX Mod X Dev Team running
CSX 1.10.0.540 AMX Mod X Dev Team running
Ham Sandwich 1.10.0.540 AMX Mod X Dev Team running

@alexplesoiu
Copy link
Author

Update:
I'm testing it on linux (both, server and counter-strike client).
Now even !startpug doesn't display anything. When i'm typing .vote, nothing is displayed so i started to debug (i haven't touch amx for years so i have to re-read all the documentation for libs and apis).

I picked the PUG_DisplayMenuClient function and added some server_prints to see what's happening

And after that i noticed that player_menu_info(id,iMenu[0],iMenu[1]) is ALWAYS returning 1, even if i don't have any menu opened. And i rememberd that some time ago was a bug with VGUI menu and i switched to old style menus.
And.. surprise, everything works just fine with old style menus, so it is a bug when used with vgui menu!
I switched back to VGUI and again menus just don't work.

`public PUG_DisplayMenuClient(id)
{
if(is_user_connected(id))
{
new iMenu[2];

	if(!player_menu_info(id,iMenu[0],iMenu[1]))
	{
		menu_display(id,g_iViewMenu[id]);
		server_print("NO MENU IS OPENED g_iViewMenu %d",g_iViewMenu[id]);
	}
	else
	{
		new iPMenuInfo = player_menu_info(id,iMenu[0],iMenu[1]);
		server_print("MENU OPENED");
		server_print("player_menu_info = %d, iMenu[0] = %d, iMenu[1] = %d", iPMenuInfo, iMenu[0], iMenu[1]);
		set_task(1.0,"PUG_DisplayMenuClient",id);
	}
}

}`

Printing values:

MENU OPENED
player_menu_info = 1, iMenu[0] = -27, iMenu[1] = -1

@SmileYzn
Copy link
Owner

SmileYzn commented Aug 31, 2020

I already fixed this for next version, i really need a bit more time to upload new pug bro.

I think someone already reported in amxx repository the bug with player_menu_info or m_iMenu player variable on hlds, or also can be because i'm using rehlds to test pug.

You can safely use:

public PUG_DisplayMenuClient(id) { menu_display(id,g_iViewMenu[id]); }

to avoid that bug with vgui menus. I only do that function to prevent game menus being override with new icoming menu from pug

Thanks for reporting it bro

@alexplesoiu
Copy link
Author

alexplesoiu commented Aug 31, 2020

I fixed that by checking iMenu[0] < 1 before displaying the menu.

Did you planned big changes between versions ?

@SmileYzn
Copy link
Owner

I changed whole mod to use only reapi, i do not think that amxx will update more than reapi that is good to use.
Also with rehlds + reapi you can simple use some cvars to adjust the game than coding in plugin, like auto respawn in pregame, objectives remove and other small things. What you think bro?

@alexplesoiu
Copy link
Author

alexplesoiu commented Aug 31, 2020

I have started to read more about rehlds and reapi and i'm excited about the project, but unfortunate valve doesn't accept and support it. So, personally i will stick with the official hlds just because valve doesn't support it. i know that it has some compatibility issues with other modules also. I know that rehlds solve many issues like bugs, exploits, performance but at the moment i'm trying to see if everything works well for me with official engine. If my servers will be heavy exploited and i cannot patch it somehow (eg. writing a module or a plugin that fix the issue) i will take in consideration switching to rehlds.

About the plugin, i think it's a good ideea to update it for rehlds and reapi because more and more people are adopting it and also you save performance using engine apis instead of plugin code. But keep in mind that not everyone adopted rehlds so, my sugestion is to make it as a separate project and keep the actual repo for official engine and another one for rehlds + reapi.
You have to support both projects, but i don't think it's a big deal.
Also, i looked a bit in source code and i have to say, good job for documenting libraries!
Using forwards and natives it's also nice because it will help me creating 3rd party plugins integrated with pug mode!

I checked pugcore and i think you can improve autoban system.
You can make a delayed ban with a cvar (time in minutes) and wait for player to come back. Maybe his cs client just crashed
or he disconnected by mistake or maybe he just wanted to restart his client.
Another sugestions: make cvars for ".vote" menu. So items can be enabled or disabled. (maybe someone doesn't want to support votemap system, or vote kick, etc).
You can also add a knife round for picking sides after teams are ready. (i think i will make a plugin for this)
What do you think? :)

I will make some plugins using natives and forwards to integrate your plugin with a gaming platform
I haven't looked over the entire source code yet, but i will, and if i have sugestions i will post them!
Nice job bro!

@SmileYzn
Copy link
Owner

SmileYzn commented Sep 1, 2020

About disconnects, server detect some situations like this, i do not think that is a big problem but can create other ban system out of the box, and out of core plugin, i think somthing like pug menus, that are used out of core plugin. For me, it will be better to manage bans. I also started to coding a new ban system using sqlite or any sqlite compatible.

About vote, in new version is a new plugin with one menu only, that you can choose the vote you like to run in server.
I really do not think how knife round will work, is many variables to control, like round time and map positions of players, that can not run out of range of fight.

@alexplesoiu
Copy link
Author

alexplesoiu commented Sep 1, 2020

Yes, i think is a good ideea to create plugins ot of the box and out of the core plugin. In the core plugin you should keep just the core system (like the game system) and everything else, like banning system, map voting system should be made as separate packages because it will save some performance when they are disabled (fewer checks) and the most important thing, it will be easier to edit and manage them. Of course, with forwards and natives will be a slower performance (not very much) when the packages are loaded, but it's 2020 :D and making it easier to mantain and use it's a big plus!

Also, when u release new updates, try to make the everything backwards compatible by keeping the natives, forwards and states, so the packages made for your plugin will still work. And please, don't forget to make a version for the hlds official engine.

About the knife round. You don't have to overcomplicate, let them run on the entire map if they want. You cand just add a new state for knife rounds, when round start, check the state (or you can make a package and use only a boolean variable), if it's knife round strip the guns and disable buy zones and let them play. Or you cand force only knife on client as a weapon and you don't need to strip and disable buy zone. When the round is over, the winning team is the team with more players alive, if they are same, the team with more hp. You can display a menu for players where they can vote what side they want to play, and.. that's it. Live and go! If you really want to make it with fight range and not care about the guns and smth else, you can load a knife map :D (sounds crazy, but it's a new ideea) they fight there and then load the game map and start the pug.

@SmileYzn
Copy link
Owner

SmileYzn commented Sep 1, 2020

Forward do not affect performance, since is not executed while game is running, check for example warmup plugin, that store the result of PugEvent instead of check using PugGetState.

@alexplesoiu
Copy link
Author

alexplesoiu commented Sep 2, 2020

Ohh, yess you're alright. My bad bro!

Edit: Another thing you cand add in your pug system is HLTV support!

@SmileYzn
Copy link
Owner

SmileYzn commented Sep 2, 2020

I already do this in past, is not hard need only to fix hudmessages that is sent to hltv, these messages are crashing hltv proxy.

@SmileYzn
Copy link
Owner

SmileYzn commented Sep 2, 2020

Did you have any contact form? That you can send it bro?

@alexplesoiu
Copy link
Author

ofc bro, add me on steam: https://steamcommunity.com/id/pleso
Tell me your nickname so i can accept your request!

@DaHanG95
Copy link

DaHanG95 commented Oct 8, 2020

I fixed that by checking iMenu[0] < 1 before displaying the menu.

Did you planned big changes between versions ?

Would you care to explain to a noob in programming? Im trying to run it too on HLDS.

@illiaKuryaki
Copy link

I also have this problem, any tip on how to fix it ?

@SmileYzn
Copy link
Owner

Fixed menu display.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants