UPB

by Polatrite
A banning utility that uses your standard Dream Seeker pager banning feature, and extends it, adding functionality and power.
ID:197406
 
/* Ultimate Pager Ban by Polatrite
http://developer.byond.com/hub/Polatrite/UPB

This library is provided as is. You're welcome to use anything and everything
in your own games. If you decide to use this as an extension to a library,
or re-release this on the hub in any way, leave the BYONDscape.com subscription
requirement in place. This requirement is there to help BYONDscape gain more
popularity through it's channel. */

/* The scoop:
The general concept of the library is to take your pagerban file, which is
controlled through your dreamseeker interface, and use it as a reference
file for banning players. The library bans by direct IP as well as key
and ckey in the file itself. To modify the bans in any way, please remove
or add them as you normally would in a pagerban. Removing dashes and the like
is not necessary.

How it works:
To accomplish this use of the pagerban file, the library produces a copy of
the keyban.txt file found in your users/.../cfg directory. It then strips the
file of all unnecessary text (such as reason=ban, and other such text),
leaving only the IP and key of a banned player. It then checks to see if
the player logging in matches any of these, and subsequently deletes them
if they are banned. The library also automatically finds your user directory,
as it changes from computer to computer. Mine, for example, is users/Eichler.
Yours could be similar, a last name, or a business name. The library detects
this for you. All you need to do is set the byond root directory, which
defaults to C:/Program Files/BYOND/. The library could be made to
automatically detect this as well, but it would be too processor intensive.

The library also includes two handy text handling proceedures. A text replace
function which searches for any string in a given text string, and replaces
all occurances with another string.
pupb_text_replace("froggy dance","froggy","piggy")
Returns: "piggy dance"
The second text proceedure is called pupb_text_break. It will search a text
string and break it into multiple strings by searching for a single
seperator, typically a dash or space. It then returns the selected section,
pupb_text_break("I am a green hamster.",4," ")
Returns: "green"

How to apply it in your own code:
This library is plug and play. The ONLY thing you may need to edit is byond_dir,
and the only reason you would need to edit this is if you installed BYOND in a
folder other than the default C:/Program Files/BYOND/. Also, if you're running
your games with Dream Daemon, you must set the file access security level to
"Trusted." More documentation on what files are created and/or modified, and
why, will be added in version 2.0.

Where do I go if I have problems?
You can contact me, Polatrite, via the BYOND pager. Preferribly, however, send
an e-mail to polatrite_byond@hotmail.com.

Do I have to donate a book of credits to use this library?
While a mention of my name and a reference to this library would be nice, it's
not required. Include me in your credits at your discretion.

What are the usage limitations on this library?
Use it. Modify it. However, do not post it on the hub, either in part, full,
or as a section of another code project. Thank you in advance.