AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Remove ent from location x (https://forums.alliedmods.net/showthread.php?t=54919)

[X]-RayCat 05-07-2007 16:45

Remove ent from location x
 
How can i remove ent like (func_door) in certain location like coordinates? And same with trigger_hurt.

regalis 05-07-2007 18:04

Re: Remove ent from location x
 
You can try this..
Maybe someone knows a better way..possibly only with fakemeta!?

Code:

#include <amxmodx>
#include <engine>
#include <fakemeta>

static const PLUGIN_NAME[]      = "Remove_Ents";
static const PLUGIN_AUTHOR[]    = "regalis";
static const PLUGIN_VERSION[]    = "0.1";


public plugin_init()
{
    register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
    register_cvar(PLUGIN_NAME, PLUGIN_VERSION, FCVAR_SPONLY|FCVAR_SERVER);
}

public remove_ent()
{
    new Float:CertainOrigin[3];
    new ent;
    while((ent = find_ent_in_sphere(ent, CertainOrigin, 100.0)) != 0)
    {
        if(!pev_valid(ent)) return;
        static classname[32];
        pev(ent, pev_classname, classname, sizeof classname - 1);
        if(equal(classname, "func_door")) engfunc(EngFunc_RemoveEntity, ent);
        if(equal(classname, "trigger_hurt")) engfunc(EngFunc_RemoveEntity, ent);
    }
}

greetz regalis

Drak 05-08-2007 16:35

Re: Remove ent from location x
 
Whatever is the "CertinOrigin" is the X, Y, Z coordinates.

Quote:

Originally Posted by [X]-RayCat (Post 474737)
Where should i put coordinades im pretty confused. :)
Also i ment how i set trigger_hurt to certain location. Weird Weiird idk. :|


You asked, how to remove the entitys. Not make/edit them.
But, just find the "trigger_hurt" and set it's origin..

alien 05-08-2007 16:37

Re: Remove ent from location x
 
What is your certain location related to? Is it near you? Near the place you're pointing at? Or are you taking it from a file, so it's exact? Don't you need to remove all the doors from your map?

regalis 05-08-2007 16:49

Re: Remove ent from location x
 
With that you can remove all defined ents from a map:

Code:

#include <amxmodx>
#include <fakemeta>
#include <engine>

static const PLUGIN_NAME[]      = "Remove_Ents";
static const PLUGIN_AUTHOR[]    = "regalis";
static const PLUGIN_VERSION[]    = "1.0";

public plugin_init()
{
    register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
    register_cvar(PLUGIN_NAME, PLUGIN_VERSION, FCVAR_SPONLY|FCVAR_SERVER);
    remove_door();
}

public remove_door()
{
    new ent;
   
    // Remove all rotating doors
    while((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "func_door_rotating")) != 0)
    {
        if(!pev_valid(ent)) return FMRES_IGNORED;
        engfunc(EngFunc_RemoveEntity, ent);

    }
   
    // Remove all doors
    while((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "func_door")) != 0)
    {
        if(!pev_valid(ent)) return FMRES_IGNORED;
        engfunc(EngFunc_RemoveEntity, ent);
    }
   
    // Remove all breakables
    while((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "func_breakable")) != 0)
    {
        if(!pev_valid(ent)) return FMRES_IGNORED;
        engfunc(EngFunc_RemoveEntity, ent);
    }
    return FMRES_IGNORED;
}



All times are GMT -4. The time now is 06:36.

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