Raised This Month: $ Target: $400
 0% 

Remove map specific ent


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bwgrubbs1
Senior Member
Join Date: Sep 2006
Old 05-04-2007 , 03:15   Remove map specific ent
Reply With Quote #1

I am trying to remove one entity in particular in on particular map...

whats my problem ?

Code:
#include <amxmodx> #include <fakemeta> new curmap[32] curmap[] = get_mapname(curmap, 31) //problem on this line public plugin_init() {     register_plugin("Ent Remover", "1.1", "CSL")     register_event("REMOVE", "event_remove", "a", "1=0", "2=0") } public event_remove() {     remove_entity_by_classname("func_breakable")     remove_entity_by_classname("func_door_rotating")     remove_entity_by_classname("func_door") } stock remove_entity_by_classname(const classname[]) {     new ent = -1     while((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", classname)))     {         if(curmap[] = "de_aztec2") //problem on this line as well         {             if(pev(ent, pev_model) == 105) //SPECIFIC MODEL             {                 engfunc(EngFunc_RemoveEntity, ent)             }         }         else if(pev(ent, pev_spawnflags) != 1)         {             engfunc(EngFunc_RemoveEntity, ent)         }     } }

I am trying to remove a specific model on a specific map. In this case model # 105 on map de_aztec2. The only problem is that its labeled as a wall...i want to remove just this one...not all the walls. LOL help would be +karma'd
bwgrubbs1 is offline
pRED*
Join Date: Dec 2006
Old 05-04-2007 , 03:34   Re: Remove map specific ent
Reply With Quote #2

Your problem is the string comparisons..

Strings cannot be compared using = because the are essentially an array of cells.

for the first error just remove the curmap[] = from that start and I think it should work fine.

Code:
new curmap[32] get_mapname(curmap,31)

And for the comparison use the equali function

Code:
if (equali(curmap,"de_aztec2"))
pRED* is offline
Vet
Veteran Member
Join Date: Jul 2006
Location: I|O wa
Old 05-04-2007 , 20:06   Re: Remove map specific ent
Reply With Quote #3

Is there actually a REMOVE event ? I'm no expert, but I've never heard of it.

Also, for efficiency, make the plugin dependent on the desired map...

Place in the 'event_remove' routine or before registering the event
Code:
 
if (!equal(curmap, "de_aztec2"))
    return PLUGIN_HANDLED
Otherwise you're checking entities on undesired maps. Kind of a waste.
__________________
=====================================
- My Plugins -
=====================================

Last edited by Vet; 05-04-2007 at 20:50.
Vet is offline
Send a message via MSN to Vet
pRED*
Join Date: Dec 2006
Old 05-04-2007 , 21:12   Re: Remove map specific ent
Reply With Quote #4

Lol yeah didn't notice that...

Pretty sure that event doesn't exist.

Just run the function in plugin_cfg on something similar that happens only on map start.
And yes check the map as early as possible, no point in searching for ents when you're not going to do anything with them
pRED* is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 05-04-2007 , 23:23   Re: Remove map specific ent
Reply With Quote #5

Please note: some ents can only be deleted on plugin_precache() [check other plugins for more info].
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
Reply


Thread Tools
Display Modes

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 06:43.


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