PHP Code:
#pragma semicolon 1
#define PLUGIN_AUTHOR "Zipcore"
#define PLUGIN_VERSION "1.0"
#define UNLOCKTIME 5.0
#include <sourcemod>
public Plugin myinfo =
{
name = "Bots No Shoot",
author = PLUGIN_AUTHOR,
description = "Prevents bots from shooting before round starts.",
version = PLUGIN_VERSION,
url = "zipcore#googlemail.com"
};
ConVar bot_dont_shoot;
Handle g_hTimer;
public void OnPluginStart()
{
HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
HookEvent("round_end", Event_RoundEnd, EventHookMode_PostNoCopy);
bot_dont_shoot = FindConVar("bot_dont_shoot");
SetConVarFlags(bot_dont_shoot, GetConVarFlags(bot_dont_shoot) ^ FCVAR_NOTIFY);
}
public void OnMapEnd()
{
g_hTimer = null;
}
public Action Event_RoundStart(Event event, const char[] name, bool dontBroadcast)
{
ResetTimer();
g_hTimer = CreateTimer(UNLOCKTIME, Timer_AllowBotsShoot, _, TIMER_FLAG_NO_MAPCHANGE);
bot_dont_shoot.SetInt(1, false, false);
}
public Action Event_RoundEnd(Event event, const char[] name, bool dontBroadcast)
{
ResetTimer();
}
public Action Timer_AllowBotsShoot(Handle timer, any data)
{
bot_dont_shoot.SetInt(0, false, false);
return Plugin_Handled;
}
void ResetTimer()
{
if(g_hTimer != null)
delete g_hTimer;
g_hTimer = null;
}
Havn't tested it, but this is another method, instead of removing the attack button all the time it uses bot_dont_shoot a ConVar which is part of CS:GO
__________________