04.11.2010, 14:04
(
Последний раз редактировалось Slice; 13.09.2012 в 19:23.
)

Tutorial by FireCat: https://sampforum.blast.hk/showthread.php?pid=2116226#pid2116226
Hey,
This is an include that utilizes SQLite to its full capacity to provide a user database with great simplicity and probably the best possible performance you can get with SQLite.
There's no need for plugins, filterscripts, or loads of other includes. It won't interfere with any other code as long as it's included before any other includes.
NOTE
The latest version should be very stable. If you experience any problems, report them here!
Key features
- FAST
- No SQL knowledge neccessary - BUD will take care of all the communication with SQLite.
- Easy to set up users, and change their information.
- Columns can be added to the database with just one line of code.
Several variables can be read/written at once with just one function call!
- Whirlpool-compatible. You can, by putting "#define BUD_USE_WHIRLPOOL true" before including BUD, enable using the whirlpool plugins. Recommended.
- BUD::RunQueryEx - formats, escapes, and runs SQLite queries!
pawn Код:
new
userid = BUD::GetNameUID( "Slice" ) // This will get the name's unique ID; it's needed to get/set information.
;
if ( userid != BUD::INVALID_UID )
{
BUD::MultiSet( userid, "siiif", // string, integer, integer, integer, float
"email", "slices.em@i.l",
"money", 5000, // Give Slice $5000!
"kills", 1337,
"deaths", -1,
"exp", 5.0 // Give Slice a head start!
);
new email[ 32 ], money, kills, deaths, Float:exp;
BUD::MultiGet( userid, "s[32]iiif", // string size 32, integer, integer, integer, float
"email", email,
"money", money,
"kills", kills,
"deaths", deaths,
"exp", exp
);
printf( "BUD::MultiGet returned:\nemail: %s\nmoney: %d\nkills: %d\ndeaths: %d\nEXP: %f", email, money, kills, deaths, exp );
}
TODO: Write documentation about all these - when (or if) I get Wiki access, I will!
Код:
BUD::Setting( setting[], value ) bool BUD::Initialize( ) bool BUD::Exit( ) BUD::VerifyColumn( column[], type[, default value ] ) bool BUD::IsNameRegistered( name[] ) bool BUD::RegisterName( name[], password[] ) BUD::UnregisterName( name[] ) bool BUD::CheckAuth( name[], password[] ) BUD::GetNameUID( name[] ) Float BUD::GetFloatEntry( uid, entry[] ) BUD::GetIntEntry( uid, entry[] ) BUD::GetStringEntry( uid, entry[], &value[][, size ] ) bool BUD::MultiGet( uid, type definitions, ( entry, &variable )... ) bool BUD::MultiSet( uid, type definitions, ( entry, value )... ) bool BUD::SetIntEntry( uid, entry[], value ) bool BUD::SetFloatEntry( uid, entry[], Float:value ) bool BUD::SetStringEntry( uid, entry[], value[][, size ] )
Download the include: bud.inc
Download a small test script: bud-test.pwn