[Include] susers - An easy-to-setup registration system
#1

susers
An easy-to-setup registration system
Version: 0.1
Introduction:
A lot of new users here have problems with making an account system.
So I decided to make an include that simplifies that.
Functions:
Code:
Registers the player using the entered password.
User_Register(playerid, password[]);

Returns whether the player is registered or not.
User_IsRegistered(playerid);

Attempts to login with the password entered.
User_Login(playerid, password[]);

Forces the player to login (No password needed)
User_ForceLogin(playerid);

Returns whether the player is logged in or not.
User_IsLoggedIn(playerid);

Use under OnPlayerDataLoad
Attempts to load an integer from the player's saved data.
User_LoadInt(entry[], &dest);

Attempts to load a float from the player's saved data.
User_LoadFloat(entry[], &dest);

Attempts to load a string from the player's saved data.
User_LoadString(entry[], dest[], dest_size);

Attempts to load a hex value from the player's saved data.
User_LoadHex(entry[], &dest);


Use under OnPlayerLogout
Attempts to save an integer.
User_SaveInt(playerid, entry[], data);

Attempts to save a float.
User_SaveFloat(playerid, entry[], Float: data, accuracy = 6);

Attempts to save a string.
User_SaveString(playerid, entry[], data[]);

Attempts to save a hex value.
User_SaveHex(playerid, entry[], data);


SQLite only!
Use under OnGameModeInit or OnFilterScriptInit

Adds a field to the table.
field_types:
field_int field_float field_string
User_CreateField(name[], field_types: type, maxlength); Runs the table query and attempts to create the table. User_CreateTable();
Callbacks:
Code:
Called when the player successfully logs in.
forward OnPlayerLogin(playerid);

Called when the player successfully registers.
forward OnPlayerRegister(playerid);

Called when the player's data is being loaded
forward OnPlayerDataLoad(playerid, entry[], value[]);

Called when the player logs out.
forward OnPlayerLogout(playerid);
Notes:
Make sure to #define FILTERSCRIPT if you use this in a filterscript.
Code:
#define SUSERS_SAVING_INI
#define SUSERS_SAVING_SQLITE
Define one of the these before including susers.inc.

(Optional) Include sscanf 2 before including this to take advantage of its speed.

I might add MySQL soon.
Download:
https://github.com/Stinged/susers
Reply
#2

Nice one stinged it will help many new comers.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)