[RELEASE] In-game ban command for GMs

04/29/2013 16:02 ricky92#1
Hello everyone,
today I'm releasing a mod for the game file which has always been sought, at least in the past.
It's the in-game ban command, which GMs can use in the same way they would use the "block chat" command.
The mod is applied to the game with the "dynamic library" method, but I haven't used any code from the one posted by niky90, everything's been done from scratch by me and only me: the "base" library is the same I will use on my server, [Only registered and activated users can see links. Click Here To Register...], but, obviously, there are just two modules in this one, the "Command extension" and the "Ban command" ones.

To use the library, download it and put it somewhere on your server, then edit the start script, to be more precise the line where it runs the "cores" (it'll probably look like "./corename"):
Code:
env LD_PRELOAD="/full/path/to/the/lib.so" ./corename
Warning: if you're using a 64-bit OS, you should use the "LD_32_PRELOAD" environment variable instead of that one.

You can check if the library has been loaded by the message it shows when the game starts:

The in-game usage is really simple:
Code:
/ban playername [duration]
The duration parameter is optional, in which case the ban will be permanent, otherwise you can specify the timespan you want the player to be banned in exactly the same way you would with the "block_chat" command. For redundancy, you might as well write "permanent" in the duration parameter, and it will execute as if you didn't write anything (which means a permanent ban).
To unban, just write:
Code:
/ban playername 0
The library requires that you have the "account" database named exactly like that, "account". If that database has another name on your server, the library will not work.

That should be all. I will probably update this when I have time, to make it show a notice to all players that a certain user has been (un)banned.

Credits:
me XD
[Only registered and activated users can see links. Click Here To Register...], since I wouldn't have made the library, nor could I have tested without this server.

Changelog:
  • 29/04/2013: Initial release, added automatic disconnect and database query in case the banned player is not online.

Quote:
Update: someone asked via PM to have the source of the ban function. While it's not a problem for me to post that, it would be to post the source for my whole library. So, I'm posting this just for reference, to let people see how it works (and also check if there is any bug, why not). You probably won't be able to compile the source as it is, if you don't have the right header files XD

[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
Password: UniversalElements
04/29/2013 16:03 Stαgє6#2
This is not bad when this going its good ^^
04/29/2013 16:08 .αpeх'#3
Very nice. Well done! :)
04/29/2013 16:20 He3o Crysis#4
Good Job.

Source please.
04/29/2013 16:42 I3rockencyde#5
Good Work!

Thanks!
04/29/2013 16:44 .Nexus'#6
Well done!
Thanks.
04/29/2013 16:47 ricky92#7
Quote:
Originally Posted by Lerσx™ View Post
Good Job.

Source please.
I won't release the source for the whole lib, as it contains way more than what is needed to compile this, but if you want I can release the source of the do_ban function :)

Quote:
Originally Posted by kwiatmix View Post
I have this error:
[Only registered and activated users can see links. Click Here To Register...]
When i write and press to do it comman "./compile.sh".
I've all files from topic "library game file".

What's wrong ?
You don't need to compile it, it's already compiled.
04/29/2013 16:47 [SA]Con#8
Hmm, irgendwie funktioniert das ganze nicht ganz.

Sobald ich eingebe /ban BannTest 50 stopt der Server und die Cores crashen. Komisch...

Dennoch Gute arbeit. :)
04/29/2013 17:04 ricky92#9
Quote:
Originally Posted by [SA]Con View Post
Hmm, irgendwie funktioniert das ganze nicht ganz.

Sobald ich eingebe /ban BannTest 50 stopt der Server und die Cores crashen. Komisch...

Dennoch Gute arbeit. :)
Is the GM character you're trying to ban BannTest itself?
04/29/2013 17:16 [SA]Con#10
Quote:
Originally Posted by ricky92 View Post
Is the GM character you're trying to ban BannTest itself?
No, my GM is [SA]Con "BannTest" is the Test Character (Other account)

I use the command: /ban BannTest 50 but no reason in the chat 3 seconds after the command => Kick from Game and all Cores are Crashed. Sorry for my bad english :D
04/29/2013 17:20 Sphinx²#11
Quote:
Originally Posted by [SA]Con View Post
No, my GM is [SA]Con "BannTest" is the Test Character (Other account)

I use the command: /ban BannTest 50 but no reason in the chat 3 seconds after the command => Kick from Game and all Cores are Crashed. Sorry for my bad english :D
Welche Revision nutzt du?

Gruss
Sphinx
04/29/2013 17:21 [SA]Con#12
Quote:
Originally Posted by Sphinx² View Post
Welche Revision nutzt du?

Gruss
Sphinx
2089
04/29/2013 17:21 Sphinx²#13
Quote:
Originally Posted by [SA]Con View Post
2089
Hast du schon mal in den "*.core" Dateien nachgeschaut mit dem
Debugger was da raus kommt?

Gruss
Sphinx
04/29/2013 17:23 [SA]Con#14
Quote:
Originally Posted by Sphinx² View Post
Hast du schon mal in den "*.core" Dateien nachgeschaut mit dem
Debugger was da raus kommt?

Gruss
Sphinx
Doofe frage aber welcher Debugger? :o
04/29/2013 17:31 .Nexus'#15
Its not working :(

Code:
******************************************************
*        Universal Elements extension library        *
*                  made by ricky92                   *
*                   Version 1.0.0                    *
******************************************************
[*] Module "Ban command" loaded.[*] Module "Command Extensions" loaded.
        Command registered: "ban" (early initialization)

[COLOR="DarkRed"]Can not open [CONFIG][/COLOR]
Ingame I type in:
Code:
/ban Nexus 50
And he starts dancing ^^