AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   Solved [REQ] Ban on disconnect and works with SourceBans ($$) (https://forums.alliedmods.net/showthread.php?t=313897)

akzmeister 01-26-2019 21:22

[REQ] Ban on disconnect and works with SourceBans ($$)
 
Looking for a developer to make a plugin that bans the people who disconnects in middle of a PUG (splewis pug setup), and also saves the ban in SourceBans.

Contact:
Discord: akz#6617
Steam: https://steamcommunity.com/id/akazetaa

CliptonHeist 01-26-2019 23:42

Re: [REQ] Ban on disconnect and works with SourceBans ($$)
 
That'll be $1000 please.

PHP Code:

#include <sourcemod>
#include <pugsetup>
#include <sourcebanspp>

#pragma semicolon 1
#pragma newdecls required

ConVar g_hCVBanTime;
ConVar g_hCVBanReason;

bool g_bSourcebans false;
bool g_bPugSetup false;

public 
Plugin myinfo 
{
    
name "Disconnect Ban"
    
author "The Doggy"
    
description "Bans players who disconnect during a match"
    
version "1.0.0",
    
url "DistrictNine.Host"
};

public 
void OnPluginStart()
{
    
g_hCVBanTime CreateConVar("sm_disconnectban_time""0""Amount of time to ban a player who disconnects during a match");
    
g_hCVBanReason CreateConVar("sm_disconnectban_reason""Disconnected from match""Reason to tell user why they were banned.");
}

public 
void OnAllPluginsLoaded()
{
    if(
LibraryExists("sourcebans++"))
        
g_bSourcebans true;
    else
        
LogError("Sourcebans++ is not loaded, this plugin will not work without it.");

    if(
LibraryExists("pugsetup"))
        
g_bPugSetup true;
    else
        
LogError("PugSetup is not loaded, this plugin will not work without it.");
}

public 
void OnLibraryAdded(const char[] name)
{
    if(
StrEqual(name"sourcebans++"))
        
g_bSourcebans true;
    if(
StrEqual(name"pugsetup"))
        
g_bPugSetup true;
}

public 
void OnLibraryRemoved(const char[] name)
{
    if(
StrEqual(name"sourcebans++"))
    {
        
g_bSourcebans false;
        
LogError("Sourcebans++ has been unloaded, this plugin will not work without it.");
    }
    if(
StrEqual(name"pugsetup"))
    {
        
g_bPugSetup false;
        
LogError("PugSetup has been unloaded, this plugin will not work without it.");
    }
}

public 
void OnClientDisconnect(int Client)
{
    if(!
g_bSourcebans || !g_bPugSetup) return;

    if(
PugSetup_IsMatchLive() && PugSetup_PlayerAtStart(Client))
    {
        
char sReason[256];
        
g_hCVBanReason.GetString(sReasonsizeof(sReason));
        
SBPP_BanPlayer(0Clientg_hCVBanTime.IntValuesReason);
    }



gildevanaraujo 01-28-2019 11:40

Re: [REQ] Ban on disconnect and works with SourceBans ($$)
 
I wonder if you can leave immune mods and server admins, it is banishing everything! HAHAHAHAHA!

DarkDeviL 01-28-2019 11:58

Re: [REQ] Ban on disconnect and works with SourceBans ($$)
 
Quote:

Originally Posted by gildevanaraujo (Post 2636996)
I wonder if you can leave immune mods and server admins, it is banishing everything! HAHAHAHAHA!

PHP Code:

#include <sourcemod>
#include <pugsetup>
#include <sourcebanspp>

#pragma semicolon 1
#pragma newdecls required

ConVar g_hCVBanTime;
ConVar g_hCVBanReason;

bool g_bSourcebans false;
bool g_bPugSetup false;

public 
Plugin myinfo 
{
    
name "Disconnect Ban"
    
author "The Doggy"
    
description "Bans players who disconnect during a match"
    
version "1.0.0",
    
url "DistrictNine.Host"
};

public 
void OnPluginStart()
{
    
g_hCVBanTime CreateConVar("sm_disconnectban_time""0""Amount of time to ban a player who disconnects during a match");
    
g_hCVBanReason CreateConVar("sm_disconnectban_reason""Disconnected from match""Reason to tell user why they were banned.");
}

public 
void OnAllPluginsLoaded()
{
    if(
LibraryExists("sourcebans++"))
        
g_bSourcebans true;
    else
        
LogError("Sourcebans++ is not loaded, this plugin will not work without it.");

    if(
LibraryExists("pugsetup"))
        
g_bPugSetup true;
    else
        
LogError("PugSetup is not loaded, this plugin will not work without it.");
}

public 
void OnLibraryAdded(const char[] name)
{
    if(
StrEqual(name"sourcebans++"))
        
g_bSourcebans true;
    if(
StrEqual(name"pugsetup"))
        
g_bPugSetup true;
}

public 
void OnLibraryRemoved(const char[] name)
{
    if(
StrEqual(name"sourcebans++"))
    {
        
g_bSourcebans false;
        
LogError("Sourcebans++ has been unloaded, this plugin will not work without it.");
    }
    if(
StrEqual(name"pugsetup"))
    {
        
g_bPugSetup false;
        
LogError("PugSetup has been unloaded, this plugin will not work without it.");
    }
}

public 
void OnClientDisconnect(int Client)
{
    if(!
g_bSourcebans || !g_bPugSetup) return;

    if(!
CheckCommandAccess(Client"sm_disconnectban_immune"ADMFLAG_ROOT) && PugSetup_IsMatchLive() && PugSetup_PlayerAtStart(Client))
    {
        
char sReason[256];
        
g_hCVBanReason.GetString(sReasonsizeof(sReason));
        
SBPP_BanPlayer(0Clientg_hCVBanTime.IntValuesReason);
    }


Then your relevant admins (e.g. the admin groups), allowing them access to the "sm_disconnectban_immune" override, and they will not be punished.


Quote:

Originally Posted by CliptonHeist (Post 2636783)
That'll be $1000 please.

I also expect a tiny administrative fee on top of that, due to the fact that you didn't mention to begin with, that your admins/mods were super gods that should be excluded (e.g. job wasn't specified properly).

That'll be $1500 here, please.

Lannister 01-28-2019 12:25

Re: [REQ] Ban on disconnect and works with SourceBans ($$)
 
Quote:

Originally Posted by arne1288 (Post 2637004)
PHP Code:

#include <sourcemod>
#include <pugsetup>
#include <sourcebanspp>

#pragma semicolon 1
#pragma newdecls required

ConVar g_hCVBanTime;
ConVar g_hCVBanReason;

bool g_bSourcebans false;
bool g_bPugSetup false;

public 
Plugin myinfo 
{
    
name "Disconnect Ban"
    
author "The Doggy"
    
description "Bans players who disconnect during a match"
    
version "1.0.0",
    
url "DistrictNine.Host"
};

public 
void OnPluginStart()
{
    
g_hCVBanTime CreateConVar("sm_disconnectban_time""0""Amount of time to ban a player who disconnects during a match");
    
g_hCVBanReason CreateConVar("sm_disconnectban_reason""Disconnected from match""Reason to tell user why they were banned.");
}

public 
void OnAllPluginsLoaded()
{
    if(
LibraryExists("sourcebans++"))
        
g_bSourcebans true;
    else
        
LogError("Sourcebans++ is not loaded, this plugin will not work without it.");

    if(
LibraryExists("pugsetup"))
        
g_bPugSetup true;
    else
        
LogError("PugSetup is not loaded, this plugin will not work without it.");
}

public 
void OnLibraryAdded(const char[] name)
{
    if(
StrEqual(name"sourcebans++"))
        
g_bSourcebans true;
    if(
StrEqual(name"pugsetup"))
        
g_bPugSetup true;
}

public 
void OnLibraryRemoved(const char[] name)
{
    if(
StrEqual(name"sourcebans++"))
    {
        
g_bSourcebans false;
        
LogError("Sourcebans++ has been unloaded, this plugin will not work without it.");
    }
    if(
StrEqual(name"pugsetup"))
    {
        
g_bPugSetup false;
        
LogError("PugSetup has been unloaded, this plugin will not work without it.");
    }
}

public 
void OnClientDisconnect(int Client)
{
    if(!
g_bSourcebans || !g_bPugSetup) return;

    if(!
CheckCommandAccess(Client"sm_disconnectban_immune"ADMFLAG_ROOT) && PugSetup_IsMatchLive() && PugSetup_PlayerAtStart(Client))
    {
        
char sReason[256];
        
g_hCVBanReason.GetString(sReasonsizeof(sReason));
        
SBPP_BanPlayer(0Clientg_hCVBanTime.IntValuesReason);
    }


Then your relevant admins (e.g. the admin groups), allowing them access to the "sm_disconnectban_immune" override, and they will not be punished.




I also expect a tiny administrative fee on top of that, due to the fact that you didn't mention to begin with, that your admins/mods were super gods that should be excluded (e.g. job wasn't specified properly).

That'll be $1500 here, please.

Ah... yes.. everything is correct.

I expect a tiny administrative fee for checking that everything was properly made.

That'll be $3.000 and a beer. Thanks

gildevanaraujo 01-28-2019 14:36

Re: [REQ] Ban on disconnect and works with SourceBans ($$)
 
This is correct?

PHP Code:

if(!CheckCommandAccess(Client"sm_disconnectban_immune"ADMFLAG_ROOT ADMFLAG_BAN) && PugSetup_IsMatchLive() && PugSetup_PlayerAtStart(Client)) 


I want the admin flag and flag ban to have immunity, right?

DarkDeviL 01-28-2019 14:55

Re: [REQ] Ban on disconnect and works with SourceBans ($$)
 
Quote:

Originally Posted by gildevanaraujo (Post 2637040)
This is correct?

PHP Code:

if(!CheckCommandAccess(Client"sm_disconnectban_immune"ADMFLAG_ROOT ADMFLAG_BAN) && PugSetup_IsMatchLive() && PugSetup_PlayerAtStart(Client)) 


I want the admin flag and flag ban to have immunity, right?

I don't believe I haven't ever seen | used with CheckCommandAccess, but you can do mutltiple CheckCommandAccess, e.g.:

PHP Code:

if(!CheckCommandAccess(Client"sm_disconnectban_immune"ADMFLAG_ROOT) && !CheckCommandAccess(Client"sm_disconnectban_immune"ADMFLAG_BAN) && PugSetup_IsMatchLive() && PugSetup_PlayerAtStart(Client)) 

Although I strongly suggest you to work on overrides if you are not already doing that.

They don't only give you access to those ~21'ish flags that SourceMod comes with, but is literally a way you can create "custom flags" with.

As overrides can be any alphanumeric value, you have like millions of options with them rather than just 21 different options with the flags.

gildevanaraujo 01-28-2019 16:04

Re: [REQ] Ban on disconnect and works with SourceBans ($$)
 
One question, how do I banish only temporarily? You're banishing just permanent.

eyal282 01-28-2019 16:07

Re: [REQ] Ban on disconnect and works with SourceBans ($$)
 
Quote:

Originally Posted by gildevanaraujo (Post 2637054)
One question, how do I banish only temporarily? You're banishing just permanent.

Go to server.cfg and write this there:

sm_disconnectban_time 60

This will ban for 60 minutes. Setting it to 0 means a permanent ban. My PayPal is in my signature. Of course since I didn't code anything and just gave data over the existing code, I do not expect more than 200$ of course.

raj kaul 01-29-2019 01:38

Re: [REQ] Ban on disconnect and works with SourceBans ($$)
 
Quote:

Originally Posted by arne1288 (Post 2637004)
PHP Code:

#include <sourcemod>
#include <pugsetup>
#include <sourcebanspp>

#pragma semicolon 1
#pragma newdecls required

ConVar g_hCVBanTime;
ConVar g_hCVBanReason;

bool g_bSourcebans false;
bool g_bPugSetup false;

public 
Plugin myinfo 
{
    
name "Disconnect Ban"
    
author "The Doggy"
    
description "Bans players who disconnect during a match"
    
version "1.0.0",
    
url "DistrictNine.Host"
};

public 
void OnPluginStart()
{
    
g_hCVBanTime CreateConVar("sm_disconnectban_time""0""Amount of time to ban a player who disconnects during a match");
    
g_hCVBanReason CreateConVar("sm_disconnectban_reason""Disconnected from match""Reason to tell user why they were banned.");
}

public 
void OnAllPluginsLoaded()
{
    if(
LibraryExists("sourcebans++"))
        
g_bSourcebans true;
    else
        
LogError("Sourcebans++ is not loaded, this plugin will not work without it.");

    if(
LibraryExists("pugsetup"))
        
g_bPugSetup true;
    else
        
LogError("PugSetup is not loaded, this plugin will not work without it.");
}

public 
void OnLibraryAdded(const char[] name)
{
    if(
StrEqual(name"sourcebans++"))
        
g_bSourcebans true;
    if(
StrEqual(name"pugsetup"))
        
g_bPugSetup true;
}

public 
void OnLibraryRemoved(const char[] name)
{
    if(
StrEqual(name"sourcebans++"))
    {
        
g_bSourcebans false;
        
LogError("Sourcebans++ has been unloaded, this plugin will not work without it.");
    }
    if(
StrEqual(name"pugsetup"))
    {
        
g_bPugSetup false;
        
LogError("PugSetup has been unloaded, this plugin will not work without it.");
    }
}

public 
void OnClientDisconnect(int Client)
{
    if(!
g_bSourcebans || !g_bPugSetup) return;

    if(!
CheckCommandAccess(Client"sm_disconnectban_immune"ADMFLAG_ROOT) && PugSetup_IsMatchLive() && PugSetup_PlayerAtStart(Client))
    {
        
char sReason[256];
        
g_hCVBanReason.GetString(sReasonsizeof(sReason));
        
SBPP_BanPlayer(0Clientg_hCVBanTime.IntValuesReason);
    }


Then your relevant admins (e.g. the admin groups), allowing them access to the "sm_disconnectban_immune" override, and they will not be punished.


can you add ban after a delay time? like give them 5 mints to join tha match again after that ban.:)


All times are GMT -4. The time now is 11:53.

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