AlliedModders

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

Enomine 05-03-2012 05:48

Removing map entitys
 
I don't know what is the problem, but doesn't work :\

Code:
//Global new const MapEntitys[] = {     "func_bomb_target",     "info_bomb_target",     "hostage_entity",     "monster_scientist",     "func_hostage_rescue",     "info_hostage_rescue",     "info_vip_start",     "func_vip_safetyzone",     "func_escapezone",     "armoury_entity",     "game_player_equip",     "player_weaponstrip" }; //Init     register_forward(FM_Spawn, "fwdSpawn"); public fwdSpawn(Ent) {     if(pev_valid(Ent))     {         set_task(0.1,"cmdRemoveEnt",Ent+TASK_ENTITYS);         return FMRES_HANDLED;     }         return FMRES_IGNORED; } //-----------------------------// public cmdRemoveEnt(Ent) {     Ent -= TASK_ENTITYS;         if(!pev_valid(Ent))         return PLUGIN_HANDLED;             new EntClass[32];     entity_get_string(Ent, EV_SZ_classname, EntClass, charsmax(EntClass));         for(new i = 0;i < charsmax(MapEntitys);i++)     {         if(equali(EntClass, MapEntitys[i]))         {             engfunc(EngFunc_RemoveEntity, Ent);             break;         }     }         return PLUGIN_HANDLED; }

claudiuhks 05-04-2012 09:25

Re: Removing map entitys
 
PHP Code:

new const cMyEntities[ ] =
{
    
"func_bomb_target",
    
"info_bomb_target",
    
"hostage_entity",
    
"monster_scientist",
    
"func_hostage_rescue",
    
"info_hostage_rescue",
    
"info_vip_start",
    
"func_vip_safetyzone",
    
"func_escapezone",
    
"armoury_entity",
    
"game_player_equip",
    
"player_weaponstrip"
}; new g_iSpawn;

public 
plugin_precache( )
  
g_iSpawn register_forwardFM_Spawn"Spawn" );

public 
plugin_init( )
  
unregister_forwardFM_Spawng_iSpawn );

public 
Spawn)
{
    if( 
pev_valid) )
    {
        static 
C32 ], I;
        
pevEpev_classnameC32 );

        for( 
0sizeofcMyEntities ); I++ ) {
          if( 
equalcMyEntities], ) ) {
              
engfuncEngFunc_RemoveEntity); break; }
        }
    }




All times are GMT -4. The time now is 00:27.

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