Raised This Month: $ Target: $400
 0% 

get a forward that give me "ent" (like FM_spawn) every round


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ScHrAnZ DiNgEnS
Senior Member
Join Date: Sep 2007
Old 03-28-2009 , 15:00   get a forward that give me "ent" (like FM_spawn) every round
Reply With Quote #1

I am a beginner on coding plugins, so i hope someone can help me.

I make a little plugin that destroy some "func_breakable" ents on FM_spawn.
Here is the code that destroy the ents on FM_spawn:

PHP Code:
register_forward(FM_Spawn"fwd_Spawn")

public 
fwd_Spawn(ent) {
    
    
///if(enable == false)
    //    return FMRES_IGNORED
    
    
if(!pev_valid(ent))
        return 
FMRES_IGNORED
    
    
static ClassName[32], isize
    pev
(entpev_classnameClassName31)
    
size sizeof(g_RemovedEntities)
    for(
i=0sizei++)
    {
        if(
equali(ClassNameg_RemovedEntities[i]))
        {
            
//check for bomb explosion entity like boxes and dont remove them
            
if(pev(entpev_spawnflags) != 1)
            {
                
entity_set_float(entEV_FL_takedamage0.0)
                
//engfunc(EngFunc_RemoveEntity, ent);
                
return FMRES_SUPERCEDE
            
}
        }
    }
    return 
FMRES_IGNORED

The code works for me, but how can i get working it on roundstart? roundstart never give me an "ent" like FM_spawn. Can someone help me pls to make it possible?

I know that i can remove the ents on FM_spawn and there will never come back, but thats not that what i want. I need to remove ents only for some rounds.

Greetz,
ScHrAnZ DiNgEnS

PS: Sorry for my bad english, i hope you can understand me =)
ScHrAnZ DiNgEnS is offline
Send a message via ICQ to ScHrAnZ DiNgEnS Send a message via AIM to ScHrAnZ DiNgEnS
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 03-28-2009 , 15:15   Re: get a forward that give me "ent" (like FM_spawn) every round
Reply With Quote #2

Not tested, but should work. Modify it to make it work on specific rounds' start.

PHP Code:
#include <amxmodx>
#include <fakemeta>

new const g_RemovedEntities[][] =
{
    
"entity1.classname",
    
"entity2.classname",
    
"entity3.classname"
};

public 
plugin_init()
{
    
register_plugin("Remove Wanted Entites on Round Start""1.0""Dores");
    
    
register_logevent("logev_RoundStart"2"1=Round_Start");
}

public 
logev_RoundStart()
{
    
// A delay is needed.
    
set_task(0.1"Task_RoundStartDelay");
}

public 
Task_RoundStartDelay()
{
    static 
iiEnt;
    for(
sizeof(g_RemovedEntities) ; i++)
    {
        
iEnt = -1;
        while((
iEnt engfunc(EngFunc_FindEntityByStringiEnt"classname"g_RemovedEntities[i])))
        {
            
engfunc(EngFunc_RemoveEntityiEnt);
        }
    }

__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-28-2009 , 15:51   Re: get a forward that give me "ent" (like FM_spawn) every round
Reply With Quote #3

SOLID_NOT and EF_NODRAW should be enough.

PHP Code:
#include <amxmodx>
#include <fakemeta>

#define PLUGIN "func_breakable"
#define AUTHOR "ConnorMcLeod"
#define VERSION "0.0.1"

#define SF_BREAK_TRIGGER_ONLY           1           // May only be broken by trigger
//#define    SF_BREAK_TOUCH                  2           // Can be 'crashed through' by running player (plate glass)
//#define SF_BREAK_PRESSURE               4           // Can be broken by a player standing on it
//#define SF_BREAK_CROWBAR                256         // Instant break if hit with crowbar

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
register_logevent("LogEvent_Round_Start"2"1=Round_Start")
}

public 
LogEvent_Round_Start()
{
    new 
iEnt FM_NULLENT
    
while( (iEnt engfunc(EngFunc_FindEntityByStringiEnt"classname""func_breakable")) > )
    {
        if( 
pev(iEntpev_spawnflags) != SF_BREAK_TRIGGER_ONLY )
        {
            
set_pev(iEntpev_ltime0.1)
            
set_pev(iEntpev_solidSOLID_NOT)
            
set_pev(iEntpev_effectsEF_NODRAW)
            
set_pev(iEntpev_health, -10.0)
            
set_pev(iEntpev_takedamageDAMAGE_NO)
            
set_pev(iEntpev_deadflagDEAD_DEAD)
        }
    }

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 03-28-2009 at 16:19.
ConnorMcLeod is offline
ScHrAnZ DiNgEnS
Senior Member
Join Date: Sep 2007
Old 03-28-2009 , 17:03   Re: get a forward that give me "ent" (like FM_spawn) every round
Reply With Quote #4

@Dores
if u remove an ent it will never com back

@ConnorMcLeod
never seen something like this before...i will try it out =)
ScHrAnZ DiNgEnS is offline
Send a message via ICQ to ScHrAnZ DiNgEnS Send a message via AIM to ScHrAnZ DiNgEnS
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 03-28-2009 , 17:14   Re: get a forward that give me "ent" (like FM_spawn) every round
Reply With Quote #5

Oh, sorry. I guess I've misunderstood you. Connor's code should work by your needs then.
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
ScHrAnZ DiNgEnS
Senior Member
Join Date: Sep 2007
Old 03-28-2009 , 17:15   Re: get a forward that give me "ent" (like FM_spawn) every round
Reply With Quote #6

no problem...and thanks to you
ScHrAnZ DiNgEnS is offline
Send a message via ICQ to ScHrAnZ DiNgEnS Send a message via AIM to ScHrAnZ DiNgEnS
ScHrAnZ DiNgEnS
Senior Member
Join Date: Sep 2007
Old 03-28-2009 , 17:25   Re: get a forward that give me "ent" (like FM_spawn) every round
Reply With Quote #7

@ ConnorMcLeod

Works perfect...is exactly that what i need =)
THAAAAAAAAANKS
ScHrAnZ DiNgEnS is offline
Send a message via ICQ to ScHrAnZ DiNgEnS Send a message via AIM to ScHrAnZ DiNgEnS
Reply



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 08:51.


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