AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   func_button help (https://forums.alliedmods.net/showthread.php?t=108153)

ieGaming 11-02-2009 06:41

func_button help
 
I need to make a plugin where if this certain button is pressed it does a command but also calls its target at the same time.


example:

if(button triggered)
entity_remove( bleh );

how would i do this?

grimvh2 11-02-2009 07:19

Re: func_button help
 
touch only
PHP Code:

public entity_touch(entity1entity2) {
        
DoTouch(entity1,entity2)
}

public 
pfn_touch(ptr,ptd) {
        
DoTouch(ptr,ptd)
}

public 
DoTouch(pToucher,pTouched) {
    if (
pToucher == || pTouched == 0) return PLUGIN_CONTINUE
    
    
new pTouchername[32], pTouchedname[32],pToucherTarget[32],pToucherTargetname[32]
    
entity_get_string(pToucherEV_SZ_classnamepTouchername31)
    
entity_get_string(pTouchedEV_SZ_classnamepTouchedname31)
    
entity_get_string(pToucherEV_SZ_targetnamepToucherTargetname31)
    
entity_get_string(pToucherEV_SZ_targetpToucherTarget31)
    
    if(
equal(pTouchername"func_button") && equal(pTouchedname"player"))
    {
        if (
equal(pToucherTarget"buttonname"))
        { 
//
        
}
    }



ieGaming 11-02-2009 11:36

Re: func_button help
 
Tyvm for your time, if I can't trigger it then this will do =]

grimvh2 11-02-2009 17:21

Re: func_button help
 
With +use

PHP Code:

// Plugin Init
RegisterHam(Ham_Use"func_button""fwdUse"0

PHP Code:

public fwdUse(entid)
{
    
// Checks if ents are reals players
    
if(!ent || id 32 && !is_user_alive(id))
    {
        return 
FMRES_IGNORED;
    }
    
    new 
target[33]
    
peventpev_targettargetsizeof target )
 
    if( 
equalitarget"buttonname" ))
    {
         
//Your Code
    
}
    return 
FMRES_IGNORED;



minimiller 11-02-2009 18:16

Re: func_button help
 
you checked "!is_user_alive(id)" twice

grimvh2 11-03-2009 04:28

Re: func_button help
 
Quote:

Originally Posted by minimiller (Post 979194)
you checked "!is_user_alive(id)" twice

woops :) edited

ieGaming 11-06-2009 02:07

Re: func_button help
 
thanks alot that works great =]

Jon 11-06-2009 02:48

Re: func_button help
 
Use HAM_ returns in ham forwards.


All times are GMT -4. The time now is 17:35.

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