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

Kill button on map


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Minfas
Member
Join Date: Dec 2017
Old 09-26-2019 , 15:00   Kill button on map
Reply With Quote #1

Hello community,
Is there any way to kill certain button on certain map every round?
I am trying to use AcceptEntityInput(caller, "Kill");, But caller is every round different when I kill the button. I also tried "DisableDraw" with "Lock", but the button can be pressed in by shooting to it.

Thank you for any help!
Minfas is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 09-27-2019 , 04:30   Re: Kill button on map
Reply With Quote #2

Yes.
How do you know which button you want to kill? Through his name or his origin in the map?
You can check his name or his origin every round and kill it.
__________________
Ilusion9 is offline
Minfas
Member
Join Date: Dec 2017
Old 09-27-2019 , 06:43   Re: Kill button on map
Reply With Quote #3

I would like to check his origin. Some buttons don't have name i think.
Minfas is offline
quasemago
Senior Member
Join Date: Dec 2018
Location: Brazil
Old 09-27-2019 , 20:51   Re: Kill button on map
Reply With Quote #4

Tell me if it worked:
PHP Code:
#include <sourcemod>
#include <sdktools>

#define BUTTON_ID 1234567 // your button hammerid

public void OnPluginStart()
{
    
HookEvent("round_start"OnRoundStart);
}

public 
void OnRoundStart(Event event, const char[] namebool dontBroadcast)
{
    
int maxEntities GetMaxEntities() * 2;
    for (
int entity 0entity maxEntitiesentity++) {

        if (!
IsValidEntity(entity)) {
            continue;
        }

        if (
GetEntProp(entityProp_Data"m_iHammerID") == BUTTON_ID) {
            
AcceptEntityInput(entity"Kill");
        }
    }

Or you can use Stripper:Source and remove it directly from the map: https://forums.alliedmods.net/showthread.php?t=39439
PHP Code:
remove:
{
    
"hammerid" "YOUR_BUTTON_ID"

__________________
I accept requests for plugins and configuration of servers.


If you liked my work, consider making a donation via PayPal.

Last edited by quasemago; 09-27-2019 at 20:53.
quasemago is offline
Minfas
Member
Join Date: Dec 2017
Old 09-28-2019 , 08:19   Re: Kill button on map
Reply With Quote #5

Quote:
Originally Posted by quasemago View Post
Tell me if it worked:
PHP Code:
#include <sourcemod>
#include <sdktools>

#define BUTTON_ID 1234567 // your button hammerid

public void OnPluginStart()
{
    
HookEvent("round_start"OnRoundStart);
}

public 
void OnRoundStart(Event event, const char[] namebool dontBroadcast)
{
    
int maxEntities GetMaxEntities() * 2;
    for (
int entity 0entity maxEntitiesentity++) {

        if (!
IsValidEntity(entity)) {
            continue;
        }

        if (
GetEntProp(entityProp_Data"m_iHammerID") == BUTTON_ID) {
            
AcceptEntityInput(entity"Kill");
        }
    }

The code is not doing anything.

Last edited by Minfas; 09-28-2019 at 13:43.
Minfas is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 09-28-2019 , 12:02   Re: Kill button on map
Reply With Quote #6

Because you need to get your button hammer id and replace here: #define BUTTON_ID 1234567
__________________
Ilusion9 is offline
Minfas
Member
Join Date: Dec 2017
Old 09-28-2019 , 13:16   Re: Kill button on map
Reply With Quote #7

Quote:
Originally Posted by Ilusion9 View Post
Because you need to get your button hammer id and replace here: #define BUTTON_ID 1234567
I did that lol.
Minfas is offline
Minfas
Member
Join Date: Dec 2017
Old 10-01-2019 , 15:50   Re: Kill button on map
Reply With Quote #8

So,
I want to kill certain button when I press it (one press per round)
I have created something like this:
PHP Code:
//..
if (StrEqual(mapname"map1"false) && caller == 123)
{
    
AcceptEntityInput(caller"Kill");
        
PrintToChatAll("button: %i"caller);

There is a problem, when I kill the button, everything is okay. But when the second round starts, the button is spawned with different number (caller). When third round starts, caller number is back again on its default number.

Last edited by Minfas; 10-01-2019 at 15:51.
Minfas is offline
quasemago
Senior Member
Join Date: Dec 2018
Location: Brazil
Old 10-02-2019 , 02:37   Re: Kill button on map
Reply With Quote #9

You are checking the index of the entity (every round the entities are reset and therefore can change the index). To remove the button you need to check by targetname or hammerid.

PHP Code:
//..
int hammerid GetEntProp(callerProp_Data"m_iHammerID");
PrintToChatAll("button: %i"hammerid); // debug for you to know hammerid.

if (StrEqual(mapname"map1"false) && hammerid == 123)
{
    
AcceptEntityInput(caller"Kill");

__________________
I accept requests for plugins and configuration of servers.


If you liked my work, consider making a donation via PayPal.

Last edited by quasemago; 10-02-2019 at 02:41.
quasemago is offline
Minfas
Member
Join Date: Dec 2017
Old 10-02-2019 , 13:58   Re: Kill button on map
Reply With Quote #10

Quote:
Originally Posted by quasemago View Post
You are checking the index of the entity (every round the entities are reset and therefore can change the index). To remove the button you need to check by targetname or hammerid.

PHP Code:
//..
int hammerid GetEntProp(callerProp_Data"m_iHammerID");
PrintToChatAll("button: %i"hammerid); // debug for you to know hammerid.

if (StrEqual(mapname"map1"false) && hammerid == 123)
{
    
AcceptEntityInput(caller"Kill");

Its working, thank you for your help.
Minfas 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 20:41.


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