AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Removing entity if i know only origin? (https://forums.alliedmods.net/showthread.php?t=26000)

Rixorster 03-25-2006 10:11

Removing entity if i know only origin?
 
How can i remove an entity, if i only know its origin? (It has no targetname >.> )

VEN 03-25-2006 11:06

Try:
Code:
remove_entity(find_ent_in_sphere(-1, origin, 0.0))

Rixorster 03-25-2006 11:12

OMFG, v3n, YOU SAVED ME AGAIN! ;P

VEN 03-25-2006 11:22

Quote:

v3n
erm... np...

Rixorster 03-25-2006 11:46

VEN, one problem, didnt work <.<
I made it like:
Code:
new Float:barorigin[3] = { -339.0, -835.0, -47 }
Code:
public remove_Bar() {      remove_entity(find_ent_in_sphere(-1, barorigin, 0.0)) }
and it didnt work, but said tag mismatch of the new Float:barorigin thingy <.<

Rixorster 03-25-2006 12:34

*Bump*
I tried moving the entity to XYZ=9999, but it didnt move the ambient_generic at all >_< Only other entities around it :S

VEN 03-25-2006 14:01

Quote:

didnt work
What actually didn't work mine example or your code?
Quote:

said tag mismatch
Code:
new Float:barorigin[3] = { -339.0, -835.0, -47.0 }

Quote:

I tried moving the entity
Did you tried to do it with entity_set_origin? If not - try it.

Twilight Suzuka 03-25-2006 14:05

Or, just do a looping search, and delete it when the origin of the entity matches what its origin is.

Timoses 03-25-2006 14:11

I just tried it with

public stop1()
{
remove_entity(find_ent_in_sphere(-1, barrave, 900.0))
}


Well, the windows and other stuff got removed, but not the sound.
ambient_generic
so obviously remove_entity won't remove that, is there a way to
remove an ambient_generic?

VEN 03-25-2006 14:27

[edit]

Here is the proper way:

Method #1:
Code:
new ent, classname[32] while ((ent = find_ent_in_sphere(ent, ENTITY_FLOAT_ORIGIN_HERE, 0.0))) {     entity_get_string(ent, EV_SZ_classname, classname, 31)     if (equal(classname, "ambient_generic")) {         // your code here         break     } }

Method #2:
Code:
new ent while ((ent = find_ent_by_class(ent, "ambient_generic"))) {     new Float:origin[3]     entity_get_vector(ent, EV_VEC_origin, origin)     if (origin[0] == YOUR_ENTITY_FLOAT_ORIGIN[0] &&     origin[1] == YOUR_ENTITY_FLOAT_ORIGIN[1] &&     origin[2] == YOUR_ENTITY_FLOAT_ORIGIN[2]) {         // your code here         break     } }


All times are GMT -4. The time now is 16:45.

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