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

AutoBan on player exit


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
paul181516
Junior Member
Join Date: Aug 2017
Location: Colombia
Old 12-26-2017 , 20:35   AutoBan on player exit
Reply With Quote #1

Hi, im look for plugin that ban when player leave PUG on my CS:GO server.

I check this but plugin doesnt work
https://forums.alliedmods.net/showpo...3&postcount=10

also i check this plugin ( https://forums.alliedmods.net/showthread.php?t=135533 ) But doesnt ban automatically

Anyway, the first plugin that I show you, looks fine, with simple cvar activating the plugin when PUG start, but doesnt work. Just want something like competitive punishment by leaving the matchmaking

I hope anyone can help me, thanks a lot

Last edited by paul181516; 12-26-2017 at 20:36.
paul181516 is offline
Send a message via MSN to paul181516 Send a message via Skype™ to paul181516
midnight9
Senior Member
Join Date: Nov 2012
Old 12-27-2017 , 12:29   Re: AutoBan on player exit
Reply With Quote #2

Code:
public OnPluginStart ()
{
	HookEvent("player_disconnect", Event_PlayerDisconnect, EventHookMode_Post);
}



public Action:Event_PlayerDisconnect(Handle:event, String:name[], bool:dontBroadcast)
{
	decl String:reason[128];
	new client = GetClientOfUserId(GetEventInt(event, "userid"));
	GetEventString(event, "reason", reason, 128);
	if (StrEqual(reason, "Disconnect by user."))
	{
		BanClient(client, 0, BANFLAG_AUTHID, "Has been banned for leaving while match is live!", "You have been banned for leaving while match is live!");		
		
	}
	return Plugin_Handled;
}

Last edited by midnight9; 12-27-2017 at 12:31.
midnight9 is offline
shanapu
Veteran Member
Join Date: Apr 2015
Location: .de
Old 12-27-2017 , 13:50   Re: AutoBan on player exit
Reply With Quote #3

Quote:
Originally Posted by midnight9 View Post
Code:
public OnPluginStart ()
{
	HookEvent("player_disconnect", Event_PlayerDisconnect, EventHookMode_Post);
}



public Action:Event_PlayerDisconnect(Handle:event, String:name[], bool:dontBroadcast)
{
	decl String:reason[128];
	new client = GetClientOfUserId(GetEventInt(event, "userid"));
	GetEventString(event, "reason", reason, 128);
	if (StrEqual(reason, "Disconnect by user."))
	{
		BanClient(client, 0, BANFLAG_AUTHID, "Has been banned for leaving while match is live!", "You have been banned for leaving while match is live!");		
		
	}
	return Plugin_Handled;
}
This will ban every player who disconnects from server regardless of match has started/ended nor is running. A check for running match is missing

@OP you should tell us which PUG-plugin you use. Also if you use sourcebans or any other bansystem
__________________
coding & free software
shanapu is offline
paul181516
Junior Member
Join Date: Aug 2017
Location: Colombia
Old 12-27-2017 , 14:23   Re: AutoBan on player exit
Reply With Quote #4

Quote:
Originally Posted by midnight9 View Post
Code:
public OnPluginStart ()
{
	HookEvent("player_disconnect", Event_PlayerDisconnect, EventHookMode_Post);
}



public Action:Event_PlayerDisconnect(Handle:event, String:name[], bool:dontBroadcast)
{
	decl String:reason[128];
	new client = GetClientOfUserId(GetEventInt(event, "userid"));
	GetEventString(event, "reason", reason, 128);
	if (StrEqual(reason, "Disconnect by user."))
	{
		BanClient(client, 0, BANFLAG_AUTHID, "Has been banned for leaving while match is live!", "You have been banned for leaving while match is live!");		
		
	}
	return Plugin_Handled;
}
I can put a cvar maybe and see how it works. Thanks

Quote:
Originally Posted by shanapu View Post
This will ban every player who disconnects from server regardless of match has started/ended nor is running. A check for running match is missing

@OP you should tell us which PUG-plugin you use. Also if you use sourcebans or any other bansystem
Thats right, im gonna trying inserting a cvar and console log. I use OEM ban system on sourcemod, and im using this plugin (https://github.com/splewis/csgo-pug-setup) thanks a lot for reply the post
paul181516 is offline
Send a message via MSN to paul181516 Send a message via Skype™ to paul181516
shanapu
Veteran Member
Join Date: Apr 2015
Location: .de
Old 12-27-2017 , 14:59   Re: AutoBan on player exit
Reply With Quote #5

not sure what you mean with "insert cvar", but to get what you want you should use these natives from PUG, so only player leaving a live match are banned
PHP Code:
// Returns the current pug gamestate.
native GameState PugSetup_GetGameState();

// Returns if there is currently a match setup.
native bool PugSetup_IsMatchLive();

// Returns if the match is pending start. (e.g. during the lo3)
native bool PugSetup_IsPendingStart(); 
https://github.com/splewis/csgo-pug-....inc#L246-L253
__________________
coding & free software

Last edited by shanapu; 12-27-2017 at 15:00.
shanapu is offline
paul181516
Junior Member
Join Date: Aug 2017
Location: Colombia
Old 12-27-2017 , 20:31   Re: AutoBan on player exit
Reply With Quote #6

Quote:
Originally Posted by shanapu View Post
not sure what you mean with "insert cvar", but to get what you want you should use these natives from PUG, so only player leaving a live match are banned
PHP Code:
// Returns the current pug gamestate.
native GameState PugSetup_GetGameState();

// Returns if there is currently a match setup.
native bool PugSetup_IsMatchLive();

// Returns if the match is pending start. (e.g. during the lo3)
native bool PugSetup_IsPendingStart(); 
https://github.com/splewis/csgo-pug-....inc#L246-L253
I modify the last code but doesnt work
Quote:
#include <sourcemod>
#include <pugsetup>

public Plugin:myinfo = {
name = "Matchkick",
author = "Impact",
description = "Bans a player who is disconnected on a live match",
version = "0.0",
url = "non"
}

public OnPluginStart()
{
HookEvent("player_disconnect", Event_PlayerDisconnect, EventHookMode_Post);
}

public Action:Event_PlayerDisconnect(Handle:event, String:name[], bool:dontBroadcast)
{
if(PugSetup_IsMatchLive())
{
decl String:reason[128];
decl String:username[64];
new client = GetClientOfUserId(GetEventInt(event, "userid"));
GetEventString(event, "name", username, sizeof(username));
GetEventString(event, "reason", reason, 12;
if (StrEqual(reason, "Disconnect by user."))
{
BanClient(client, 0, BANFLAG_AUTHID, "Fue baneado por salirse en medio de un PUG!", "Fuiste baneado por salirte en medio de un PUG!");
LogMessage("%s fue baneado por salirse en medio de un PUG: %s", username, reason);
PrintToChatAll("%s fue baneado por salirse en medio de un PUG");
PrintToChatAll("%s fue baneado por salirse en medio de un PUG");
PrintToChatAll("%s fue baneado por salirse en medio de un PUG");

}
}
return Plugin_Handled;
}

Last edited by paul181516; 12-27-2017 at 20:38.
paul181516 is offline
Send a message via MSN to paul181516 Send a message via Skype™ to paul181516
shanapu
Veteran Member
Join Date: Apr 2015
Location: .de
Old 12-27-2017 , 21:41   Re: AutoBan on player exit
Reply With Quote #7

according to https://wiki.alliedmods.net/Generic_...yer_disconnect the reason should be "self" and not "Disconnect by user."

edit: untested
PHP Code:
#include <sourcemod>
#include <pugsetup>

public Plugin:myinfo = {
name "Matchkick",
author "paul181516",  // you're not Impact
description "Bans a player who is disconnected on a live match",
version "0.0",
url "non"
}

public 
OnPluginStart()
{
    
HookEvent("player_disconnect"Event_PlayerDisconnectEventHookMode_Post);
}

public 
Action:Event_PlayerDisconnect(Handle:eventString:name[], bool:dontBroadcast)
{
    if(
PugSetup_IsMatchLive())
    {
        
decl String:reason[128];
        new 
client GetClientOfUserId(GetEventInt(event"userid"));
        
GetEventString(event"reason"reasonsizeof(reason)); // you shouldn't 'hardcode' a string length use always 'sizeof'
        
if (StrEqual(reason"self"))
        {
            
BanClient(client0BANFLAG_AUTHID"Fue baneado por salirse en medio de un PUG!""Fuiste baneado por salirte en medio de un PUG!");
            
LogMessage("%L fue baneado por salirse en medio de un PUG"client);
            
PrintToChatAll("%N fue baneado por salirse en medio de un PUG"client);
            
PrintToChatAll("%N fue baneado por salirse en medio de un PUG"client);
            
PrintToChatAll("%N fue baneado por salirse en medio de un PUG"client);
        }
    }
    return 
Plugin_Handled;

these is no need to get the username. you can use %N with clientid to print nicknames. %L for nick, steamid,ip,...
__________________
coding & free software

Last edited by shanapu; 12-27-2017 at 21:49.
shanapu is offline
paul181516
Junior Member
Join Date: Aug 2017
Location: Colombia
Old 12-27-2017 , 22:25   Re: AutoBan on player exit
Reply With Quote #8

Quote:
Originally Posted by shanapu View Post
according to https://wiki.alliedmods.net/Generic_...yer_disconnect the reason should be "self" and not "Disconnect by user."

edit: untested
PHP Code:
#include <sourcemod>
#include <pugsetup>

public Plugin:myinfo = {
name "Matchkick",
author "paul181516",  // you're not Impact
description "Bans a player who is disconnected on a live match",
version "0.0",
url "non"
}

public 
OnPluginStart()
{
    
HookEvent("player_disconnect"Event_PlayerDisconnectEventHookMode_Post);
}

public 
Action:Event_PlayerDisconnect(Handle:eventString:name[], bool:dontBroadcast)
{
    if(
PugSetup_IsMatchLive())
    {
        
decl String:reason[128];
        new 
client GetClientOfUserId(GetEventInt(event"userid"));
        
GetEventString(event"reason"reasonsizeof(reason)); // you shouldn't 'hardcode' a string length use always 'sizeof'
        
if (StrEqual(reason"self"))
        {
            
BanClient(client0BANFLAG_AUTHID"Fue baneado por salirse en medio de un PUG!""Fuiste baneado por salirte en medio de un PUG!");
            
LogMessage("%L fue baneado por salirse en medio de un PUG"client);
            
PrintToChatAll("%N fue baneado por salirse en medio de un PUG"client);
            
PrintToChatAll("%N fue baneado por salirse en medio de un PUG"client);
            
PrintToChatAll("%N fue baneado por salirse en medio de un PUG"client);
        }
    }
    return 
Plugin_Handled;

these is no need to get the username. you can use %N with clientid to print nicknames. %L for nick, steamid,ip,...
Thanks a lot but im just tested and doesnt work. Also I try changing the pugsetup include from #include <pugsetup> to #include "include/pugsetup.inc", no idea why isnt working
paul181516 is offline
Send a message via MSN to paul181516 Send a message via Skype™ to paul181516
midnight9
Senior Member
Join Date: Nov 2012
Old 12-28-2017 , 01:39   Re: AutoBan on player exit
Reply With Quote #9

Quote:
Originally Posted by shanapu View Post
according to https://wiki.alliedmods.net/Generic_...yer_disconnect the reason should be "self" and not "Disconnect by user."

edit: untested
PHP Code:
#include <sourcemod>
#include <pugsetup>

public Plugin:myinfo = {
name "Matchkick",
author "paul181516",  // you're not Impact
description "Bans a player who is disconnected on a live match",
version "0.0",
url "non"
}

public 
OnPluginStart()
{
    
HookEvent("player_disconnect"Event_PlayerDisconnectEventHookMode_Post);
}

public 
Action:Event_PlayerDisconnect(Handle:eventString:name[], bool:dontBroadcast)
{
    if(
PugSetup_IsMatchLive())
    {
        
decl String:reason[128];
        new 
client GetClientOfUserId(GetEventInt(event"userid"));
        
GetEventString(event"reason"reasonsizeof(reason)); // you shouldn't 'hardcode' a string length use always 'sizeof'
        
if (StrEqual(reason"self"))
        {
            
BanClient(client0BANFLAG_AUTHID"Fue baneado por salirse en medio de un PUG!""Fuiste baneado por salirte en medio de un PUG!");
            
LogMessage("%L fue baneado por salirse en medio de un PUG"client);
            
PrintToChatAll("%N fue baneado por salirse en medio de un PUG"client);
            
PrintToChatAll("%N fue baneado por salirse en medio de un PUG"client);
            
PrintToChatAll("%N fue baneado por salirse en medio de un PUG"client);
        }
    }
    return 
Plugin_Handled;

these is no need to get the username. you can use %N with clientid to print nicknames. %L for nick, steamid,ip,...
"Disconnect by user." Works for me, although I tested it with different game.
midnight9 is offline
paul181516
Junior Member
Join Date: Aug 2017
Location: Colombia
Old 12-28-2017 , 02:41   Re: AutoBan on player exit
Reply With Quote #10

Quote:
Originally Posted by midnight9 View Post
"Disconnect by user." Works for me, although I tested it with different game.
Doesnt work, im already tryed
paul181516 is offline
Send a message via MSN to paul181516 Send a message via Skype™ to paul181516
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 09:01.


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