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

Plugin that checks steam profiles and warns/kicks private profile holders


Post New Thread Reply   
 
Thread Tools Display Modes
Obyboby
Veteran Member
Join Date: Sep 2013
Old 08-24-2017 , 14:52   Re: Plugin that checks steam profiles and warns/kicks private profile holders
Reply With Quote #51

Yes, I haven't specifically asked them if they saw the warnings.
The only thing that made me think that the plugin wasnt working is the fact that they played for a while without getting a kick. That's all :p
Well, looking forward to see some updates thanks!
__________________
Obyboby is offline
Obyboby
Veteran Member
Join Date: Sep 2013
Old 09-03-2017 , 08:14   Re: Plugin that checks steam profiles and warns/kicks private profile holders
Reply With Quote #52

Now pretty much every player is getting the warning, including myself...I'm afraid I need to disable this plugin :C
Too many false positives, what can I do?
__________________
Obyboby is offline
Aphex_N
Junior Member
Join Date: Mar 2012
Old 10-15-2017 , 05:48   Re: Plugin that checks steam profiles and warns/kicks private profile holders
Reply With Quote #53

Quote:
L 10/15/2017 - 010:44: [SM] Exception reported: Client index 0 is invalid
L 10/15/2017 - 010:44: [SM] Blaming: PrivateKicker.smx
L 10/15/2017 - 010:44: [SM] Call stack trace:
L 10/15/2017 - 010:44: [SM] [0] PrintToChat
L 10/15/2017 - 010:44: [SM] [1] Line 217, C:\Users\Acer\Desktop\PrivateKicker.sp::HTTP_ RequestComplete
Any idea?
Aphex_N is offline
alphaearth
Senior Member
Join Date: Feb 2018
Location: Turkey
Old 12-03-2018 , 15:52   Re: Plugin that checks steam profiles and warns/kicks private profile holders
Reply With Quote #54

Quote:
Originally Posted by WatchDogs View Post
Ya you're right I forgot that.

Here is a fix:

PHP Code:
#pragma semicolon 1

#define DEBUG

#define PLUGIN_VERSION    "1.2.8 - Debug"

#include <sourcemod>
#define AUTOLOAD_EXTENSIONS
#define REQUIRE_EXTENSIONS
#include <SteamWorks>

bool b_IsPrivate[MAXPLAYERS 1];
int iWarnings[MAXPLAYERS 1];
int iChecks[MAXPLAYERS 1];
int iMaxChecks;

char steamId[MAXPLAYERS 1][64];

#if defined DEBUG
char file[PLATFORM_MAX_PATH];
#endif

Handle h_bEnable;
Handle h_bKickFailed;
Handle h_sURL;
Handle h_iWarnings;
Handle h_iTimeout;
Handle h_bExcludeAdmins;
Handle h_iRetries;

Handle CheckTimers[MAXPLAYERS 1];


public 
Plugin myinfo 
{
    
name "Private Kicker"
    
author "[W]atch [D]ogs, Soroush Falahati, Special thanks to arne1288"
    
description "Kicks the players without public profile after X count of warnings"
    
version PLUGIN_VERSION
}

public 
void OnPluginStart()
{
    
h_bEnable CreateConVar("sm_private_kick_enable""1""Enable / Disable the plugin"_true0.0true1.0);
    
h_bKickFailed CreateConVar("sm_private_kick_failed""0""Enable / Disable kicking client if didn't receive response"_true0.0true1.0);
    
h_sURL CreateConVar("sm_private_kick_url""https://steamapi.darkserv.download/public/""Address of the PHP file responsible for getting user profile status.");
    
h_iWarnings CreateConVar("sm_private_kick_warnings""5""How many warnings should plugin warn before kicking client"_true1.0);
    
h_iTimeout CreateConVar("sm_private_kick_timeout""10""Maximum number of seconds till we consider the requesting connection timed out?"_true0.0true300.0);
    
h_bExcludeAdmins CreateConVar("sm_private_kick_exclude_admins""1""Enable / Disable exclude private checking for admins"_true0.0true1.0);
    
h_iRetries CreateConVar("sm_private_kick_retries""5""How many retries should plugin do if player SteamID was unknwon or connection was not successful"_true1.0);
    
    
HookConVarChange(h_iRetriesRetries_Change);
    
HookEvent("player_spawn"Event_PlayerSpawn);
    
    
AutoExecConfig(true"PrivateKicker");
    
    
#if defined DEBUG
    
BuildPath(Path_SMfilesizeof(file), "logs/PrivateKick_Debug.txt");
    
#endif
}

public 
void Retries_Change(Handle convar, const char[] oldValue, const char[] newValue)
{
    
iMaxChecks GetConVarInt(convar);
}

public 
Action Event_PlayerSpawn(Handle event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(GetEventInt(event"userid"));
    
    
char sSteamId64[64];
    
GetClientAuthId(clientAuthId_SteamID64sSteamId6464);
    
SendRequest(clientsSteamId64);
    
    if (
b_IsPrivate[client])
    {
        
int iTotalWarnings GetConVarInt(h_iWarnings);
        
        
iWarnings[client]++;
        
        
PrintToChat(client"[SM] WARNING! Your steam profile is private. If you don't make it public before your next %i spawn(s) you will get kicked."iTotalWarnings iWarnings[client]);
        
        if (
iWarnings[client] >= iTotalWarnings)
        {
            
KickClient(client"Kicked by server. Your steam profile is private Make it public and rejoin.");
        }
    }
}

public 
void OnClientDisconnect(int client)
{
    if (!
IsFakeClient(client))
    {
        
steamId[client] = NULL_STRING;
        
iChecks[client] = 0;
        
        if (
CheckTimers[client] != INVALID_HANDLE)
        {
            
KillTimer(CheckTimers[client]);
            
CheckTimers[client] = INVALID_HANDLE;
        }
        
        if (
b_IsPrivate[client])
        {
            
b_IsPrivate[client] = false;
            
iWarnings[client] = 0;
        }
    }
}

public 
void OnClientPostAdminCheck(int client)
{
    if (
GetConVarBool(h_bEnable) && !IsFakeClient(client))
    {
        
iChecks[client] = 0;
        
steamId[client] = NULL_STRING;
        
        if (
GetConVarBool(h_bExcludeAdmins) && GetUserAdmin(client) != INVALID_ADMIN_ID)
            return;
        
        if (
GetClientAuthId(clientAuthId_SteamID64steamId[client], 64))
        {
            
SendRequest(clientsteamId[client]);
        }
        else
        {
            
CheckTimers[client] = CreateTimer(10.0Timer_CheckIDAgainGetClientUserId(client), TIMER_REPEAT TIMER_FLAG_NO_MAPCHANGE);
        }
    }
}

public 
Action Timer_CheckIDAgain(Handle timerint userid)
{
    
int client GetClientOfUserId(userid);
    
    
iChecks[client]++;
    if (
iChecks[client] >= iMaxChecks)
    {
        
LogError("Private-Kicker: Failed to retrieve %N's SteamID after %i tries."clientiMaxChecks);
        if (
GetConVarBool(h_bKickFailed))
        {
            
KickClient(client"Failed to retrieve your SteamID.");
        }
        
iChecks[client] = 0;
        
CheckTimers[client] = INVALID_HANDLE;
        return 
Plugin_Stop;
    }
    
    if (
GetClientAuthId(clientAuthId_SteamID64steamId[client], 64))
    {
        
SendRequest(clientsteamId[client]);
        
iChecks[client] = 0;
        
CheckTimers[client] = INVALID_HANDLE;
        return 
Plugin_Stop;
    }
    return 
Plugin_Continue;
}

public 
void SendRequest(int client, const char[] steamID64)
{
    
char sURL[256];
    
GetConVarString(h_sURLsURLsizeof(sURL));
    
    
Handle hRequest SteamWorks_CreateHTTPRequest(k_EHTTPMethodGETsURL);
    
SteamWorks_SetHTTPRequestNetworkActivityTimeout(hRequestGetConVarInt(h_iTimeout));
    
SteamWorks_SetHTTPRequestGetOrPostParameter(hRequest"steamID64"steamID64);
    
SteamWorks_SetHTTPCallbacks(hRequestHTTP_RequestComplete);
    
SteamWorks_SetHTTPRequestContextValue(hRequestGetClientUserId(client));
    
SteamWorks_SendHTTPRequest(hRequest);
    
    
#if defined DEBUG
    
LogToFile(file"HTTP Request has sent for client %i, UserID: %i, SteamID64: %s, URL: %s"clientGetClientUserId(client), steamID64sURL);
    
#endif
}

public 
HTTP_RequestComplete(Handle HTTPRequestbool bFailurebool bRequestSuccessfulEHTTPStatusCode eStatusCodeany userid)
{
    
int client GetClientOfUserId(userid);
    
    
#if defined DEBUG
    
LogToFile(file"HTTP Request call back. client %i, UserID: %i"clientuserid);
    
#endif
    
    
if (!bRequestSuccessful || (eStatusCode != k_EHTTPStatusCode202Accepted && eStatusCode != k_EHTTPStatusCode406NotAcceptable))
    {
        if (
GetConVarBool(h_bKickFailed))
        {
            
KickClient(client"Failed to retrieve profile status.");
        }
        else
        {
            
CreateTimer(60.0Timer_SendRequestAgainuseridTIMER_FLAG_NO_MAPCHANGE);
        }
        
LogError("Private-Kicker: Failed to retrieve user's profile status (HTTP status: %d)"eStatusCode);
        
        
#if defined DEBUG
        
LogToFile(file"HTTP Request call back, connection failed. client %i, UserID: %i, eStatusCode: %d, bRequestSuccessful: %i"clientuserideStatusCodebRequestSuccessful);
        
#endif
        
        
CloseHandle(HTTPRequest);
        return;
    }
    
    if (
eStatusCode == k_EHTTPStatusCode202Accepted)
    {
        
#if defined DEBUG
        
LogToFile(file"HTTP Request call back. client %i, UserID: %i, Public account detected."clientuserid);
        
#endif
        
b_IsPrivate[client] = false;
        
iWarnings[client] = 0;
        
        
CloseHandle(HTTPRequest);
        return;
    }
    if (
eStatusCode == k_EHTTPStatusCode406NotAcceptable)
    {
        
PrintToChat(client"[SM] WARNING! Your steam profile is private. If you don't make it public you will get kicked.");
        
b_IsPrivate[client] = true;
        
iWarnings[client] = 0;
        
        
#if defined DEBUG
        
LogToFile(file"HTTP Request call back. client %i, UserID: %i, Private account detected."clientuserid);
        
#endif
        
        
CloseHandle(HTTPRequest);
        return;
    }
}

public 
Action Timer_SendRequestAgain(Handle timerany userid)
{
    
int client GetClientOfUserId(userid);
    
SendRequest(clientsteamId[client]);

Can you share the file installed in the link?
it just doesn't warn the player while the game hour is hidden. warns the player, but not kickthe server.

Code:
L 12/04/2018 - 00:09:56: [MGAUpload_gizliprofilkick.smx.smx] HTTP Request has sent for client 3, UserID: 4, SteamID64: 76561198870049106, URL: https://steamapi.darkserv.download/public/
L 12/04/2018 - 00:09:56: [MGAUpload_gizliprofilkick.smx.smx] HTTP Request call back. client 2, UserID: 5
L 12/04/2018 - 00:09:56: [MGAUpload_gizliprofilkick.smx.smx] HTTP Request call back. client 2, UserID: 5, Private account detected.
L 12/04/2018 - 00:09:56: [MGAUpload_gizliprofilkick.smx.smx] HTTP Request call back. client 3, UserID: 4
L 12/04/2018 - 00:09:56: [MGAUpload_gizliprofilkick.smx.smx] HTTP Request call back. client 3, UserID: 4, Public account detected.
L 12/04/2018 - 00:10:17: [MGAUpload_gizliprofilkick.smx.smx] HTTP Request has sent for client 3, UserID: 4, SteamID64: 76561198870049106, URL: https://steamapi.darkserv.download/public/
L 12/04/2018 - 00:10:17: [MGAUpload_gizliprofilkick.smx.smx] HTTP Request has sent for client 2, UserID: 5, SteamID64: 76561198844387630, URL: https://steamapi.darkserv.download/public/
L 12/04/2018 - 00:10:18: [MGAUpload_gizliprofilkick.smx.smx] HTTP Request call back. client 3, UserID: 4
L 12/04/2018 - 00:10:18: [MGAUpload_gizliprofilkick.smx.smx] HTTP Request call back. client 3, UserID: 4, Public account detected.
L 12/04/2018 - 00:10:18: [MGAUpload_gizliprofilkick.smx.smx] HTTP Request call back. client 2, UserID: 5
L 12/04/2018 - 00:10:18: [MGAUpload_gizliprofilkick.smx.smx] HTTP Request call back. client 2, UserID: 5, Private account detected.
__________________

Last edited by alphaearth; 12-03-2018 at 16:14.
alphaearth is offline
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 12-03-2018 , 16:16   Re: Plugin that checks steam profiles and warns/kicks private profile holders
Reply With Quote #55

Quote:
Originally Posted by alphaearth View Post
Can you share the file installed in the link?

only the game hour is hidden in the profile does not kick the player.
This one has nothing to do with the "Game details" one, but solely based on the profile's privacy state.
__________________
Mostly known as "DarkDeviL".

Dropbox FastDL: Public folder will no longer work after March 15, 2017!
For more info, see the [SRCDS Thread], or the [HLDS Thread].
DarkDeviL is offline
alphaearth
Senior Member
Join Date: Feb 2018
Location: Turkey
Old 12-03-2018 , 16:30   Re: Plugin that checks steam profiles and warns/kicks private profile holders
Reply With Quote #56

Quote:
Originally Posted by arne1288 View Post
This one has nothing to do with the "Game details" one, but solely based on the profile's privacy state.
warns the player, but not kick the server.
__________________

Last edited by alphaearth; 12-03-2018 at 16:30.
alphaearth is offline
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 12-03-2018 , 16:40   Re: Plugin that checks steam profiles and warns/kicks private profile holders
Reply With Quote #57

Quote:
Originally Posted by alphaearth View Post
warns the player, but not kick the server.
It warns for the amount of times specified in "sm_private_kick_warnings", on "sm_private_kick_warnings"+1, it will kick.

This means if "sm_private_kick_warnings" is set to 5 (default), then it will will warn you 5 times, and on the 6th time, it will kick you. The warning procedure happens every time a player spawns.
So unless your players re-spawn every time they die (e.g. deathmatch), it will require like 5 rounds with warnings, and kick you on the 6th round, with the plugin's default settings.
__________________
Mostly known as "DarkDeviL".

Dropbox FastDL: Public folder will no longer work after March 15, 2017!
For more info, see the [SRCDS Thread], or the [HLDS Thread].
DarkDeviL 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 08:58.


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