Raised This Month: $32 Target: $400
 8% 

How to check if a client is a bot?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bewpy
Junior Member
Join Date: Jan 2010
Old 08-28-2019 , 18:34   How to check if a client is a bot?
Reply With Quote #1

Code:
#pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR "Nunya"
#define PLUGIN_VERSION "1.69"

#include <sourcemod>
#include <sdktools>
#include <geoip>

public Plugin myinfo = 
{
	name = "Connect Message", 
	author = PLUGIN_AUTHOR, 
	description = "Displays info when client connets", 
	version = PLUGIN_VERSION, 
	url = ""
};

public void OnClientPutInServer(client)
{
	char name[32],authid[64];
	
	GetClientName(client, name, sizeof(name));
	GetClientAuthId(client, AuthId_SteamID64, authid, sizeof(authid));
	PrintToChatAll("\x01[Original-Gamers] \x04%s\x01 (\x05%s\x01) has joined the server.", name, authid);
}
So when I add a bot to my server, it shows the bot joined, but shows the steamID as "STEAM_ID_STOP_IGNORING_RETVALS". Is there anyway to check if the client is fake, and if so, then just put BOT instead of the actual steam ID?
bewpy is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 08-28-2019 , 18:47   Re: How to check if a client is a bot?
Reply With Quote #2

IsFakeClient
__________________
Silvers is offline
bewpy
Junior Member
Join Date: Jan 2010
Old 08-28-2019 , 19:20   Re: How to check if a client is a bot?
Reply With Quote #3

Code:
if(!IsFakeClient(client){
PrintToChatAll("\x01[Original-Gamers] \x04%s\x01 (\x05%s\x01) has joined the server.", name, authid);
}
I havent scripted in quite some time, so i'm sorry for having such basic trouble lol, but using this I get

Connect_Message.sp(27) : error 001: expected token: ")", but found "{"
bewpy is offline
bewpy
Junior Member
Join Date: Jan 2010
Old 08-28-2019 , 19:24   Re: How to check if a client is a bot?
Reply With Quote #4

Nvm, I forgot a ) lol
bewpy is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 08-28-2019 , 19:42   Re: How to check if a client is a bot?
Reply With Quote #5

You need to wait for OnClientAuthorized before you can get the steamid of a player.
__________________
asherkin is offline
bewpy
Junior Member
Join Date: Jan 2010
Old 08-28-2019 , 21:40   Re: How to check if a client is a bot?
Reply With Quote #6

Quote:
Originally Posted by asherkin View Post
You need to wait for OnClientAuthorized before you can get the steamid of a player.
I tried looking OnClientAuthorized up on google, but im a bit confused on how I would need to use that.
bewpy is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 08-29-2019 , 05:12   Re: How to check if a client is a bot?
Reply With Quote #7

PHP Code:
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>
#include <geoip>

public void OnClientPostAdminCheck(int client)
{
    if (
IsFakeClient(client)) return;

    
char authid[64];
    
GetClientAuthId(clientAuthId_SteamID64authidsizeof(authid));
    
    
PrintToChatAll("\x01[Original-Gamers] \x04%N\x01 (\x05%s\x01) has joined the server."clientauthid);

__________________

Last edited by Ilusion9; 08-29-2019 at 05:12.
Ilusion9 is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 08-31-2019 , 04:41   Re: How to check if a client is a bot?
Reply With Quote #8

https://www.sourcemod.net/new-api/cl...ientAuthorized

Check if auth != "BOT"
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 09-01-2019 , 05:07   Re: How to check if a client is a bot?
Reply With Quote #9

Quote:
Originally Posted by Dragokas View Post
Yeah, but he needs to print the clients name which can be retrieved in and after OnClientPutInServer() function triggers.

Just do things in OnClientPostAdminCheck() to avoid some mess.
__________________
Ilusion9 is offline
Reply


Thread Tools
Display Modes

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 16:10.


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