Raised This Month: $ Target: $400
 0% 

[CS:GO] Spawned prop push away player


Post New Thread Reply   
 
Thread Tools Display Modes
wanted2411
Senior Member
Join Date: Jun 2012
Old 09-07-2013 , 05:25   Re: [CS:GO] Spawned prop push away player
Reply With Quote #11

For physics ents you need to use this code:

Code:
DispatchKeyValue(ent, "spawnflags", "8");
wanted2411 is offline
wanted2411
Senior Member
Join Date: Jun 2012
Old 09-07-2013 , 05:29   Re: [CS:GO] Spawned prop push away player
Reply With Quote #12

And try this:

Code:
SetEntProp(ent, Prop_Data, "m_usSolidFlags", 28);
SetEntProp(ent, Prop_Data, "m_nSolidType", 6);
wanted2411 is offline
Reiko1231
Member
Join Date: Apr 2013
Location: Russia
Old 09-08-2013 , 03:36   Re: [CS:GO] Spawned prop push away player
Reply With Quote #13

Native "SetEntProp" reported: Property "m_usSolidFlags" not safe to access (entity 136/prop_dynamic)

m_nSolidType and spawnflags doesn't help. prop always unsolid and empty.
Current code, which I use to spawn prop:
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");
	DispatchKeyValueVector(iEntity, "origin", fOrigin);
	DispatchKeyValueVector(iEntity, "angles", fAngles);
	DispatchSpawn(iEntity);
	
	SetEntProp(iEntity, Prop_Data, "m_nSolidType", 6);
	//SetEntProp(iEntity, Prop_Data, "m_usSolidFlags", 28);
	
	SetEntityMoveType(iEntity, MOVETYPE_NONE);
	AcceptEntityInput(iEntity, "DisableShadow");
	
	SetEntPropEnt(iEntity, Prop_Send, "m_hOwnerEntity", iClient);
	return iEntity;
}
Reiko1231 is offline
wanted2411
Senior Member
Join Date: Jun 2012
Old 09-08-2013 , 08:50   Re: [CS:GO] Spawned prop push away player
Reply With Quote #14

Code:
SetEntProp(ent, Prop_Send, "m_usSolidFlags", 28);

Last edited by wanted2411; 09-08-2013 at 08:50.
wanted2411 is offline
Marcus_Brown001
AlliedModders Donor
Join Date: Nov 2012
Location: Illinois, United States
Old 09-08-2013 , 11:44   Re: [CS:GO] Spawned prop push away player
Reply With Quote #15

This is what I use to spawn props and mess around with them. Haven't run into issues with it, but I haven't played around with it too much on other games, only extensively tested on HL2DM. Modified it a little to do what you are looking for. Hope this helps!

PHP Code:
new iEnt CreateEntityByName("prop_physics_override");
    
Format(sTargetsizeof(sTarget), "SimpleBuild:%s"sAuth);
DispatchKeyValue(iEnt"targetname"sTarget);
    
PrecacheModel(sModel);
DispatchKeyValue(iEnt"model"sModel);
DispatchKeyValue(iEnt"rendermode""5");
    
if (
DispatchSpawn(iEnt))
{
     
AcceptEntityInput(iEnt"DisableMotion");
     
TeleportEntity(iEntfOriginfAnglesNULL_VECTOR);
        
     return 
iEnt;
} else
    return -
1
Marcus_Brown001 is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 09-08-2013 , 12:31   Re: [CS:GO] Spawned prop push away player
Reply With Quote #16

Quote:
Originally Posted by Marcus_Brown001 View Post
This is what I use to spawn props and mess around with them. Haven't run into issues with it, but I haven't played around with it too much on other games, only extensively tested on HL2DM. Modified it a little to do what you are looking for. Hope this helps!

PHP Code:
new iEnt CreateEntityByName("prop_physics_override");
    
Format(sTargetsizeof(sTarget), "SimpleBuild:%s"sAuth);
DispatchKeyValue(iEnt"targetname"sTarget);
    
PrecacheModel(sModel);
DispatchKeyValue(iEnt"model"sModel);
DispatchKeyValue(iEnt"rendermode""5");
    
if (
DispatchSpawn(iEnt))
{
     
AcceptEntityInput(iEnt"DisableMotion");
     
TeleportEntity(iEntfOriginfAnglesNULL_VECTOR);
        
     return 
iEnt;
} else
    return -
1
I think he wants the prop to still move, just the player can push it.
Mitchell is offline
Marcus_Brown001
AlliedModders Donor
Join Date: Nov 2012
Location: Illinois, United States
Old 09-08-2013 , 15:39   Re: [CS:GO] Spawned prop push away player
Reply With Quote #17

In his original snippet he creates a prop_dynamic and sets the move type to none; wouldn't that make the prop stay fixed in its location? The way he worded the title of the thread I thought his problem was that the prop is pushing the player away when he comes into contact with it.
Marcus_Brown001 is offline
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
Dkmuniz
Senior Member
Join Date: Jun 2013
Old 03-04-2014 , 18:09   Re: [CS:GO] Spawned prop push away player
Reply With Quote #19

How to put to prop broken, like chair?

Last edited by Dkmuniz; 03-04-2014 at 18:10.
Dkmuniz is offline
Reply



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:50.


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