View Single Post
wanted2411
Senior Member
Join Date: Jun 2012
Old 09-04-2013 , 12:39   Re: [CS:GO] Spawned prop push away player
Reply With Quote #4

Try to enable/disable collisions for ents:

Code:
bool:CreateEntity(client, String:mdlMine[])
{
	new entity = CreateEntityByName("prop_dynamic_override");
	PrecacheModel(mdlMine);
	SetEntityModel(entity, mdlMine);
	if (entity != -1)
	{
		decl Float:min[3], Float:max[3];

		GetEntPropVector(entity, Prop_Send, "m_vecMins", min);
		GetEntPropVector(entity, Prop_Send, "m_vecMaxs", max);

		decl Float:position[3], Float:ang_eye[3], Float:ang_ent[3], Float:normal[3];
		
		if (GetClientAimedLocationData(client, position, ang_eye, normal) == -1)
		{
			AcceptEntityInput(entity, "Kill");
		}
		
		GetVectorAngles(normal, ang_ent);
		ang_ent[0] += 90.0;

		position[0] -= normal[0] * min[2];
		position[1] -= normal[1] * min[2];
		position[2] -= normal[2] * min[2];

		DispatchKeyValue(entity, "Solid", "6");
		DispatchKeyValueVector(entity, "Origin", position);
		DispatchKeyValueVector(entity, "Angles", ang_ent);
		DispatchSpawn(entity);

		AcceptEntityInput(entity, "DisableCollision");
		AcceptEntityInput(entity, "EnableCollision");
		
		return true;
	}
	return false;
}
wanted2411 is offline