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

Modify "Spectator Bots" Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KerwinSweet2003
Junior Member
Join Date: Nov 2022
Old 05-06-2023 , 10:55   Modify "Spectator Bots" Plugin
Reply With Quote #1

Hello,I have a spectator bot plugin which adds 2 bots on the spectator team to advertise the ip and forum,the plugin works perfectly but on gametracker the bots appear like real players,it is possible to modify the code for gametracker to detect the bots as "Bots" instead of "Players"? ,thank you


Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>

#define PLUGIN   "Spectator Bots"
#define VERSION  "1.0"
#define AUTHOR   "hackera457"

const MAX_PATH_LENGTH = 64
const ADMIN_ACCESS = ADMIN_LEVEL_B

new const g_szFolder[] = "SpectatorBots"
new const g_szFile[] = "Spectator_Bots.ini"

new g_iPlayers, g_iBots, g_iTotalBotNames
new g_pCvarMinPlayers, g_pCvarMaxPlayers
new g_pMinPlayers, g_pMaxPlayers

new Array:g_aBotData

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	register_cvar("spectator_bots", VERSION, FCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)

	register_clcmd("amx_reload_specbots", "Command_ReloadSpecBotsFile", ADMIN_ACCESS, "* Reloads the file with the spec bots")

	g_pCvarMinPlayers = register_cvar("specbot_minimum_players", "0")
	g_pCvarMaxPlayers = register_cvar("specbot_maximum_players", "30")
	hook_cvar_change(g_pCvarMinPlayers, "OnCvarChanged")
	hook_cvar_change(g_pCvarMaxPlayers, "OnCvarChanged")

	set_task(2.0, "Check_Bots")
}

public plugin_cfg()
{
	g_aBotData = ArrayCreate(MAX_PLAYERS, 1)

	new szDir[MAX_PATH_LENGTH], szFmtDir[MAX_PATH_LENGTH]
	get_localinfo("amxx_configsdir", szDir, charsmax(szDir))
	formatex(szFmtDir, charsmax(szFmtDir), "addons/amxmodx/configs/%s", g_szFolder)
	
	if (!dir_exists(szFmtDir))
		mkdir(szFmtDir)

	ReadFile()

	g_pMinPlayers = get_pcvar_num(g_pCvarMinPlayers)
	g_pMaxPlayers = get_pcvar_num(g_pCvarMaxPlayers)
}

public ReadFile()
{
	static szConfigsDir[MAX_PATH_LENGTH], iFile, szSpectatorBots[MAX_PATH_LENGTH]
	get_configsdir(szConfigsDir, charsmax(szConfigsDir))
	formatex(szSpectatorBots, charsmax(szSpectatorBots), "/%s/%s", g_szFolder, g_szFile)
	add(szConfigsDir, charsmax(szConfigsDir), szSpectatorBots)
	iFile = fopen(szConfigsDir, "rt")

	if(!file_exists(szConfigsDir))
	{
		server_print("File (%s) not found, creating new one..", g_szFile)
		new iFile = fopen(szConfigsDir, "wt")
		
		if (iFile)
		{
			new szNewFile[512]
			formatex(szNewFile, charsmax(szNewFile), "")
			fputs(iFile, szNewFile)
		}
		fclose(iFile)
		ReadFile()
		return
	}

	new iLine

	if (iFile)
	{
		static szSpecBotName[MAX_NAME_LENGTH]
		
		while (!feof(iFile))
		{
			fgets(iFile, szSpecBotName, charsmax(szSpecBotName))
			trim(szSpecBotName)
			
			if (szSpecBotName[0] == EOS || szSpecBotName[0] == ';' || (szSpecBotName[0] == '/' && szSpecBotName[1] == '/'))
				continue
					
			ArrayPushString(g_aBotData, szSpecBotName)
			
			iLine++
		}
		fclose(iFile)
	}
}

public Command_ReloadSpecBotsFile(id, level, cid)
{
	if(!cmd_access(id, level, cid, 1))
		return PLUGIN_HANDLED

	ArrayClear(g_aBotData)

	RemoveBots()
	set_task(1.0, "Check_Bots")

	ReadFile()
	return PLUGIN_HANDLED
}

public client_connect(id)
{
	if(!is_user_bot(id))
		g_iPlayers++
	
	set_task(2.0, "Check_Bots")
}

public client_disconnected(id)
{
	if(!is_user_bot(id))
		g_iPlayers--
	
	set_task(2.0, "Check_Bots")
}

public OnCvarChanged(pcvar, szOldValue[], szNewValue[])
{
	if (pcvar == g_pCvarMinPlayers)
	{
		if (str_to_num(szOldValue) != str_to_num(szNewValue))
		{
			g_pMinPlayers = str_to_num(szNewValue)
		}
	}
	else if (pcvar == g_pCvarMaxPlayers)
	{
		if (str_to_num(szOldValue) != str_to_num(szNewValue))
		{
			g_pMaxPlayers = str_to_num(szNewValue)
		}
	}
	set_task(2.0, "Check_Bots")
}
public Check_Bots()
{
	static i, szBotNames[MAX_NAME_LENGTH]

	if (g_iPlayers >= g_pMaxPlayers)
	{
		RemoveBots()
		return PLUGIN_CONTINUE
	}

	if (g_pMinPlayers <= g_iPlayers <= g_pMaxPlayers)
	{
		for (i = 0; i < g_iTotalBotNames; i++)
		{
			if (g_iBots == g_iTotalBotNames)
				break

			ArrayGetString(g_aBotData, i, szBotNames, charsmax(szBotNames))
			CreateBots(szBotNames)
		}
	}
	return PLUGIN_HANDLED
}

CreateBots(const szName[])
{
	static szReason[128], id
	
	id = engfunc(EngFunc_CreateFakeClient, szName)
	engfunc(EngFunc_FreeEntPrivateData, id)
	set_pev(id, pev_flags, pev(id, pev_flags) | FL_FAKECLIENT)
	dllfunc(DLLFunc_ClientConnect, id, szName, "127.0.0.1", szReason)
	dllfunc(DLLFunc_ClientPutInServer, id)
	cs_set_user_team(id, CS_TEAM_SPECTATOR);
	g_iBots++
}
RemoveBots()
{
	static iPlayers[MAX_PLAYERS], iNum
	get_players_ex(iPlayers, iNum, GetPlayers_ExcludeHuman)
    
	for(--iNum; iNum >= 0; iNum--)
		server_cmd("kick #%i", get_user_userid(iPlayers[iNum]))
		
	g_iBots = 0
}
KerwinSweet2003 is offline
mlibre
Veteran Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 05-06-2023 , 16:14   Re: Modify "Spectator Bots" Plugin
Reply With Quote #2

It is only possible with an external program that simulates such functions, we are talking about regular paths I don't think you can get help on this here
__________________
mlibre is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-06-2023 , 20:58   Re: Modify "Spectator Bots" Plugin
Reply With Quote #3

Do you have a plugin that attempts to make bots look like players? Does GameTracker have the ability to show and/or ignore bots? If you don't have any plugin trying to make bots look like player then you'll probably need to ask GameTracker.

Quote:
Originally Posted by mlibre View Post
It is only possible with an external program that simulates such functions, we are talking about regular paths I don't think you can get help on this here
What are you talking about?
__________________
fysiks is offline
mlibre
Veteran Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 05-06-2023 , 21:18   Re: Modify "Spectator Bots" Plugin
Reply With Quote #4

Quote:
Originally Posted by fysiks View Post
What are you talking about?
to do such a thing, it is not enough to use the typical amxx or metamod tools, it is not useful for GT, they have improved their bot detection system. even if you connect to the server more than three bots. they disqualify you, important fact, before trying to outwit him, that's what the friend wants to do
__________________
mlibre is offline
metal_upa
Senior Member
Join Date: Jun 2016
Old 05-07-2023 , 09:29   Re: Modify "Spectator Bots" Plugin
Reply With Quote #5

Use [BOT] tag, then gametracker will detect it as a BOT.
metal_upa 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 18:03.


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