Database manager
Description:
Different plugins may require different tables to get user informations, like XP, level, money, kills, deaths and bla bla bla... This plugin/stock automatically select info from table, create columns where necessary and makes it easy for people that want to use the database
How it works
Database manager detects all columns from the sm_users. Plugins can enable,disable the selecting of each column, or create a new column if needed.
Cvars- sm_db_config (deafult: "default") - The connection DB manager will use
- sm_db_persit (deafult: "1") - Set to true to use persistant connection
- sm_db_autolite (deafult: "1") - If the DB does not exist, SQLite will be used
Installation:- MySQL
First, go to the file addons\sourcemod\configs\databases.cfg , and edit the "default" connection to your needs, it shouldn't be complicated, It should end up looking something like this:
PHP Code:
"default"
{
"driver" "default"
"host" "localhost"
"database" "sm"
"user" "root"
"pass" ""
//"timeout" "0"
//"port" "0"
}
And the leave the plugin to do the rest
-----------------------------------
- SQLite
Change the cvar sm_db_config to "storage-local"
and make sure that in addons\sourcemod\configs\databases.cfg this exists:
PHP Code:
"storage-local"
{
"driver" "sqlite"
"database" "sourcemod-local"
}
- Put a_mysql.smx file into your /addons/sourcemod/plugins folder, you can easily get the a_mysql.smx file by clicking at "Get Plugin" at the end of this message
FAQ:- I am getting an error "Can't connect to local MySQL server through socket '/tmp/mysql.sock'"
- If you have acess to root in your linux computer, execute this in shell "ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock"
Example
See next post
ChangeLog:- August 25, 2007
- Initial Release
- Fixed Float Adding
- Started Lock tables
- Removed all FastQueries
- August 26, 2007
- Removed all the connecting/disconecting
- Added cvars
- Made it a lot user to use
- August 27, 2007
- Added SQLite support
- Started using atd_array, there is no more limits now
- August 29, 2007
- August 30, 2007
- September 06, 2007
- September 15, 2007 (3.1)
- Changed some "new" to "decl"
- Removed some fail states
- January 10, 2007 (4.0)
- Now the plugin will story all data in 2 Adt arrays.
- Fixed possible error of things
- Changed the way the plugin saves data on the database.
- Added some extra checks to prevent errors.
- January 21, 2008
- Data is now saved on every round start.
Notes:
Put the globaldb.inc in addons\sourcemod\scripting\include