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

[REQ]Add Whitelist


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sajmooooon
Senior Member
Join Date: Nov 2018
Location: Slovakia
Old 10-08-2019 , 15:24   [REQ]Add Whitelist
Reply With Quote #1

Can someone add whitelist which use STEAM ID in this plugin?

Code:
#pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR "nhnkl159"
#define PLUGIN_VERSION "1.0"

#include <sourcemod>
#include <sdktools>
#include <system2>
#include <sourcebans>

ConVar gB_Enabled;
ConVar gB_Type;
ConVar gB_Time;
ConVar gB_Message;

bool gB_UseSourcebans;


public Plugin myinfo = 
{
	name = "[CS:GO / ?] VPN Blocker",
	author = PLUGIN_AUTHOR,
	description = "Blocking players with VPN from joining to your server.",
	version = PLUGIN_VERSION,
	url = "none"
};

public void OnPluginStart()
{
	// === ConVars === //
	gB_Enabled = CreateConVar("blocker_enabled", "1", "Enable the blocker ?");
	gB_Type = CreateConVar("blocker_type", "1", "What to do with player who join with VPN. \n 1 = Kick \n 2 = Ban");
	gB_Time = CreateConVar("blocker_bantime", "30", "Banning time if 'blocker_type == 2' (Minutes).");
	gB_Message = CreateConVar("blocker_message", "This server is not allowing players with VPN to join the server.", "Message when player get kicked / banned.");
	
	AutoExecConfig(true, "vpn_blocker");
}

public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
{
	MarkNativeAsOptional("SBBanPlayer");
	
	RegPluginLibrary("vpnblocker");
	
	return APLRes_Success;
}

public OnAllPluginsLoaded()
{
	if (LibraryExists("sourcebans"))
	{
		gB_UseSourcebans = true;
	}
}

public OnLibraryAdded(const char[] name)
{
	if (StrEqual("sourcebans", name))
	{
		gB_UseSourcebans = true;
	}
}

public OnLibraryRemoved(const char[] name)
{
	if (StrEqual("sourcebans", name))
	{
		gB_UseSourcebans = false;
	}
}

public void OnClientPostAdminCheck(int client)
{
	if (!gB_Enabled.IntValue) return;
	
	char IP[32], text[128];
	GetClientIP(client, IP, sizeof(IP));
	Format(text, 128, "?ip=%s", IP);
	
	
	System2_GetPage(OnComplete, "http://www.shroomery.org/ythan/proxycheck.php", text, "", client); 
}

public OnComplete(const char[] output, const size, CMDReturn status, any client) 
{
	if(StrEqual(output, "Y"))
	{
		char TheMessage[128];
		gB_Message.GetString(TheMessage, 128);
	
		switch(gB_Type.IntValue)
		{
			case 1:
			{
				KickClient(client, TheMessage);
			}
			case 2:
			{
				if(gB_UseSourcebans)
				{
					SBBanPlayer(0, client, gB_Time.IntValue, TheMessage);
				}
				else
				{
					BanClient(client, gB_Time.IntValue, BANFLAG_AUTO, TheMessage, TheMessage);
				}
			}
		}
		
	}
}
Sajmooooon 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 00:14.


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