should allow bots to rtv
This commit is contained in:
parent
5d660187ba
commit
283d19c04a
@ -28,6 +28,7 @@ bool chat_cooldown = false;
|
|||||||
//admins & vips
|
//admins & vips
|
||||||
bool admins[MAXPLAYERS + 1];
|
bool admins[MAXPLAYERS + 1];
|
||||||
bool vips[MAXPLAYERS + 1];
|
bool vips[MAXPLAYERS + 1];
|
||||||
|
bool rtv;
|
||||||
|
|
||||||
//socket for bot input
|
//socket for bot input
|
||||||
Handle global_socket;
|
Handle global_socket;
|
||||||
@ -43,6 +44,7 @@ public Plugin myinfo =
|
|||||||
|
|
||||||
public void OnPluginStart()
|
public void OnPluginStart()
|
||||||
{
|
{
|
||||||
|
rtv = false;
|
||||||
for (int i = 1; i <= MaxClients; i++)
|
for (int i = 1; i <= MaxClients; i++)
|
||||||
if (IsValidClient(i))
|
if (IsValidClient(i))
|
||||||
{
|
{
|
||||||
@ -52,6 +54,7 @@ public void OnPluginStart()
|
|||||||
}
|
}
|
||||||
//talking
|
//talking
|
||||||
RegConsoleCmd("sm_autism", cmd_talk, "talking to the bot through java application");
|
RegConsoleCmd("sm_autism", cmd_talk, "talking to the bot through java application");
|
||||||
|
RegConsoleCmd("sm_rtv", cmd_botrtv, "making bots rtv");
|
||||||
|
|
||||||
//hooks
|
//hooks
|
||||||
HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
|
HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
|
||||||
@ -182,6 +185,27 @@ public bool is_autism_bot4(int client)
|
|||||||
return StrEqual("[U:1:1221121532]", auth, false) || StrEqual("STEAM_0:0:610560766", auth, false);
|
return StrEqual("[U:1:1221121532]", auth, false) || StrEqual("STEAM_0:0:610560766", auth, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Action cmd_botrtv(int client, int args)
|
||||||
|
{
|
||||||
|
if ((vips[client] || admins[client]) && !rtv)
|
||||||
|
{
|
||||||
|
bool bot_found = false;
|
||||||
|
for (int i = 1; i <= MaxClients; i++)
|
||||||
|
{
|
||||||
|
if (IsValidClient(i) && !IsFakeClient(i) && is_bot_player(i))
|
||||||
|
{
|
||||||
|
FakeClientCommand(i, "sm_say rtv");
|
||||||
|
bot_found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (bot_found)
|
||||||
|
{
|
||||||
|
rtv = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
public Action cmd_talk(int client, int args)
|
public Action cmd_talk(int client, int args)
|
||||||
{
|
{
|
||||||
char info[generic_length];
|
char info[generic_length];
|
||||||
@ -191,6 +215,10 @@ public Action cmd_talk(int client, int args)
|
|||||||
PrintToChat(client, "Add a message to the command if autism bot is ingame and running on discord");
|
PrintToChat(client, "Add a message to the command if autism bot is ingame and running on discord");
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
if (is_bot_player(client))
|
||||||
|
{
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
if (chat_cooldown)
|
if (chat_cooldown)
|
||||||
{
|
{
|
||||||
PrintToChat(client, "spamming bot too much, applying cooldown");
|
PrintToChat(client, "spamming bot too much, applying cooldown");
|
||||||
@ -245,10 +273,12 @@ public void Event_RoundStart(Handle event, const char[] name, bool dontBroadcast
|
|||||||
|
|
||||||
public void OnMapStart()
|
public void OnMapStart()
|
||||||
{
|
{
|
||||||
|
rtv = true;
|
||||||
//0.2 too spammmy, 1.5 too slow
|
//0.2 too spammmy, 1.5 too slow
|
||||||
chat_cooldown = false;
|
chat_cooldown = false;
|
||||||
CreateTimer(0.30, recursive_pressing, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
|
CreateTimer(0.30, recursive_pressing, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
|
||||||
CreateTimer(15.0, bot_check_connect, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
|
CreateTimer(15.0, bot_check_connect, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
|
||||||
|
CreateTimer(600.0, bot_allow_rtv);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void send_socket_msg(char[] query_msg, int len, int port)
|
public void send_socket_msg(char[] query_msg, int len, int port)
|
||||||
@ -258,6 +288,12 @@ public void send_socket_msg(char[] query_msg, int len, int port)
|
|||||||
SocketSendTo(global_socket, query_msg, len, "127.0.0.1", port); //udp
|
SocketSendTo(global_socket, query_msg, len, "127.0.0.1", port); //udp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Action bot_allow_rtv(Handle timer, any data)
|
||||||
|
{
|
||||||
|
rtv = false;
|
||||||
|
return Plugin_Continue;
|
||||||
|
}
|
||||||
|
|
||||||
public Action bot_check_connect(Handle timer, any data)
|
public Action bot_check_connect(Handle timer, any data)
|
||||||
{
|
{
|
||||||
int client_count = GetClientCount(false);
|
int client_count = GetClientCount(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user