Raised This Month: $ Target: $400
 0% 

all ent affected by func_button


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GuessWhat
Junior Member
Join Date: Oct 2010
Old 10-18-2010 , 01:49   all ent affected by func_button
Reply With Quote #1

how can i get all the ent affected/moved by a func_button. like in deathrun maps, i wanna know all the ents moved/affected after the player press the button
GuessWhat is offline
Old 10-18-2010, 16:16
katna
This message has been deleted by Exolent[jNr]. Reason: Don't bump until 2 weeks have passed since last post.
Schwabba
Senior Member
Join Date: Apr 2008
Old 10-19-2010 , 03:48   Re: all ent affected by func_button
Reply With Quote #2

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <engine> 
PHP Code:
public plugin_init()
{
    
RegisterHam(Ham_Use"func_button""hamUseButton_Pre");

PHP Code:
public hamUseButton_Pre(buttonid)
{
    new 
szTarget[32]
    
pev(buttonpev_targetszTarget31)
    new 
ent = -1
    
while(ent find_ent_by_tname(entszTarget))
    {
        
// do something
    
}


Last edited by Schwabba; 10-19-2010 at 04:07.
Schwabba is offline
GuessWhat
Junior Member
Join Date: Oct 2010
Old 10-19-2010 , 04:13   Re: all ent affected by func_button
Reply With Quote #3

this code isn't working well, i wanna detect all ent affected by this button and set their pev_iuser4 to the id. but this code doesn't detect the affected ent well.

edit: the ent found was the ent that affect all other buttons so if i understand it well it looks like this :
func_button press > ent of the func_button is active > this ent active all other ents.

Last edited by GuessWhat; 10-19-2010 at 04:26.
GuessWhat is offline
katna
Senior Member
Join Date: May 2010
Old 10-20-2010 , 01:21   Re: all ent affected by func_button
Reply With Quote #4

try to detect how the "ent of the func_button" affect all the other ents
katna is offline
Schwabba
Senior Member
Join Date: Apr 2008
Old 10-20-2010 , 02:28   Re: all ent affected by func_button
Reply With Quote #5

Ah now i know what you want.

It's because the multi_manager, the targets there can't be found with find_ent_by_target.

Last edited by Schwabba; 10-21-2010 at 01:33.
Schwabba is offline
GuessWhat
Junior Member
Join Date: Oct 2010
Old 10-20-2010 , 16:08   Re: all ent affected by func_button
Reply With Quote #6

yea multi_manager targets, but find_ent_in_shpere doesn't help in my cause i dont need the to ent in a certain distance i need ent affected.
GuessWhat is offline
Schwabba
Senior Member
Join Date: Apr 2008
Old 10-21-2010 , 00:24   Re: all ent affected by func_button
Reply With Quote #7

It took my nerves, but finally i found a way how to do that. It's not the best way i think, but it works..

Example to remove all entities got triggered by the button:

PHP Code:
public affect(ent)
{
    
remove_entity (ent


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

new PLUGIN[]  = "Buttons affect"
new AUTHOR[]  = "Schwabba"
new VERSION[] = "1.0"

new mIDmID2
new manager[100][100];
new 
manager_name[100][100];

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
RegisterHam(Ham_Use"func_button""hamUseButton_Pre");
}

public 
hamUseButton_Pre(buttonid)
{
    new 
szTarget[32]
    
pev(buttonpev_targetszTarget31)
    new 
ent = -1
    
while((ent find_ent_by_tname(entszTarget)))
    {
        
affect(ent)
    }
    for(new 
i=0;i<mID;i++)
    {
        if(
manager[i][1] && equal(szTargetmanager_name[i]))
        {
            new 
ent = -1
            
while((ent find_ent_by_tname(entmanager[i])))
            {
                
affect(ent)
            }
        }
    }
}

public 
pfn_keyvalue(entid
{
    if(
is_valid_ent(entid))
    {
        new 
classname[33]
        new 
keyname[33]
        new 
keyvalue[33]
        
copy_keyvalue(classname,32,keyname,32,keyvalue,32)
        if(
equal(classname"multi_manager"))
        {
            if(!
equal(keyname"origin") && !equal(keyname"targetname") && !equal(keyname"spawnflags"))
            {
                
mID++
                
copy(manager[mID], 99keyname)
            }
            if(
equal(keyname"targetname"))
            {
                for(new 
i;i<mID;i++)
                {
                    if(
mID2-i)
                    {
                        
mID2 i+1
                        copy
(manager_name[mID2], 99keyvalue)
                    }
                }
            }
        }
    }
}

public 
affect(ent)
{
    
// Do something


Last edited by Schwabba; 10-21-2010 at 01:34.
Schwabba is offline
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 10:22.


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