Авто Бан за выход из Сервера

NIKOLYA-PRODIGY

ANPORTGAMES.RU
Сообщения
496
Реакции
135
нужен плагин для CS GO, который будет банить на определенное время за выход из игры, если игрок не вернется через указанное время на сервер назад

плагин нужен для микс сервера, пробовал разные расширения вармода, но они не работают в ГО или только для css ...

нашел старенький плагин, скомпилировал его, но плагин не запускается, говорит не может найти соурсбанс, хотя банс установлен и работает ...

вот исходник
C-подобный:
/**
Plugin Requested by Mistery (profile-http://forums.alliedmods.net/member.php?u=160070) 
REQ URL - http://forums.alliedmods.net/showthread.php?t=171454

Match Kick
	DESCRIPTION:
		Will ban players if they leave while the game/match is live
			* This plugin works with Sourcebans as it uses the sm_addban command
		
	VERSION HISTORY:
		1.0.0	-	Initial code
		1.0.1	-	Fixed BanIdentiy BANFLAG error
		1.0.2	-	Changed datapack from using clientId to userId
		1.0.3	-	Added bypass for players with "allow_matchkick_bypass" or ADMFLAG_CUSTOM4.  They will not get banned
		1.0.4	-	Fixed delayed ban to work with Sourcebans
		1.0.5	-	Removed the include for sourcebans and using the sm_addban server command instead
		1.0.6	-	Cleaned up the method of banning to reduce redundant code
		1.0.7	-	Added an argument for the sm_matchkick command so it's easier to use in config files 
				-	sm_matchkick 1 = On
				-	sm_matchkick 0 = Off
		1.0.8	-	Fixed "Native "IsClientInGame" reported: Client index 0 is invalid" error
		1.0.9	-	Re-Added include for sourcebans for if BanOnDisconnect then use the SBBanPlayer
		
	TO DO LIST:
		*	Add translation capability
		*	Add Updater for automatic updates to this plugin
**/

#pragma semicolon 1

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

#define PLUGIN_VERSION "1.0.9"

new Handle:h_Trie;

new bool:IsSBAvailable = false;
new bool:BanOnDisconnect = true;
new bool:MK_Is_Enabled = false;

new Float:BanDelay;

new BanLength;

public Plugin:myinfo = 
{
	name = "Match Kick",
	author = "TnTSCS aka ClarkKent",
	description = "Bans a player if they disconnect on a live match",
	version = PLUGIN_VERSION,
	url = "http://www.sourcemod.net"
}

public OnPluginStart()
{
	CreateConVar("sm_matchkick_version", PLUGIN_VERSION, "Version of Match Kick", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
	CreateConVar("sm_matchkick_version_build", SOURCEMOD_VERSION, "The version of SourceMod that 'Match Kick' was compiled with.", FCVAR_PLUGIN);
	
	new Handle:hRandom; // KyleS hates handles	

	HookConVarChange((hRandom = CreateConVar("sm_matchkick_banondisconnect", "1", 
	"1 = Ban player if they disconnect during a live match || 2 = Ban player after sm_matchkick_bandelay seconds of disconnecting during a live match", _, true, 0.0, true, 1.0)), BanOnDisconnectChanged);
	BanOnDisconnect = GetConVarBool(hRandom);
	
	HookConVarChange((hRandom = CreateConVar("sm_matchkick_bandelay", "60", 
	"Number of seconds to wait for player to reconnect before banning them for leaving during a live match", _, true, 1.0, true, 180.0)), BanDelayChanged);
	BanDelay = GetConVarFloat(hRandom);
	
	HookConVarChange((hRandom = CreateConVar("sm_matchkick_banlength", "1440", 
	"How many minutes to ban a player if they leave during a live match (1440 minutes = 24 hours = 1 day || 10080 minutes = 7 days)", _, true, 1.0, true, 10080.0)), BanLengthChanged);
	BanLength = GetConVarInt(hRandom);
	
	CloseHandle(hRandom); // KyleS hates handles
	
	RegAdminCmd("sm_matchkick", cmdMatchKick, ADMFLAG_BAN, "Will toggle the match live auto ban feature");

	HookEvent("player_disconnect", PlayerDisconnect_Event);
	
	// Execute the config file
	AutoExecConfig(true, "plugin.sm_matchkick");
	
	h_Trie = CreateTrie();
}

public BanOnDisconnectChanged(Handle:cvar, const String:oldVal[], const String:newVal[])
	BanOnDisconnect = GetConVarBool(cvar);
	
public BanDelayChanged(Handle:cvar, const String:oldVal[], const String:newVal[])
	BanDelay = GetConVarFloat(cvar);
	
public BanLengthChanged(Handle:cvar, const String:oldVal[], const String:newVal[])
	BanLength = GetConVarInt(cvar);

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

public OnLibraryAdded(const String:name[])
{
	if (StrEqual(name, "sourcebans"))
	{
		IsSBAvailable = true;
	}
}

public OnLibraryRemoved(const String:name[])
{
	if (StrEqual(name, "sourcebans"))
	{
		IsSBAvailable = false;
	}
}

public OnMapStart()
{
	// Clear all entries of the Trie
	ClearTrie(h_Trie);
}

public OnClientAuthorized(client, const String:auth[])
{
	// Do not process if client is a BOT
	if(!IsFakeClient(client))
	{
		new UserID_Check;
		
		// Retrieve the value of the Trie, if it exists and store that value in the cash variable
		if(GetTrieValue(h_Trie, auth, UserID_Check))
			RemoveFromTrie(h_Trie, auth);
	}
}

public Action:Timer_BanEnforce(Handle:timer, Handle:mypack)
{
	new UserID_Check;
	decl String:sClient[MAXPLAYERS];
	decl String:authString[20];
	decl String:reason[192];
	decl String:playername[MAX_NAME_LENGTH];
	
	ResetPack(mypack);
	
	new UserID = ReadPackCell(mypack);
	ReadPackString(mypack, sClient, sizeof(sClient));
	ReadPackString(mypack, authString, 20);
	ReadPackString(mypack, reason, sizeof(reason));
	ReadPackString(mypack, playername, sizeof(playername));
	
	if(GetTrieValue(h_Trie, authString, UserID_Check))
	{
		new client = StringToInt(sClient);
		MK_BanPlayer(UserID, client, authString, reason, playername, false);
		
		RemoveFromTrie(h_Trie, authString);
	}
}

public PlayerDisconnect_Event(Handle:event, String:name[], bool:dontBroadcast)
{
	new UserID = GetEventInt(event, "userid");
	new client = GetClientOfUserId(UserID);
	
	if(client == 0)
		return;
	
	if(IsClientInGame(client) && !IsFakeClient(client) && MK_Is_Enabled)
	{
		if(CheckCommandAccess(client, "allow_matchkick_bypass", ADMFLAG_CUSTOM4))
			return;
			
		// Get and store the client's SteamID
		decl String:authString[20];
		GetClientAuthString(client, authString, 20);
		
		// Get and store the player's name in a string for later use
		new String:playername[MAX_NAME_LENGTH];
		GetClientName(client, playername, sizeof(playername));
		
		// Get and store the client's disconnect reason
		decl String:reason[64];
		GetEventString(event, "reason", reason, sizeof(reason));
		
		if(StrContains(reason, "Disconnect by user.") != -1)
		{
			if(BanOnDisconnect)
			{
				MK_BanPlayer(UserID, client, authString, reason, playername, true);
				
				return;
			}
			
			// Adds the clients AuthID to the trie for further processing by the timer to follow
			SetTrieValue(h_Trie, authString, UserID, true);
			
			new Handle:mypack;
			new String:sClient[MAXPLAYERS];
			IntToString(client, sClient, sizeof(sClient));
			
			CreateDataTimer(BanDelay, Timer_BanEnforce, mypack);
			
			WritePackCell(mypack, UserID);
			WritePackString(mypack, sClient);
			WritePackString(mypack, authString);
			WritePackString(mypack, reason);
			WritePackString(mypack, playername);
		}
	}
}

public MK_BanPlayer(any:UserID, any:client, const String:auth[], const String:reason[], const String:name[], bool:PlayerConnected)
{
	if(PlayerConnected)
	{
		if(IsSBAvailable)
		{
			SBBanPlayer(0, client, BanLength, "Left during live match");
		}
		else
		{
			BanClient(client, BanLength, BANFLAG_AUTO, "Left during live match");
		}
	}
	else
	{
		ServerCommand("sm_addban %i \"%s\" \"Left during live match\"", BanLength, auth);
	}
	
	LogMessage("%s [UserID #%i] [ClientID #%i] [%s] was banned for leaving during a live match.  DISCONNECT REASON was: %s", name, UserID, client, auth, reason);
}

public Action:cmdMatchKick(client, args)
{
	if (args != 1)
	{
		ReplyToCommand(client, "\x04[\x03Match Kick\x04]\x01 Usage: sm_matchkick <1/0>");
		return Plugin_Handled;
	}
	
	new String:arg[2];
	GetCmdArg(1, arg, sizeof(arg));
	
	new OnOff = StringToInt(arg);

	switch(OnOff)
	{
		case 0:
		{
			if(!MK_Is_Enabled)
				return Plugin_Handled;
			
			MK_Is_Enabled = false;
			PrintToChatAll("\x04Match Kick is -[\x03deactivated\x04]-");
			LogMessage("[MATCH KICK] DeActivated");		
		}
		
		case 1:
		{
			if(MK_Is_Enabled)
				return Plugin_Handled;
			
			MK_Is_Enabled = true;
			PrintToChatAll("\x04Match Kick is -[\x03active\x04]-");
			PrintToChatAll("\x04Do not disconnect while game is -[\x03live\x04]- or you may get banned!");
			LogMessage("[MATCH KICK] Activated");
		}
		
		default:
		{
			ReplyToCommand(client, "\x04[\x03Match Kick\x04]\x01 Usage: sm_matchkick <1/0>");
		}
	}
	return Plugin_Continue;
}
 

KorDen

Atra esterní ono thelduin!
Сообщения
2,142
Реакции
1,424
Оффтоп

Вообще, по коду,он должен работать и без SB...
Попробуй перед
#include <sourcebans>
добавить
#undef REQUIRE_PLUGIN

И проверь, что у тебя в includes версия sourcebans.inc совпадает с твоей версией плагина SB...
 

NIKOLYA-PRODIGY

ANPORTGAMES.RU
Сообщения
496
Реакции
135
KorDen, скомпилировался плагин, как вы сказали, добавил строчку
в инклудес не нашел версии плагина, но это не помешало

плагин запускается, откликается на активацию, но тем не менее не происходит бан
в логах соурсбанс увидел следующее

C-подобный:
L 04/21/2013 - 17:34:07: [sourcebans.smx] Verify Insert Query Failed: Subquery returns more than 1 row

если есть возможность помоги разобраться, я думаю плагин очень многим будет полезен

спасибо!
 
Сверху Снизу