Raised This Month: $52 Target: $400
 13% 

Solved [L4D] Create Brush Entity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Vit_amin
Senior Member
Join Date: Dec 2015
Location: Russian Federation
Old 08-17-2019 , 11:12   [L4D] Create Brush Entity
Reply With Quote #1

Hello Everyone. I'll tried create brush entity func_nav_blocker
Code:
#include <sdktools_functions>

public void OnPluginStart()
{
    RegConsoleCmd("sm_getprop", CMD_GetVecs);
    RegConsoleCmd("create_nav", CreateNav)
	//HookEvent("round_freeze_end", view_as<EventHook>(Event_RoundFreezeEnd), EventHookMode_PostNoCopy);
}

public void OnMapStart()
{
	PrecacheModel("models/error.mdl", true);
}

// farm02
// m_vecOrigin: {-8352.0, -6526.5, 152.5}, m_vecMins: {-8385.0, -6632.0, 80.0}, m_vecMaxs: {-8319.0, -6421.0, 225.0}
// m_vecOrigin: {-8352.0, -6711.0, 9.5}, m_vecMins: {-8385.0, -6792.0, -63.0}, m_vecMaxs: {-8319.0, -6630.0, 82.0}

public void Event_RoundFreezeEnd(Event hEvent)
{
	CreateNavEntity();
}

public Action CreateNav(int iClient, int iArgs)
{
	CreateNavEntity();
}

void CreateNavEntity()
{
	float m_vecMins[3];
	float m_vecMaxs[3];
	
	int iEntity = CreateEntityByName("func_nav_blocker");
	
	if (iEntity != -1)
	{
		DispatchKeyValueVector(iEntity, "origin", view_as<float>({-8352.0, -6526.5, 152.5}));
		
		DispatchSpawn(iEntity);
		//ActivateEntity(iEntity); // ?
		
		//TeleportEntity(iEntity, view_as<float>({-8352.0, -6526.5, 152.5}), NULL_VECTOR, NULL_VECTOR);
		SetEntityModel(iEntity, "models/error.mdl");
	
		m_vecMins[0] = -8352.0 + 8385.0;
		m_vecMins[1] = -6526.5 + 6632.0;
		m_vecMins[2] = 152.5 - 80.0;
		
		m_vecMaxs[0] = -8352.0 + 8319.0;
		m_vecMaxs[1] = -6526.5 + 6421.0;
		m_vecMaxs[2] = 152.5 - 225.0;
		
		SetEntPropVector(iEntity, Prop_Send, "m_vecMins", m_vecMins);
		SetEntPropVector(iEntity, Prop_Send, "m_vecMaxs", m_vecMaxs);
		
		SetEntPropVector(iEntity, Prop_Data, "m_vecSurroundingMins", m_vecMins);
		SetEntPropVector(iEntity, Prop_Data, "m_vecSurroundingMaxs", m_vecMaxs);
		//SetEntPropVector(iEntity, Prop_Data, "m_vecSurroundingMins", view_as<float>({-8385.0, -6632.0, 80.0}));
		//SetEntPropVector(iEntity, Prop_Data, "m_vecSurroundingMaxs", view_as<float>({-8319.0, -6421.0, 225.0}));
		
		//SetEntProp(iEntity, Prop_Send, "m_nSolidType", 0);
		
		//new enteffects = GetEntProp(iEntity, Prop_Send, "m_fEffects");
		//enteffects |= 32;
		//SetEntProp(iEntity, Prop_Send, "m_fEffects", enteffects);
	}
}

public Action CMD_GetVecs(int iClient, int iArgs)
{
	int iEntity = -1;
	float m_vecOrigin[3];
	float m_vecMins[3];
	float m_vecMaxs[3];
	float m_vecMins1[3];
	float m_vecMaxs1[3];
	
	while ((iEntity = FindEntityByClassname(iEntity, "func_nav_blocker")) != -1)
	{
		GetEntPropVector(iEntity, Prop_Send, "m_vecOrigin", m_vecOrigin);
		GetEntPropVector(iEntity, Prop_Send, "m_vecMins", m_vecMins);
		GetEntPropVector(iEntity, Prop_Send, "m_vecMaxs", m_vecMaxs);
		
		GetEntPropVector(iEntity, Prop_Data, "m_vecSurroundingMins", m_vecMins1);
		GetEntPropVector(iEntity, Prop_Data, "m_vecSurroundingMaxs", m_vecMaxs1);
		
		//PrintToChatAll("m_vecOrigin: {%.1f, %.1f, %.1f}, m_vecMins: {%.1f, %.1f, %.1f}, m_vecMaxs: {%.1f, %.1f, %.1f}", m_vecOrigin[0], m_vecOrigin[1], m_vecOrigin[2], m_vecMins[0], m_vecMins[1], m_vecMins[2], m_vecMaxs[0], m_vecMaxs[1], m_vecMaxs[2]);
		PrintToChatAll("m_vecMins: {%.1f, %.1f, %.1f}, m_vecMaxs: {%.1f, %.1f, %.1f}", m_vecMins1[0], m_vecMins1[1], m_vecMins1[2], m_vecMaxs1[0], m_vecMaxs1[1], m_vecMaxs1[2]);
		//PrintToChatAll("m_nSolidType = %i", GetEntProp(iEntity, Prop_Send, "m_nSolidType"));
	}
	
	return Plugin_Handled;
}
Entity spawned, but Navigation areas doesn't blocked by func_nav_blocker
I checked this in local server (ent_fire func_nav_blocker BlockNav) - doesn't effect

Where is mistake ?
Maybe this help

Last edited by Vit_amin; 08-20-2019 at 15:27.
Vit_amin is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine
Old 08-20-2019 , 06:16   Re: [L4D] Create Brush Entity
Reply With Quote #2

Afaik, to change navigation it require you edit nav files using developer mode. See samples in cfg/nav_mode.cfg
__________________
Expert of CMD/VBS/VB6. Malware analyst.
[My plugins] [My tools] [GitHub]

Last edited by Dragokas; 08-20-2019 at 06:18.
Dragokas is offline
Vit_amin
Senior Member
Join Date: Dec 2015
Location: Russian Federation
Old 08-20-2019 , 10:26   Re: [L4D] Create Brush Entity
Reply With Quote #3

Navigation Mesh edition doesn't connected with Entity func_nav_blocker. Cfg file nav_mode.cfg execute only binds commands for client
Vit_amin 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 19:17.


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