Raised This Month: $12 Target: $400
 3% 

attack cells to open/close


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 07-10-2020 , 06:25   attack cells to open/close
Reply With Quote #1

I want the door to open/close when I shoot

But with this plugin that I have, you can only open/close all doors with the "say /open" command

Someone has a code to open the door by firing or hitting?


PHP Code:
/*

Thread Link: https://forums.alliedmods.net/showthread.php?p=1130946#post1130946

Jail Cells Opener
v1.6
Wrecked

Changelog:

1.0 - Released
1.1 - Config file added with method to get custom maps / button ids
1.2 - Replaced button ID with targetname since ID's aren't static (thanks xPaw and joropito for feedback)
1.3 - Auto button detector added in with a big thanks to jorpito for the code!
1.4 - Now functions with maps that have more than one cell opener.
1.5 - Manual push task removal, thanks to D.Skript for reporting
1.6 - Multilingual added (crazyeffect) / commented the code
*/

#include <amxmodx>
#include <amxmisc> // dumb access command...
#include <hamsandwich>
#include <fakemeta>
#include <cstrike>
#include <fun>

new const VERSION[] = "1.6"

new bool:b_Freeday

new found[10]

public 
plugin_init()
{
    
register_plugin"Auto Cells Opener"VERSION"Wrecked" // :avast:
    
    
register_concmd"say /open""Push_Button" )
    
    
register_event"HLTV""EVENT_NewRound""a""1=0""2=0" )
    
    
register_dictionary("autocellopener.txt"// zomg crazyeffect hawt

    
RegisterHamHam_Use"func_button""HAM_Button_Pushed")
}

public 
HAM_Button_PushediButton // someone pushed a button, so see if it's the button used to open cells
{
    new 
targ[32]
    
peviButtonpev_targettarg31 // get name of what the button affects
    
    
new target engfuncEngFunc_FindEntityByString0"targetname"targ // get ent that is affected
    
    
    
if( !pev_validtarget ) )
        return;
        
    new 
classname[32]
    
pevtargetpev_classnameclassname31 // func_door, func_button, worldspawn, etc.
    
    
if( equalclassname"func_door" ) ) // if button pushed opened a door
    
{
        
Push_Button() 
    }
}

public 
Push_Button() 

        new 
ent 
        
new ent3 
        
new Float:origin[3
        new 
Float:radius 200.0 
        
new class[32
        new 
name[32]
        while( 
ent engfunc(EngFunc_FindEntityByStringent"classname""info_player_deathmatch" ) ) // info_player_deathmatch = tspawn
        

                new 
ent2 
                pev
(entpev_originorigin
                while((
ent2 engfunc(EngFunc_FindEntityInSphereent2originradius)))  // find doors near T spawn
                

                        if(!
pev_valid(ent2)) 
                                continue 

                        
pev(ent2pev_classname, class, charsmax(class)) 
                        if(!
equal(class, "func_door")) // if it's not a door, move on to the next iteration
                                
continue 

                        
pev(ent2pev_targetnamenamecharsmax(name)) 
                        
ent3 engfunc(EngFunc_FindEntityByString0"target"name// find button that opens this door
                        
if(pev_valid(ent3) && (in_array(ent3foundsizeof(found)) < 1)) 
                        { 
                                
ExecuteHamB(Ham_Useent30011.0// zomg poosh it
                                
break // break from current while loop
                        

                } 
        } 


stock in_array(needledata[], size

        for(new 
0sizei++) 
        { 
                if(
data[i] == needle
                        return 

        

        return -


__________________
Jailbreak AD 2.0

The greatest civilization of 🇮🇷IRAN🇮🇷

Last edited by alferd; 07-10-2020 at 06:25.
alferd is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-10-2020 , 06:36   Re: attack cells to open/close
Reply With Quote #2

Try TraceAttack with "func_door".
__________________
HamletEagle is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 07-10-2020 , 07:18   Re: attack cells to open/close
Reply With Quote #3

Open doors with a shot! v1.0.
Quote:
Originally Posted by alferd View Post
I want the door to open/close when I shoot

Someone has a code to open the door by firing or hitting?


There's another one that opens with grenade. I started to make a plugin that allows a item_security to open doors then since drifted off to make it into Thermite to open doors. Since there is a grenade to open doors already I am stuck in development with it being more like a ghost plugin where users can run through windows and hidden secret doors light up when touched etc.
__________________

Last edited by DJEarthQuake; 07-10-2020 at 07:22.
DJEarthQuake is offline
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 07-10-2020 , 07:54   Re: attack cells to open/close
Reply With Quote #4

Quote:
Originally Posted by HamletEagle View Post
Try TraceAttack with "func_door".
Thanks

Quote:
Originally Posted by DJEarthQuake View Post
Open doors with a shot! v1.0.



There's another one that opens with grenade. I started to make a plugin that allows a item_security to open doors then since drifted off to make it into Thermite to open doors. Since there is a grenade to open doors already I am stuck in development with it being more like a ghost plugin where users can run through windows and hidden secret doors light up when touched etc.
Thanks a lot
__________________
Jailbreak AD 2.0

The greatest civilization of 🇮🇷IRAN🇮🇷
alferd is offline
jugule
AlliedModders Donor
Join Date: Apr 2020
Old 07-13-2020 , 05:09   Re: attack cells to open/close
Reply With Quote #5

PHP Code:

    RegisterHam
(Ham_TraceAttack"func_door_rotating""open_door")
    
RegisterHam(Ham_TraceAttack"func_door""open_door")

public 
open_door(thisidattackerFloat:damageFloat:direction[3], tracehandledamagebits

dllfunc(DLLFunc_Usethisidattacker)

jugule is offline
Reply


Thread Tools
Display Modes

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 02:29.


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