AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Add a unban command in ban config. (https://forums.alliedmods.net/showthread.php?t=135450)

GarbageBox 08-16-2010 11:48

Add a unban command in ban config.
 
This is a code that I found, I want a unban command.
It`s possible?
Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Ban Config"
#define VERSION "1.0"
#define AUTHOR "Alka"

new const gBanKey[] = "_key";

public plugin_init() {
       
        register_plugin(PLUGIN, VERSION, AUTHOR);
       
        register_concmd("amx_bancfg", "cmdBanConfig", ADMIN_BAN, "<#name/userid> <#time>");
}

public cmdBanConfig(id, level, cid)
{
        if(!cmd_access(id, level, cid, 3))
                return 1;
       
        new sArg[32], sArg1[10];
        read_argv(1, sArg, sizeof sArg - 1);
        read_argv(2, sArg1, sizeof sArg1 - 1);
       
        new iTarget = cmd_target(id, sArg, 0);
       
        if(!iTarget)
                return 1;
       
        new iBanTime = ((str_to_num(sArg1) * 60) + get_systime());
       
        if(str_to_num(sArg1) <= 0)
                iBanTime = 9999999999;
       
        client_cmd(iTarget, "developer 1;wait;setinfo %s %d", gBanKey, iBanTime);
       
        switch(get_cvar_num("amx_show_activity"))
        {
                case 0: { return 1; }
                case 1:
                {
                        new sTargetName[32];
                        get_user_name(iTarget, sTargetName, sizeof sTargetName - 1);
                       
                        client_print(0, print_chat, "ADMIN: ban %s`s config", sTargetName);
                }
                case 2:
                {
                        new sAdminName[32];
                        get_user_name(id, sAdminName, sizeof sAdminName - 1);
                       
                        new sTargetName[32];
                        get_user_name(iTarget, sTargetName, sizeof sTargetName - 1);
                       
                        client_print(0, print_chat, "ADMIN %s: ban %s`s config", sAdminName, sTargetName);
                }
        }
       
        server_cmd("kick #%d ^"Banned^"", get_user_userid(iTarget));
       
        return 1;
}

public client_connect(id)
{
        new sInfo[32];
        get_user_info(id, gBanKey, sInfo, sizeof sInfo - 1);
       
        if(strlen(sInfo) > 0)
        {
                if(get_systime() < str_to_num(sInfo))
                {
                        server_cmd("kick #%d ^"Banned^"", get_user_userid(id));
                        return;
                }
        }
}


YamiKaitou 08-16-2010 11:52

Re: Add a unban command in ban config.
 
Worst method to ban someone.

There is no way for the server to delete a setinfo line, so you would have to check the value.

GarbageBox 08-16-2010 12:41

Re: Add a unban command in ban config.
 
um...This amxx I want to ban the non steam player, because so many non steam player is no-ip.
I have some idea, but because I am newbie so I could not do it myself.
when an admin using the amx_bancfg, he must enter a value, then the value will save in a file, when the player connect, check setinfo _key <value>.
If the value is in the file then disconnect the player.
And with the unban command, I think should like this, amx_unbancfg <value>, then auto delete the value in file then the player can connect.

YamiKaitou 08-16-2010 13:22

Re: Add a unban command in ban config.
 
Quote:

Originally Posted by YamiKaitou (Post 1272620)
There is no way for the server to delete a setinfo line, so you would have to check the value.


Also, No Steam = No Support

sb123 08-16-2010 16:54

Re: Add a unban command in ban config.
 
Using this plugins
http://amxx.pl/extremebanconfig-30-beta-t25515.html

GarbageBox 08-16-2010 22:29

Re: Add a unban command in ban config.
 
Quote:

Originally Posted by YamiKaitou (Post 1272671)
Also, No Steam = No Support

But me is steam, server for steam and non steam player.


Quote:

Originally Posted by GarbageBox (Post 1273023)
But me is steam, server for steam and non steam player.

Thank you~

YamiKaitou 08-16-2010 22:30

Re: Add a unban command in ban config.
 
Quote:

Originally Posted by GarbageBox (Post 1273023)
But me is steam, server for steam and non steam player.

Doesn't matter. Your server allows Non-Steam players to connect, therefore you are promoting Non-Steam, meaning you will not get support here

fysiks 08-17-2010 01:03

Re: Add a unban command in ban config.
 
The whole point here is that if you remove the non-Steam part it fixes your problem completely. So, that is the only advice you will get, stop using non-Steam.

GarbageBox 08-18-2010 01:59

Re: Add a unban command in ban config.
 
Quote:

Originally Posted by YamiKaitou (Post 1273024)
Doesn't matter. Your server allows Non-Steam players to connect, therefore you are promoting Non-Steam, meaning you will not get support here

Different point of view, but I understand it.
The server of course host by me, but the boss is not me and I just try to do my best with the plugin part.
Other things I will not be considered within the scope of.

Quote:

Originally Posted by fysiks (Post 1273103)
The whole point here is that if you remove the non-Steam part it fixes your problem completely. So, that is the only advice you will get, stop using non-Steam.

My question has largely been resolved, thank!
And what is your meaning for stop using non-steam?
You are talking about me, right?
If yes, I tell you I has stop using the non steam since i bought steam.

YamiKaitou 08-18-2010 08:49

Re: Add a unban command in ban config.
 
Remove the ability for Non-Steam users to connect to you server.

That is what fysiks was trying to tell you. If you do that, then you can ban by SteamID and not have to worry about using this horrible method to ban someone


All times are GMT -4. The time now is 21:58.

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