View Single Post
Reiko1231
Member
Join Date: Apr 2013
Location: Russia
Old 10-30-2013 , 10:33   Re: [CS:GO] Spawned prop push away player
Reply With Quote #18

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.
Thanks to Darkranger, for plugin "CS:GO Drop Random Healthpack Plugin", - SetEntProp(iEntity, Prop_Send, "m_usSolidFlags", 152) I took from his plugin.
Reiko1231 is offline