Raised This Month: $ Target: $400
 0% 

Solved [CSGO] How to keep bots from using he nade for 20 seconds into the round


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Austin
Senior Member
Join Date: Oct 2005
Old 12-21-2022 , 04:46   [CSGO] How to keep bots from using he nade for 20 seconds into the round
Reply With Quote #1

What is the scripting technique to keep bots from using the he nade?

I don't want to set bot_allow_grenades 0 because I only want to limit their use for the first 20 seconds into the round and only limit the he nade and allow the others.

Last edited by Austin; 12-27-2022 at 04:03.
Austin is offline
BallGanda
Junior Member
Join Date: Jan 2022
Old 12-23-2022 , 12:08   Re: [CSGO] How to keep bots from using he nade for 20 seconds into the round
Reply With Quote #2

I bet the hack way to do it for all nades is

I am assuming that bots do not buy nades if bot_allow_grenades 0... which might not be the case.

in config:
bot_allow_grenades 1

plugin:
onroundstart
bot_allow_grenades 1
wait buytime
bot_allow_grenades 0
wait 20 seconds
bot_allow_grenades 1


If bots still buy nades with bot_allow_grenades 0

in config:
bot_allow_grenades 0

onroundstart
bot_allow_grenades 0
wait 20 seconds
bot_allow_grenades 1

but I am probably not one with the best idea.

To do the specific nade type would look at weapon restrict plugin sourcecode and get the specific code that does not allow the player/bot to equip the nade.

Last edited by BallGanda; 12-23-2022 at 12:15.
BallGanda is offline
luki1412
Veteran Member
Join Date: Oct 2008
Location: OnPluginStart()
Old 12-23-2022 , 13:52   Re: [CSGO] How to keep bots from using he nade for 20 seconds into the round
Reply With Quote #3

Just remove the weapon if it gets equipped. Could also store if you did remove it and give it back to them after the timeout.
__________________
luki1412 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 12-23-2022 , 20:41   Re: [CSGO] How to keep bots from using he nade for 20 seconds into the round
Reply With Quote #4

PHP Code:

#include <sdkhooks>


bool botpreventgrenade;

public 
void OnPluginStart()
{
    for(
int i 1<= MaxClientsi++)
    {
        if(
IsClientInGame(i)) OnClientPutInServer(i);
    }

    
HookEvent("round_start"round_start);
}

public 
void OnClientPutInServer(int client)
{
    if(
IsFakeClient(client) && !IsClientReplay(client) && !IsClientSourceTV(client))
    {
        
SDKHook(clientSDKHook_WeaponSwitchWeaponSwitch);
        
//SDKHook(client, SDKHook_WeaponCanSwitchTo, WeaponCanSwitchTo);
    
}
}

public 
Action WeaponSwitch(int clientint weapon)
{
    if(
botpreventgrenade && HasEntProp(weaponProp_Send"m_bPinPulled"))
    {
        
char clsname[35];
        
GetEntityClassname(weaponclsnamesizeof(clsname));

        if(!
StrEqual(clsname"weapon_hegrenade"false))
            return 
Plugin_Continue;

        return 
Plugin_Handled;
    }

    return 
Plugin_Continue;
}

public 
Action WeaponCanSwitchTo(int clientint weapon)
{
    if(
botpreventgrenade && HasEntProp(weaponProp_Send"m_bPinPulled"))
    {
        
char clsname[35];
        
GetEntityClassname(weaponclsnamesizeof(clsname));

        if(!
StrEqual(clsname"weapon_hegrenade"false))
            return 
Plugin_Continue;

        return 
Plugin_Handled;
    }
    
    return 
Plugin_Continue;
}



public 
void round_start(Event event, const char[] namebool dontBroadcast)
{
    
botpreventgrenade true;
    
CreateTimer(30.0delay); // + mp_round_restart_delay
}

public 
Action delay(Handle timer)
{
    
botpreventgrenade false;
    return 
Plugin_Continue;

__________________
Do not Private Message @me

Last edited by Bacardi; 12-23-2022 at 20:51.
Bacardi is offline
Austin
Senior Member
Join Date: Oct 2005
Old 12-27-2022 , 04:02   Re: [CSGO] How to keep bots from using he nade for 20 seconds into the round
Reply With Quote #5

bacardi,
thanks again!

I added some logging and it seems to work really well.

L 12/27/2022 - 028:16: Ron - Denied bot from using HE Nade...
L 12/27/2022 - 028:16: Gary - Denied bot from using HE Nade...

I needed this for my bot server where I wrote a plugin to boost the HE damage and radius (so they are actually useable) and this along with the csgo bots tendency to fire off HEs right at the start was a bad combination! This is a perfect solution thank you.

To anyone that may want this I attached a plugin with a cvar to set the time for the delay.
abs_bot_nade_delay

The default delay is ten seconds.
Attached Files
File Type: sp Get Plugin or Get Source (BotNadeDelay.sp - 66 views - 2.3 KB)

Last edited by Austin; 12-28-2022 at 02:04.
Austin 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 17:39.


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