PDA

View Full Version : amx_definitions ("knowledge base")


Hood [10th MD]
03-31-2008, 07:20 PM
This is based off of an idea from irc bots, but also there's a source mod plugin that exists to do this, but I've found no amxx equivalent.

What the plugin does:
the plugin is basically a dictionary - users can store, look up, delete and re-define terms.
for example, if you wanted to have your clan website stored, you can define it, and users can look it up.
The plugin allows for both console commands and say commands.

Commands:
dict_lookup <term> - displays a term's definition
dict_define <term> <definition> - defines a new term
dict_redefine <term> <new definition> - redefines an existing term
dict_delete <term> - deletes a term
dict_list - lists all terms in console

Say Commands:
<term>? - displays definition (looks up)
!define <term> - defines
!redefine <term> <new definition> - redefines
!delete <term> - deletes
!undefine <term> - deletes
!list - lists in consolemax term length is 31 chars, max def. length is 63 - resize arrays if you want more. All commands support multi-word terms and definitions as long as you use quotes, except looking up multi-word terms which does not require quotes.

Examples:
!define "dod plugins" "dodplugins.net for all your dod plugin needs!"
dod plugins? [this will print a message to the server displaying dod plugins = dodplugins.net ...]
(see source for exact message format / wording)

this requires you to create a .ini file in your /configs folder to hold the info. terms and definitions are separated by a * if you wish to pre-make a list (i.e.
dod plugins*dodplugins.net ... - the name of this file can be changed along with the access levels for various commands in the #define section.


Final note... as of this release (v 1.2), the delete function simply replaces the line with a blank character. If anyone knows how to delete a line so that the file doesn't have blank lines (it doesn't really matter, it's just unnecessary), please let me know! Plugin is well tested and stable, I've had no problems and been messing with it for at least a week.

Comments, etc. welcome. Questions too if this was a bad explanation.

Wilson [29th ID]
04-01-2008, 12:08 PM
haha, that's a cool idea LT. nice work.

Hood [10th MD]
04-04-2008, 01:34 AM
Haha, it makes me really happy.
I will eventually get it just right, but it's a lot of fun, and great for getting people info since they often accidentally lookup something, or have repeated questions. i.e. weapons mod, etc heh