Raised This Month: $120 Target: $400
 30% 

Solved [HELP]Exception reported: Entity 1 (1) is invalid


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
XGAK
Junior Member
Join Date: May 2018
Old 08-24-2020 , 07:43   [HELP]Exception reported: Entity 1 (1) is invalid
Reply With Quote #1

Code:
L 08/24/2020 - 17:50:17: [SM] Exception reported: Entity 1 (1) is invalid
L 08/24/2020 - 17:50:17: [SM] Blaming: freaks\the_world.ff2
L 08/24/2020 - 17:50:17: [SM] Call stack trace:
L 08/24/2020 - 17:50:17: [SM]   [0] SetEntPropEnt
L 08/24/2020 - 17:50:17: [SM]   [1] Line 461, the_world.sp::Timer_EndAbility
Here is the code.
Code:
public Action:Timer_EndAbility(Handle:htimer, int boss)
{
	ISTIMEFREEZED = false;
	char classname[60];
	SetConVarInt(FindConVar("sv_client_predict"), 1);
	for(new i=1; i<=MaxClients; i++)
	{
		if(IsValidClient(i) && !IsBoss(i))
		{
			SetClientOverlay(i, "");
			if(T_targeted[i]==1)
			{
//				new attacker = GetClientOfUserId(FF2_GetBossUserId(0));
				stabdamage=FF2_GetAbilityArgumentFloat(0, this_plugin_name, ABILITY_NAME1 , 2, 320.0);
				SDKHooks_TakeDamage(i, boss, boss, stabdamage, DMG_SLASH|DMG_ALWAYSGIB);
				T_targeted[i]=0;
			}
			SetEntityMoveType(i, iPrevCollision[i]);
			SetEntProp(i, Prop_Send, "m_bIsPlayerSimulated", 1);
			SetEntProp(i, Prop_Send, "m_bSimulatedEveryTick", 1);
			SetEntProp(i, Prop_Send, "m_bAnimatedEveryTick", 1);
			SetEntProp(i, Prop_Send, "m_bClientSideAnimation", 1);
			SetEntProp(i, Prop_Send, "m_bClientSideFrameReset", 0);
			SetEntPropFloat(i, Prop_Send, "m_flNextAttack", GetGameTime());
			new weapon = GetEntPropEnt(i, Prop_Send, "m_hActiveWeapon");
			if(IsValidEntity(weapon))
			{
				SetEntProp(weapon, Prop_Send, "m_bIsPlayerSimulated", 1);
				SetEntProp(weapon, Prop_Send, "m_bAnimatedEveryTick", 1);
				SetEntProp(weapon, Prop_Send, "m_bSimulatedEveryTick", 1);
				SetEntProp(weapon, Prop_Send, "m_bClientSideAnimation", 1);
				SetEntProp(weapon, Prop_Send, "m_bClientSideFrameReset", 0);
			}
			TF2_RemoveCondition(i, TFCond_FreezeInput);
		}
		else
		{
			iPrevCollision[i]=MOVETYPE_WALK; // Reset
		}
		SDKUnhook(i, SDKHook_OnTakeDamage, OnTakeDamageTW);
	}

	for(int entity = 33; entity <= MAXENTITIES; entity++)
	{
		if(IsValidEntity(entity))
		{
			GetEntityClassname(entity, classname, sizeof(classname));
			if(!StrContains(classname, "obj_"))
			{
				if(TF2_GetObjectType(entity) == TFObject_Dispenser
				|| TF2_GetObjectType(entity) == TFObject_Teleporter
				|| TF2_GetObjectType(entity) == TFObject_Sentry)
				{
					SetEntProp(entity, Prop_Send, "m_bDisabled", 0);
					SetEntProp(entity, Prop_Send, "m_bIsPlayerSimulated", 1);
					SetEntProp(entity, Prop_Send, "m_bAnimatedEveryTick", 1);
					SetEntProp(entity, Prop_Send, "m_bSimulatedEveryTick", 1);
					SetEntProp(entity, Prop_Send, "m_bClientSideAnimation", 1);
					SetEntProp(entity, Prop_Send, "m_bClientSideFrameReset", 1);
				}
			}
			if(!StrContains(classname, "tf_projectile"))
			{
				SetEntPropEnt(entity, Prop_Send, "m_hOwnerEntity", boss);
				if(GetEntProp(entity, Prop_Send, "m_nForceBone") == 998)
					SetEntityMoveType(entity, iPrevCollision[entity]);
				else
					SetEntityMoveType(entity, MOVETYPE_FLY);
				SetVariantInt(BossTeam);
				AcceptEntityInput(entity, "TeamNum", -1, -1, 0);
				SetVariantInt(BossTeam);
				AcceptEntityInput(entity, "SetTeam", -1, -1, 0);
				SetEntProp(entity, Prop_Send, "m_nSkin", (BossTeam==_:TFTeam_Blue) ? 1 : 0);
				// invert angles
				new Float:angle[3];
				GetEntPropVector(entity, Prop_Data, "m_angRotation", angle);
				angle[0] = -angle[0]; //fixAngle(angle[0] + 180.0);
				angle[1] = fixAngle(angle[1] + 180.0);
				// redo velocity
				new Float:velocity[3];
				GetAngleVectors(angle, velocity, NULL_VECTOR, NULL_VECTOR);
				if(StrEqual(classname, "tf_projectile_pipe_remote"))
				{
					SetEntPropEnt(entity, Prop_Data, "m_hThrower", boss);

					SDKCall(g_CTFGrenadeDetonate, entity);
				}
				if(StrEqual(classname, "tf_projectile_pipe"))
				{

					SetEntPropEnt(entity, Prop_Data, "m_hThrower", boss);

					SetEntityMoveType(entity, MOVETYPE_FLYGRAVITY);
					SDKHook(entity, SDKHook_StartTouch, ProjectileTouchHook);
					ScaleVector(velocity, 500.0);
				}
				else
					ScaleVector(velocity, 800.0);
				TeleportEntity(entity, NULL_VECTOR, angle, velocity);

				if(HasEntProp(entity, Prop_Send, "m_iDeflected"))
					SetEntPropEnt(entity, Prop_Send, "m_iDeflected", GetEntProp(entity, Prop_Send, "m_iDeflected")+1);

			}
		}
	}


	return Plugin_Continue;
}
This error appears once in a while. How can I fix it?

Last edited by XGAK; 08-28-2020 at 06:26.
XGAK is offline
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 08-24-2020 , 07:51   Re: [HELP]Exception reported: Entity 1 (1) is invalid
Reply With Quote #2

m_iDeflected is a plain integer, not an entity index, so use SetEntProp instead of SetEntPropEnt.
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.

Last edited by DJ Tsunami; 08-24-2020 at 07:58.
DJ Tsunami is offline
XGAK
Junior Member
Join Date: May 2018
Old 08-24-2020 , 08:02   Re: [HELP]Exception reported: Entity 1 (1) is invalid
Reply With Quote #3

Quote:
Originally Posted by DJ Tsunami View Post
m_iDeflected is a plain integer, not an entity index, so use SetEntProp instead of SetEntPropEnt.
Thanks!
Will fix it.
XGAK is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:07.


Powered by vBulletin®
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Theme made by Freecode