SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 04/11/2010, 02:04 PM   #1
Slice
High-roller
 
Join Date: Mar 2008
Posts: 1,831
Reputation: 1607
Spray [RC1] BUD - Blazing User DB



Tutorial by FireCat: http://forum.sa-mp.com/showthread.php?p=2116226

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!

Example usage
pawn Code:
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 );
}

Functions available
TODO: Write documentation about all these - when (or if) I get Wiki access, I will!
Code:
        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
Download the include: bud.inc
Download a small test script: bud-test.pwn

Last edited by Slice; 13/09/2012 at 07:23 PM.
Slice is offline   Reply With Quote
Old 04/11/2010, 02:08 PM   #2
Zimon95
Big Clucker
 
Zimon95's Avatar
 
Join Date: Sep 2009
Location: Ravenna, Italy
Posts: 182
Reputation: 10
Default Re: [BETA] BUD - Blazing User DB

Very nice, keep it up! But I prefer MySQL...
Zimon95 is offline   Reply With Quote
Old 04/11/2010, 02:16 PM   #3
DarkPower
Gangsta
 
DarkPower's Avatar
 
Join Date: Feb 2010
Posts: 646
Reputation: 7
Default Re: [BETA] BUD - Blazing User DB

awesome work
DarkPower is offline   Reply With Quote
Old 04/11/2010, 02:22 PM   #4
Slice
High-roller
 
Join Date: Mar 2008
Posts: 1,831
Reputation: 1607
Default Re: [BETA] BUD - Blazing User DB

Quote:
Originally Posted by Zimon95 View Post
Very nice, keep it up! But I prefer MySQL...
When I'm done with this, I will make something similar, but more powerful, for MySQL. You won't have to change a line of code to switch to the MySQL version (once it's finished) if you're using this.
Slice is offline   Reply With Quote
Old 04/11/2010, 06:09 PM   #5
HyperZ
High-roller
 
HyperZ's Avatar
 
Join Date: Aug 2009
Posts: 1,340
Reputation: 66
Default Re: [BETA] BUD - Blazing User DB

Great job.
__________________
HyperZ is offline   Reply With Quote
Old 04/11/2010, 07:23 PM   #6
RedFusion
Gangsta
 
RedFusion's Avatar
 
Join Date: Nov 2009
Location: Sweden
Posts: 921
Reputation: 330
Default Re: [BETA] BUD - Blazing User DB

Very nice, So clean and simple, and still so useful. 10/10
__________________
Also known as fusez
RedFusion is offline   Reply With Quote
Old 04/11/2010, 08:27 PM   #7
MrDeath537
High-roller
 
Join Date: Nov 2009
Location: Argentina
Posts: 1,959
Reputation: 29
Default Respuesta: Re: [BETA] BUD - Blazing User DB

VERY nice work g_aSlice, I'm doing some tests

Thanks for post!
__________________
Sometimes I return.
MrDeath537 is offline   Reply With Quote
Old 04/11/2010, 08:54 PM   #8
anonymousx
Big Clucker
 
Join Date: Feb 2010
Location: Argentina
Posts: 146
Reputation: 2
Default Respuesta: [BETA] BUD - Blazing User DB

AWESOME, very useful for my new gm
anonymousx is offline   Reply With Quote
Old 04/11/2010, 09:07 PM   #9
Retardedwolf
High-roller
 
Retardedwolf's Avatar
 
Join Date: Jun 2009
Posts: 1,466
Reputation: 60
Default Re: [BETA] BUD - Blazing User DB

Awesome. can't wait for the 'more powerful version'.
Retardedwolf is offline   Reply With Quote
Old 04/11/2010, 10:16 PM   #10
Double-O-Seven
Guest
 
Posts: n/a
Default Re: [BETA] BUD - Blazing User DB

This looks awesome!
Terribly beautiful code!
  Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bad user name Programie Server Support 9 06/04/2011 03:36 PM
User Tracks Freddy Z Everything and Nothing 14 04/03/2010 08:13 PM
user mattyross55 Client Support 1 19/09/2009 09:52 PM
If user press key X... carlos- Help Archive 5 21/07/2009 11:27 PM


All times are GMT. The time now is 07:26 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.