AlliedModders

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

Kia 05-31-2013 09:31

Removing Map Objectives
 
Hello everybody,

I've got this code here :

PHP Code:

/* Script generated by Pawn Studio */

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>

#define PLUGIN    "Remove Map Objectives"
#define AUTHOR    ""
#define VERSION    "1.0.0"

new const g_szObjectives[][] = 
{
    
"func_bomb_target",
    
"info_bomb_target",
    
"hostage_entity",
    
"monster_scientist",
    
"func_hostage_rescue",
    
"info_hostage_rescue",
    
"info_vip_start",
    
"func_vip_safetyzone",
    
"func_escapezone"
}

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_forward(FM_Spawn,"fw_SpawnPost",1)
}

public 
fw_SpawnPostiEntity )
{
    new 
szClassname32 ];
    
peviEntitypev_classnameszClassnamecharsmaxszClassname ) );
    
    for( new 
0sizeof g_szObjectivesi++ )
    {
        if( 
equaliszClassnameg_szObjectives] ) )
        {
            
remove_entityiEntity );
            break;
        }
    }


It should remove the Map objectives, but it doesn't work. Any idea why?

oxygen935 05-31-2013 10:00

Re: Removing Map Objectives
 
try this, it works with my plugin
Code:
Code:
#include <amxmodx> #include <fakemeta> #define PLUGIN "New Plug-In" #define VERSION "1.0" #define AUTHOR "oxygen" new g_HostageEnt new const g_sRemoveEntities[][] = {     "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" } new const MAX_REMOVED_ENTITIES = sizeof(g_sRemoveEntities); public plugin_precache() {     register_forward(FM_Spawn, "fwdSpawn", 0)         new allocHostageEntity = engfunc(EngFunc_AllocString, "hostage_entity")     do     {         g_HostageEnt = engfunc(EngFunc_CreateNamedEntity, allocHostageEntity)     }     while( !pev_valid(g_HostageEnt) )         engfunc(EngFunc_SetOrigin, g_HostageEnt, Float:{0.0, 0.0, -55000.0})     engfunc(EngFunc_SetSize, g_HostageEnt, Float:{-1.0, -1.0, -1.0}, Float:{1.0, 1.0, 1.0})     dllfunc(DLLFunc_Spawn, g_HostageEnt) } public fwdSpawn(ent) {     if( !pev_valid(ent) || ent == g_HostageEnt )     {         return FMRES_IGNORED;     }         new sClass[32];     pev(ent, pev_classname, sClass, 31);         for( new i = 0; i < MAX_REMOVED_ENTITIES; i++ )     {         if( equal(sClass, g_sRemoveEntities[i]) )         {             engfunc(EngFunc_RemoveEntity, ent);             return FMRES_SUPERCEDE;         }     }         return FMRES_IGNORED; }

Kia 05-31-2013 10:03

Re: Removing Map Objectives
 
Doesn't work for me. :/

EDIT : My bad, I forgot to mention that I also want to remove the buyzone.

hornet 05-31-2013 10:38

Re: Removing Map Objectives
 
Reason it doesn't work is because entities compiled into the map spawn during plugin_precache().

And as for buyzones try searching it's been done before - first shot : http://forums.alliedmods.net/showthread.php?t=90932

Kia 05-31-2013 10:50

Re: Removing Map Objectives
 
His plugin is working in plugin_precache and thanks for the link.
Combined both plugins, works great, thanks for help. :)


All times are GMT -4. The time now is 16:15.

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