Thread: Remove Doors
View Single Post
jRaven
AMX Mod X Beta Tester
Join Date: Jan 2006
Location: IA, USA
Old 09-11-2006 , 14:43   Re: Remove Doors
Reply With Quote #41

I modified it a bit for my own use, but the code you have there will cause an infinite loop and hang a server. Thank karlos for the fix.

Try this instead (I tested it -- it works beautifully):
[[I'd rather use a cfg file per-map instead of cvars]]
Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>

public plugin_init() {
    register_plugin("Remove Doors","1.4","[BSP] Thijs");
    register_concmd("amx_removedoors","RemoveDoors",ADMIN_LEVEL_C,"- remove ALL DOORS from a map");
}

public RemoveDoors() {

    new Door = -1;
    while( ( Door = find_ent_by_class(Door,"func_door") ) > 0 )
        remove_entity(Door);

    Door = -1
    while( ( Door = find_ent_by_class(Door,"func_door_rotating") ) > 0 )
        remove_entity(Door);

    return PLUGIN_HANDLED;
}
jRaven is offline
Send a message via ICQ to jRaven Send a message via AIM to jRaven