AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   Auto 1 day ban to Sourcebans on leaving server (https://forums.alliedmods.net/showthread.php?t=307261)

mudkipguy 05-02-2018 13:32

Auto 1 day ban to Sourcebans on leaving server
 
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.

LaGgLs 05-05-2018 17:08

Re: Auto 1 day ban to Sourcebans on leaving server
 
read this thread will help you

https://forums.alliedmods.net/showth...=171454&page=2

Markiez 05-06-2018 14:01

Re: Auto 1 day ban to Sourcebans on leaving server
 
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");
}


DarkDeviL 05-06-2018 15:49

Re: Auto 1 day ban to Sourcebans on leaving server
 
Quote:

Originally Posted by Markiez (Post 2590979)
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...

ThatKidWhoGames 05-06-2018 21:41

Re: Auto 1 day ban to Sourcebans on leaving server
 
Quote:

Originally Posted by Markiez (Post 2590979)
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.

Psyk0tik 05-07-2018 03:18

Re: Auto 1 day ban to Sourcebans on leaving server
 
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.


All times are GMT -4. The time now is 05:09.

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