Raised This Month: $ Target: $400
 0% 

Add or remove Flags of Entitys


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
V0gelz
Senior Member
Join Date: Jun 2004
Old 12-09-2008 , 08:13   Add or remove Flags of Entitys
Reply With Quote #1

Hi,

Well i couldn't find a way to insert flags into a entity.
What function can i use to add flags into my entitys that i spawn?

I want it that the env_shake shakes everything in the map. 8 is for the physics etc also do i need to count them up if i want all the flags on?

http://developer.valvesoftware.com/wiki/Env_shake

Code:
stock env_shake(client, Float:Amplitude, Float:Radius, Float:Duration, Float:Frequency)
{
	//Declare:
	decl Ent;

	//Initialize:
	Ent = CreateEntityByName("env_shake");
		
	//Declare:
	decl Float:ClientOrigin[3];

	//Properties:
	DispatchKeyValueFloat(Ent, "amplitude", Amplitude);
	DispatchKeyValueFloat(Ent, "radius", Radius);
	DispatchKeyValueFloat(Ent, "duration", Duration);
	DispatchKeyValueFloat(Ent, "frequency", Frequency);

	//Spawn:
	DispatchSpawn(Ent);

	//Input:
	AcceptEntityInput(Ent, "StartShake", client);
	
	//Origin:
	GetClientAbsOrigin(client, ClientOrigin);
		
	//Send:
	TeleportEntity(Ent, ClientOrigin, NULL_VECTOR, NULL_VECTOR);
}

thanks in advance!
__________________
V0gelz is offline
SAMURAI16
BANNED
Join Date: Sep 2006
Old 12-09-2008 , 08:56   Re: Add or remove Flags of Entitys
Reply With Quote #2

for those spawnflags from wiki you have to use DispathKeyValue(Ent,"spawnflags","flags num"); or i think you can do also with SetEntProp(Ent,Prop_Data,"m_spawnflags",flags )

Setting m_fFlags you could use this:
Code:
// m_fFlags stock SetEntityFlags(entity,flag,onoff) {     new flags = GetEntProp(entity,Prop_Data,"m_fFlags");         if((flags & flag) > 0)         return onoff == 1 ? 2 : 1 + 0 * SetEntProp(entity,Prop_Data,"mfFlags",flags - flag);         else         return onoff == 0 ? 2 : 1 + 0 * SetEntProp(entity,Prop_Data,"mfFlags",flags + flag);         }

set/get entity effects (EF_* constants)
Code:
stock SetEntityEffects(entity, effect) {     new _effect = GetEntProp(entity,Prop_Data,"m_fEffects");         SetEntProp(entity,Prop_Data,"m_fEffects",_effect | effect); } stock RemoveEntityEffects(entity,effect) {     new _effect = GetEntProp(entity,Prop_Data,"m_fEffects")         SetEntProp(entity,Prop_Data,"m_fEffects",_effect & ~effect); }
SAMURAI16 is offline
Send a message via MSN to SAMURAI16
V0gelz
Senior Member
Join Date: Jun 2004
Old 12-09-2008 , 09:02   Re: Add or remove Flags of Entitys
Reply With Quote #3

Gee thanks m8, thats what i was looking for!
__________________
V0gelz is offline
V0gelz
Senior Member
Join Date: Jun 2004
Old 12-09-2008 , 09:43   Re: Add or remove Flags of Entitys
Reply With Quote #4

Ok i got a little problem tho

When i add DispathKeyValue(Ent,"spawnflags","8");
or SetEntityFlags(Ent,8,1) or SetEntProp(Ent,Prop_Data,"m_spawnflags",8 )

they all crash the server any help?
__________________

Last edited by V0gelz; 12-09-2008 at 10:05.
V0gelz is offline
SAMURAI16
BANNED
Join Date: Sep 2006
Old 12-09-2008 , 10:20   Re: Add or remove Flags of Entitys
Reply With Quote #5

that's weird. It's a problem here, last time when i checked m_spawnflags, in hl2sdk it's used to set SF_* flags
But i saw different plugins using m_spawnflags for setting flags like that you need
Btw you should do a check for a valid entity before setting stuff
SAMURAI16 is offline
Send a message via MSN to SAMURAI16
V0gelz
Senior Member
Join Date: Jun 2004
Old 12-09-2008 , 10:37   Re: Add or remove Flags of Entitys
Reply With Quote #6

Well it seems like it is still crashing. Or this entity is bugged or something .
__________________

Last edited by V0gelz; 12-09-2008 at 13:34.
V0gelz is offline
V0gelz
Senior Member
Join Date: Jun 2004
Old 12-09-2008 , 18:24   Re: Add or remove Flags of Entitys
Reply With Quote #7

Anyone?
__________________
V0gelz is offline
raydan
Senior Member
Join Date: Aug 2006
Old 12-09-2008 , 21:08   Re: Add or remove Flags of Entitys
Reply With Quote #8

Code:
SetVariantString("spawnflags xxx");
AcceptEntityInput(entity,"AddOutput");
raydan is offline
V0gelz
Senior Member
Join Date: Jun 2004
Old 12-10-2008 , 06:04   Re: Add or remove Flags of Entitys
Reply With Quote #9

Thanks! it works now!
__________________
V0gelz 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 20:48.


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