View Single Post
Author Message
Reiko1231
Member
Join Date: Apr 2013
Location: Russia
Old 08-01-2013 , 05:13   [CS:GO] Spawned prop push away player
Reply With Quote #1

I spawn prop with this code:
Code:
SpawnProp(iClient, iPropID, Float:fOrigin[3], Float:fAngles[3])
{
	new iEntity = CreateEntityByName("prop_dynamic");
	
	DispatchKeyValue(iEntity, "model", g_szPropPath[iPropID]);
	DispatchKeyValue(iEntity, "targetname", "prop");
	DispatchKeyValue(iEntity, "solid", "6");
	DispatchKeyValueVector(iEntity, "origin", fOrigin);
	DispatchKeyValueVector(iEntity, "angles", fAngles);
	DispatchSpawn(iEntity);
	
	SetEntProp(iEntity, Prop_Data, "m_CollisionGroup", 17);
	
	AcceptEntityInput(iEntity, "DisableShadow");
	
	SetEntPropEnt(iEntity, Prop_Send, "m_hOwnerEntity", iClient);
	return iEntity;
}
but prop, spawned with this code, push away player, when he come close.
If I change m_CollisionGroup from 0 to 50 (I tried it all), prop become unsolid in all case, except 17.
Is here any way to make prop solid and remove push away force?

Btw, this code without SetEntProp(iEntity, Prop_Data, "m_CollisionGroup", 17); spawn prop without push away in CS:S, but in CS:GO without this line prop spawned unsolid.

P.S. Sorry for bad language.


Problem Solved:
1. SetEntPropEnt(iEntity, Prop_Send, "m_hOwnerEntity", iClient); - I don't know why, but this line ruined all code before. I replace that with:
SetEntPropEnt(iEntity, Prop_Send, "m_hEffectEntity", iClient);.
2. SetEntProp(iEntity, Prop_Send, "m_usSolidFlags", 152); - don't know what is it, but it works
SetEntProp(iEntity, Prop_Send, "m_CollisionGroup", 8 ); - collusion group like a player
3. Full Code:
Code:
SpawnProp(iClient, iPropID, Float:fOrigin[3], Float:fAngles[3])
{
	new iEntity = CreateEntityByName("prop_physics_override"); 
	DispatchKeyValue(iEntity, "targetname", "prop");
	DispatchKeyValue(iEntity, "model", g_szPropPath[iPropID]);
	DispatchKeyValue(iEntity, "solid", "6");
		
	if ( DispatchSpawn(iEntity) ) 
	{
		SetEntPropEnt(iEntity, Prop_Send, "m_hEffectEntity", iClient);
		TeleportEntity(iEntity, fOrigin, fAngles, NULL_VECTOR); 
		SetEntProp(iEntity, Prop_Send, "m_usSolidFlags",  152);
		SetEntProp(iEntity, Prop_Send, "m_CollisionGroup", 8);
		AcceptEntityInput(iEntity, "DisableMotion");
		
		return iEntity;
	}
	
	return -1;
}
With this code spawned prop is pretty solid and without "push away" force.

Last edited by Reiko1231; 10-30-2013 at 10:28. Reason: Problem Solved
Reiko1231 is offline