projects-jenz/AutismBotIngame/scripting/autism_bot_info.sp

121 lines
3.2 KiB
SourcePawn
Raw Normal View History

2020-01-23 23:15:26 +01:00
#pragma semicolon 1
#define DEBUG
#define PLUGIN_AUTHOR "jenz"
#define PLUGIN_VERSION "1.00"
#include <sourcemod>
#include <sdktools>
#pragma newdecls required
bool outputspam[MAXPLAYERS + 1];
int ticksCooldown = 66; // 66 tick per second
int botTicker;
public Plugin myinfo =
{
name = "coordinates for the bot",
author = PLUGIN_AUTHOR,
description = "hello ",
version = PLUGIN_VERSION,
url = ""
};
public void OnPluginStart()
{
RegConsoleCmd("sm_botfindString", Cmd_findBotString);
RegConsoleCmd("sm_teaminfo", Cmd_teamInfo);
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action Cmd_teamInfo(int client, int args)
{
if (!IsValidClient(client))
return Plugin_Handled;
if (!outputspam[client])
return Plugin_Handled;
int clientteamvalue = GetClientTeam(client);
if (clientteamvalue == 3)
PrintToChat(client, "(Counter-Terrorist)");
else if (clientteamvalue == 2)
PrintToChat(client, "(Terrorist)");
else
PrintToChat(client, "(Spectactor)");
return Plugin_Handled;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action Cmd_findBotString(int client, int args)
{
if (!IsValidClient(client))
return Plugin_Handled;
if (!outputspam[client])
return Plugin_Handled;
if (args != 1)
{
ReplyToCommand(client, "[SM] Usage botfindString <string>");
return Plugin_Handled;
}
char sTarget[65];
GetCmdArg(1, sTarget, sizeof(sTarget));
PrintToChat(client, sTarget);
return Plugin_Handled;
}
public void OnClientDisconnect(int client)
{
outputspam[client] = false;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float vel[3], const float angles[3], int weapon, int subtype, int cmdnum, int tickcount, int seed, const int mouse[2])
{
if (!IsClientInGame(client)) return;
if (IsPlayerAlive(client) && outputspam[client])
{
if (botTicker > ticksCooldown)
{
botTicker = 0;
for (int i = 1; i <= MaxClients; i++)
if (IsValidClient(i) && IsPlayerAlive(i) && GetClientTeam(i) == 3 && i != client)
{
float clientorigin[3];
GetClientAbsOrigin(i, clientorigin);
PrintToChat(client, "CTOrigin: %f %f %f;", clientorigin[0], clientorigin[1], clientorigin[2]);
}
}
botTicker++;
}
}
stock bool IsValidClient(int client)
{
if (client > 0 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client))
{
return true;
}
return false;
}
public void OnClientPostAdminCheck(int client)
{
//STEAM_0:1:34783317
//STEAM_0:1:60189040
//[U:1:120378081]
char auth[50];
GetClientAuthId(client, AuthId_Engine, auth, sizeof(auth));
//PrintToChatAll("client: %N \nAuth: %s", client, auth);
outputspam[client] = false;
if (StrEqual("[U:1:120378081]", auth, false))
{
outputspam[client] = true;
}
}