amxmodx icon indicating copy to clipboard operation
amxmodx copied to clipboard

"cs_set_user_team" behavior change from 1.9 to 1.10

Open OciXCrom opened this issue 5 years ago • 8 comments

I got some reports that there's a problem with a very popular plugin - https://forums.alliedmods.net/showthread.php?t=78197

Everything's working fine up to AMXX 1.9. Switching to 1.10 causes this error log:

L 03/09/2021 - 21:04:13: [CSTRIKE] Invalid player 1 (not in-game)
L 03/09/2021 - 21:04:13: [AMXX] Displaying debug trace (plugin "DeathrunManager.amxx", version "3.0.3")
L 03/09/2021 - 21:04:13: [AMXX] Run time error 10: native error (native "cs_set_user_team")
L 03/09/2021 - 21:04:13: [AMXX]    [0] DeathrunManager.sma::UpdateBot (line 241)

This makes the Deathrun bot stay spectator which pretty much makes the entire functionallity useless.

Here's the code in question:

id = engfunc( EngFunc_CreateFakeClient, g_szBotName );
if( pev_valid( id ) ) {
	engfunc( EngFunc_FreeEntPrivateData, id );
	dllfunc( MetaFunc_CallGameEntity, "player", id );
	set_user_info( id, "rate", "3500" );
	set_user_info( id, "cl_updaterate", "25" );
	set_user_info( id, "cl_lw", "1" );
	set_user_info( id, "cl_lc", "1" );
	set_user_info( id, "cl_dlmax", "128" );
	set_user_info( id, "cl_righthand", "1" );
	set_user_info( id, "_vgui_menus", "0" );
	set_user_info( id, "_ah", "0" );
	set_user_info( id, "dm", "0" );
	set_user_info( id, "tracker", "0" );
	set_user_info( id, "friends", "0" );
	set_user_info( id, "*bot", "1" );
	set_pev( id, pev_flags, pev( id, pev_flags ) | FL_FAKECLIENT );
	set_pev( id, pev_colormap, id );
	
	new szMsg[ 128 ];
	dllfunc( DLLFunc_ClientConnect, id, g_szBotName, "127.0.0.1", szMsg );
	dllfunc( DLLFunc_ClientPutInServer, id );
	
	cs_set_user_team( id, CS_TEAM_T );
	ExecuteHamB( Ham_CS_RoundRespawn, id );
	
	set_pev( id, pev_effects, pev( id, pev_effects ) | EF_NODRAW );
	set_pev( id, pev_solid, SOLID_NOT );
	dllfunc( DLLFunc_Think, id );
	
	g_iFakeplayer = id;
}

OciXCrom avatar Mar 09 '21 20:03 OciXCrom

Can you try 5414?

Likely broken since #883 and a pending #917 (just merged) might helps this situation.

Arkshine avatar Mar 09 '21 22:03 Arkshine

Nope. Issue still remains with 5414.

OciXCrom avatar Mar 09 '21 22:03 OciXCrom

Please make sure you did properly update (main binary).

No changes were made in CS module in 1.10. The only relevant recent changes are the PR quoted above (core), I believe.

Arkshine avatar Mar 09 '21 22:03 Arkshine

I triple checked, don't worry. "amxx version" outputed 5414 so it's fine.

OciXCrom avatar Mar 09 '21 22:03 OciXCrom

Maybe related to #752?

OciXCrom avatar Mar 09 '21 22:03 OciXCrom

I don't have the time to properly think/investigate on this matter at the moment. If you don't know how to fix what you started, I believe we should revert #883 and #917 until you have working and non-breaking change solution to propose.

Arkshine avatar Mar 11 '21 20:03 Arkshine

I did not say it was wrong, I'm saying to not break current working plugins -- if we can. I have no idea what could be a solution. You can always try & propose, then it can be discussed.

Arkshine avatar Mar 11 '21 21:03 Arkshine

				dllfunc( DLLFunc_ClientConnect, id, g_szBotName, "127.0.0.1", szMsg );
				dllfunc( DLLFunc_ClientPutInServer, id );
				//check if they are connected here
				if(is_user_connected(id))
  				    cs_set_user_team( id, CS_TEAM_T ); ```

djearthquake avatar Jan 18 '24 01:01 djearthquake