Raised This Month: $ Target: $400
 0% 

Entity Remover in Sphere


  
 
 
Thread Tools Display Modes
Author Message
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 06-14-2010 , 15:07   Entity Remover in Sphere
#1

Otro plugin que hice cuando estaba sin internet...

Es algo similar al plugin Entity Remover de Exolent... la idea surgio porque yo queria remover cierta entidades (un trigger_push) y probando con el plugin de Exolent no podia removerla ya que la deteccion de entidades de ese plugin es el uso del AIM, es decir... aimear a la entidad, usar el comando y removerla... pero en este caso no se podia aimear a la entidad, creo que es gracias a que esa entidad es NOT_SOLID si no me equivoco... en fin, el punto es que gracias a eso se me ocurrio hacer este plugin.

Al usar el comando ers_remove en consola (la onda es bindearselo), detecta las entidades que se encuentran alrededor del player (en una esfera) en un rango de 50.0 (esto se cambia con el #define RADIO 50.0), a esas entidades las "pinta" de color rojo (dsp se va a poder modificar esto) si es que puede obviamente, algunas entidades no se van a venir o porque son invisibles o porque estan tapadas por algun solido o algo. Y te aparece un menu con la cantidad de entidades encontradas y con sus nombres correspondientes... al seleccionar una se borra la entidad y eso queda guardado... por lo que si se cambia de mapa no hace falta volverlas a remover.

Cabe aclarar tmb que a diferencia del plugin de Exolent, en este caso las entidades son REMOVIDAS completamente.... el de Exolent en vez de removerlas, las hace NOT_SOLID y las pone invisibles.

Por lo que me acuerdo, la ultima vez que testie este plugin funcaba lo mas bien. De todas formas esta un poco incompleto y falta pulirlo...

Cualquier sugerencia o alguna modificacion del plugin, me avisan...

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>

#define PLUGIN    "Entity Remover in Sphere"
#define AUTHOR    "Alucard"
#define VERSION    "0.0.1"

#define MAX_ENTS 5
#define MAX_ENTS_REMOVE 20

#define TASK_ID_CHECK 9999

#define RADIO 50.0

new const ENTS_REMOVED[] = "addons/amxmodx/configs/ERS";

new 
entTarget[33][MAX_ENTS];

new Array:
gClass;
new Array:
gModel;

new 
mapName[48], entsFile[128];

new 
TotalEnts;

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_concmd("ers_remove""HookCmdRemove"ADMIN_KICK);
    
register_concmd("ers_reset""HookCmdReset"ADMIN_KICK);
}

public 
plugin_precache()
{
    if(!
dir_exists(ENTS_REMOVED) )
        
mkdir(ENTS_REMOVED);
    
    
gClass ArrayCreate(321);
    
gModel ArrayCreate(321);
    
    
get_mapname(mapNamecharsmax(mapName) );
    
formatex(entsFile127"%s/%s.cfg"ENTS_REMOVEDmapName);
    
    
LoadEntsRemoved();
    
    
register_forward(FM_Spawn"HookFmSpawn"0);
}

public 
HookFmSpawn(ent)
{
    if(
is_valid_ent(ent) )
    {
        
//log_amx("FM_SPAWN");
        
        
new szClass[32], szModel[32];
        
entity_get_string(entEV_SZ_classnameszClass31);
        
entity_get_string(entEV_SZ_modelszModel31);
        
        
log_amx("FM_SPAWN totalents %d"TotalEnts);
        
        new 
loadClass[32], loadModel[32];
        for(new 
0TotalEntsi++)
        {
            
log_amx("FM_SPAWN ents %d"i);
            
            
ArrayGetString(gClassiloadClass32);
            
ArrayGetString(gModeliloadModel32);
            
            if(
equal(szClassloadClass) && equal(szModelloadModel) )
            {
                
log_amx("FM_SPAWN class: %s %s"szClassloadClass);
                
remove_entity(ent);
            }
        }
    }
}

public 
HookCmdReset(idlevelcid)
{
    if(!
cmd_access(idlevelcid1) )
        return 
PLUGIN_HANDLED;
    
    if(
file_exists(entsFile) )
    {
        
delete_file(entsFile);
        
client_print(idprint_console"Archivo removido");
    }
    
    return 
PLUGIN_HANDLED;
}

public 
HookCmdRemove(idlevelcid)
{
    if(!
cmd_access(idlevelcid1) )
        return 
PLUGIN_HANDLED;
    
    
EntCount(id);
    return 
PLUGIN_HANDLED;
}

EntCount(id)
{
    new 
Float:fOrigin[3];
    
entity_get_vector(idEV_VEC_originfOrigin);
    
    new 
Menu menu_create("\ySe encontraron las siguientes entidades:""MenuEntDeleteHandler"0);
    
    new 
iEntszNum[5], szClassname[32];
    new 
iNumweap;
    while(
iEnt find_ent_in_sphere(iEntfOriginRADIO) )
    {
        
/*if(iNum == MAX_ENTS)
        break;*/
        
        
entity_get_string(iEntEV_SZ_classnameszClassname31);
        
        
weap find_ent_by_owner(-1szClassnameid);
        
        if(
iEnt == id || iEnt == weap) continue;
        if(
contain(szClassname"info_player_") != -1) continue;
        
        
iNum++;
        
num_to_str(iNumszNum4);
        
        
SetRendering(iEntkRenderFxNone25500kRenderTransColor255);
        
menu_additem(MenuszClassnameszNum0);
        
        
entTarget[id][iNum-1] = iEnt // i am not sure, but i think this method is a crap, or not?
    
}
    
    if(
iNum 0)
    {
        
menu_display(idMenu);
    }
    else
    
client_print(idprint_chat"No se encontro ninguna entidad alrededor");
}

public 
MenuEntDeleteHandler(idMenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(Menu);
        return 
PLUGIN_HANDLED;
    }
    
    new 
data[6], iName[64];
    new 
accesscallback;
    
menu_item_getinfo(Menuitemaccessdata5iName63callback);
    
    new 
iEnt entTarget[id][item];
    
    if(!
is_valid_ent(iEnt) )
        return 
PLUGIN_HANDLED;
    
    
SaveEntity(iEntiName);
    
remove_entity(iEnt);
    
    
//menu_destroy(Menu);
    
return PLUGIN_HANDLED;
}

SaveEntity(iEnt, const Classname[])
{    
    new 
szModel[32], szData[84];
    new 
fopen(entsFile"at");
    
    
entity_get_string(iEntEV_SZ_modelszModel31);
    
    
formatex(szData83"%s %s^n"ClassnameszModel);
    
fputs(fszData);
    
    
fclose(f);
}

LoadEntsRemoved()
{
    if(!
file_exists(entsFile) )
        return 
0;
    
    new 
szData[84], szClass[32], szModel[48];
    
//new entModel[48], entClass[32];
    
new fopen(entsFile"rt");
    
    while(!
feof(f) )
    {
        
//log_amx("que ondis");
        
        
fgets(fszData83);
        
parse(szDataszClass31szModel47);
        
        
ArrayPushString(gClassszClass);
        
ArrayPushString(gModelszModel);
        
        
TotalEnts++
        
        
/*entity_get_string(ent, EV_SZ_model, entModel, 47);
        entity_get_string(ent, EV_SZ_classname, entClass, 31);
        
        if(equal(entClass, szClass) && equal(entModel, szModel) )
            remove_entity(ent);*/
    
}
    
    
fclose(f);
    
    return 
1;
}

stock SetRendering(entityfx kRenderFxNone255255255render kRenderNormalamount 16
{
    new 
Float:RenderColor[3];
    
RenderColor[0] = float(r);
    
RenderColor[1] = float(g);
    
RenderColor[2] = float(b);
    
    
entity_set_int(entityEV_INT_renderfxfx);
    
entity_set_vector(entityEV_VEC_rendercolorRenderColor);
    
entity_set_int(entityEV_INT_rendermoderender);
    
entity_set_float(entityEV_FL_renderamtfloat(amount) );
    
    return 
1;

__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
fireattack
Senior Member
Join Date: Jul 2008
Old 05-08-2011 , 10:13   Re: [ES] Entity Remover in Sphere
#2

La idea es buena, pero las entidades no se guardan al cambiar de mapa.
fireattack is offline
_Venganza_
Senior Member
Join Date: Apr 2011
Location: Valparaiso, Chile
Old 05-08-2011 , 18:49   Re: [ES] Entity Remover in Sphere
#3

Quote:
Originally Posted by fireattack View Post
La idea es buena, pero las entidades no se guardan al cambiar de mapa.
06-14-10 , 02:07 PM [ES] Entity Remover in Sphere
_Venganza_ is offline
 



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 14:17.


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