Raised This Month: $ Target: $400
 0% 

Auto 1 day ban to Sourcebans on leaving server


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mudkipguy
Member
Join Date: Aug 2016
Location: India
Old 05-02-2018 , 13:32   Auto 1 day ban to Sourcebans on leaving server
Reply With Quote #1

I want a plugin which automatically bans the client on leaving the server. It should be compatible with pugsetup by splewis or any other pug plugin. Players have to do .r / !ready or something similar after which they will get a 1 day cooldown (Sourcebans integration) from accessing the servers in case they disconnect mid game.
__________________
mudkipguy is offline
LaGgLs
Senior Member
Join Date: Apr 2015
Location: sweden
Old 05-05-2018 , 17:08   Re: Auto 1 day ban to Sourcebans on leaving server
Reply With Quote #2

read this thread will help you

https://forums.alliedmods.net/showth...=171454&page=2
LaGgLs is offline
Markiez
Junior Member
Join Date: Mar 2018
Location: somewhere over the rainb
Old 05-06-2018 , 14:01   Re: Auto 1 day ban to Sourcebans on leaving server
Reply With Quote #3

Why not just?
Code:
#include <sourcemod>

#pragma semicolon 1

bool Ready;

public void OnPluginStart()
{
	HookEvent( "player_disconnect", Event_Disconnect, EventHookMode_Pre);
	RegConsoleCmd("sm_ready", Cmd_Ready);
}

public Action Cmd_Ready(int client, int args)
{
	Ready = true;
}

public Action Event_Disconnect(Event event, const char[] name, bool dbc)
{
	new client = GetClientOfUserId(GetEventInt(event, "userid"));
	
	if (Ready)
	{
		Ready = false;
		return;
	}
	
	BanClient(client, 1440, BANFLAG_AUTO, "some shit here");
}

Last edited by Markiez; 05-06-2018 at 14:02. Reason: i included cstrike, didn't even use it lol ^^
Markiez is offline
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 05-06-2018 , 15:49   Re: Auto 1 day ban to Sourcebans on leaving server
Reply With Quote #4

Quote:
Originally Posted by Markiez View Post
Why not just?
Code:
#include <sourcemod>

#pragma semicolon 1

bool Ready;

public void OnPluginStart()
{
	HookEvent( "player_disconnect", Event_Disconnect, EventHookMode_Pre);
	RegConsoleCmd("sm_ready", Cmd_Ready);
}

public Action Cmd_Ready(int client, int args)
{
	Ready = true;
}

public Action Event_Disconnect(Event event, const char[] name, bool dbc)
{
	new client = GetClientOfUserId(GetEventInt(event, "userid"));
	
	if (Ready)
	{
		Ready = false;
		return;
	}
	
	BanClient(client, 1440, BANFLAG_AUTO, "some shit here");
}
That one means just one person has to !ready up, not everyone on the server...
__________________
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
ThatKidWhoGames
Veteran Member
Join Date: Jun 2013
Location: IsValidClient()
Old 05-06-2018 , 21:41   Re: Auto 1 day ban to Sourcebans on leaving server
Reply With Quote #5

Quote:
Originally Posted by Markiez View Post
Why not just?
Code:
#include <sourcemod>

#pragma semicolon 1

bool Ready;

public void OnPluginStart()
{
	HookEvent( "player_disconnect", Event_Disconnect, EventHookMode_Pre);
	RegConsoleCmd("sm_ready", Cmd_Ready);
}

public Action Cmd_Ready(int client, int args)
{
	Ready = true;
}

public Action Event_Disconnect(Event event, const char[] name, bool dbc)
{
	new client = GetClientOfUserId(GetEventInt(event, "userid"));
	
	if (Ready)
	{
		Ready = false;
		return;
	}
	
	BanClient(client, 1440, BANFLAG_AUTO, "some shit here");
}
You need to make an array for the Boolean for each client on the server to have its own value.

EDIT: You should also add return Plugin_Handled to the command's callback to register the command in the game's engine.

Last edited by ThatKidWhoGames; 05-07-2018 at 05:38.
ThatKidWhoGames is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 05-07-2018 , 03:18   Re: Auto 1 day ban to Sourcebans on leaving server
Reply With Quote #6

Change:

PHP Code:
bool Ready
To this:

PHP Code:
bool Ready[MAXPLAYERS 1]; 
This way, the boolean will act as an on/off switch for each client, not just for the entire function.
__________________
Psyk0tik 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 23:53.


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