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

[CS:GO] block bomb plant event


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Aketti
New Member
Join Date: Jan 2018
Old 02-13-2020 , 16:09   [CS:GO] block bomb plant event
Reply With Quote #1

Hello, I have no idea how to block player from planting the bomb, code that I have tried:
PHP Code:
public void OnPluginStart()
{
    
HookEvent("bomb_beginplant"Event_BombBeginPlantEventHookMode_Pre);
}

public 
Action Event_BombBeginPlant(Event event, const char[] namebool dontBroadcast)
{
    return 
Plugin_Handled;

It fires, however it doesn`t stop from planting the bomb, tried bomb_planted event too, same results. Is there any way to block it? I can`t see any cvar for this too.
Aketti is offline
DukeBruno123
Member
Join Date: Jan 2016
Location: Germany
Old 02-14-2020 , 04:51   Re: [CS:GO] block bomb plant event
Reply With Quote #2

You could look at OnPlayerRunCmd and check if IN_ATTACK is pressed, then get the current weapon the client is holding and strip the IN_ATTACK flag from buttons.
DukeBruno123 is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 02-14-2020 , 05:44   Re: [CS:GO] block bomb plant event
Reply With Quote #3

This should be used for blocking specific players from planting the bomb, or specific bombsites.

PHP Code:
public Action OnPlayerRunCmd(int clientintbuttonsintimpulsefloat vel[3], float angles[3], intweaponintsubtypeintcmdnuminttickcountintseedint mouse[2])
{
    if (
buttons IN_ATTACK || buttons IN_USE)
    {
        if (
weapon != -1)
        {
            
char classname[65];
            if (
GetEntityClassname(weaponclassnamesizeof(classname)))
            {
                if (
StrEqual(classname[7], "c4"true))
                {
                    if (
GetEntProp(clientProp_Send"m_bInBombZone"))
                    {
                        if (
buttons IN_ATTACKbuttons &= ~IN_ATTACK;
                        else if (
buttons IN_USEbuttons &= ~IN_USE;

                        
PrintToChat(client"You cannot plant the bomb in this bombsite!");
                        return 
Plugin_Changed;
                    }
                }
            }
        }
    }
    
    return 
Plugin_Continue;

If you want to disable completely the bomb plant, then disable/remove all bombsites.

PHP Code:
public void OnMapStart()
{
    
int entity = -1;
    while ((
entity FindEntityByClassname(entity"func_bomb_target")) != -1)
    {
        
AcceptEntityInput(entity"Disable"); // or "Kill"
    
}

__________________

Last edited by Ilusion9; 02-14-2020 at 13:43.
Ilusion9 is offline
Aketti
New Member
Join Date: Jan 2018
Old 02-14-2020 , 17:44   Re: [CS:GO] block bomb plant event
Reply With Quote #4

First solution doesn`t seem to work but second solution is perfect, thanks a lot!
Aketti 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 04:14.


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