AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Removing ambient_generics (https://forums.alliedmods.net/showthread.php?t=57722)

pRED* 07-10-2007 02:46

Removing ambient_generics
 
How do you remove ambient_generic entities (if they are playing a specific file)

Code:

public remove_soundents()
{
        new ent=-1
        while((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "ambient_generic")) != 0)
        {
                if(pev_valid(ent))
                {               
                        static songname[40];
                        pev(ent, pev_message, songname, sizeof songname - 1);
                        for (new i; i<REMOVE_SONGS; i++)
                        {
                                if (contain(songname,removelist[i]) != -1)
                                {
                                        engfunc(EngFunc_RemoveEntity, ent);
                                        break
                                }
                        }
                       
                }
        }

        return;
}

with

Code:

new removelist[REMOVE_SONGS][] =
{
        "007archives",
        "007azteccomplex",
        "007control",
        "007frigate",
        "cs_facility2k",
        "facility2k",
        "facility"
}

Doesn't work. (I've tried adding the .wav extensions too)

stupok 07-10-2007 12:06

Re: Removing ambient_generics
 
http://collective.valve-erc.com/inde...mbient_generic

Try containi() instead of contain().

It looks to me like that should work, so put in some debug messages to see if you're actually finding any entities and if the pev_message actually contains what you're looking for.


All times are GMT -4. The time now is 21:34.

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