29.03.2014, 14:06
SQLite.inc - Convenient and quick to use
Introduction:
Hello and welcome to the subject of the publication my new include SQLite.inc!
Use SQLite.inc include will help you use SQLite in a much more simple and convenient.
The following example configuration of an additional row to any table:
PHP код:
sql_SetInt(Database,"Table","Field",100);
This is my first publication forum forgive my English

Functions:
The include right now in version v1.0 and contains 11 Functions, here the list:
PHP код:
sql_SetString<DB:database,table[],field[],value[]>
sql_SetInt<DB:database,table[],field[],value>
sql_SetFloat<DB:database,table[],field[],Float:value>
sql_GetInt<DB:database,table[],field[],get[]>
sql_GetIntEx<DB:database,table[],field[],get[],equal[]>
Float:sql_GetFloat(DB:database,table[],field[],get[])
Float:sql_GetFloatEx(DB:database,table[],field[],get[],equal[])
sql_Exists<DB:database,table[],field[],value[]>
sql_GetString<DB:database,table[],field[],get[]>
sql_GetStringEx<DB:database,table[],field[],get[],equal[]>
sql_Count<DB:database,table[]>
if you working with this include and you want edit some user/clan/teleport you need the field of them have been exists.
For example you have this account:
UserName | UserPass | Kills | Deaths | AdminLevel
Agresiv | 123456 | 10 | 0 | 15
You need to make sure it already exists in the table.
For example after register to server:
PHP код:
db_query(Database,"INSERT INTO `Users` (`user_name`,`user_pass`) VALUES('Agresiv','123456')");
You can edit them / get information form them and other options below.
sql_SetString:
* This function performs the act of writing a string in the table.
* Example:
PHP код:
sql_SetString(Database,"ServerInfo","server_founder","Agresiv");
* This function performs the act of writing a intager value in the table.
* Example:
PHP код:
sql_SetInt(Database,"ServerInfo","server_maxping",100);
* This function performs the act of writing a float value in the table.
* Example:
PHP код:
sql_SetFloat(Database,"ServerInfo","players_health",100.0);
* This function return integer value from field in table.
* Example:
PHP код:
new max_ping = sql_GetInt(Database,"ServerInfo","server_maxping");
printf("- Max Ping: %d",max_ping);
* This function return string value from field in table.
* Example:
PHP код:
new founder[MAX_PLAYER_NAME];
format(founder,sizeof(founder),sql_GetString(Database,"ServerInfo","server_founder"));
printf("- Founder: %s",founder);
* This function return float value from field in table.
* Example:
PHP код:
new Float:player_health = sql_GetFloat(Database,"ServerInfo","players_health");
SetPlayerHealth(playerid,player_health);
* This function get integer value if some string equal to field in table.
* Example:
PHP код:
new kills[MAX_PLAYERS],name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
kills[playerid] = sql_GetIntEx(Database,"Users","user_name","user_kills",name);
* This function get string value if some string equal to field in table.
* Example:
PHP код:
new password[20],name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(password,sizeof(password),sql_GetStringEx(Database,"Users","user_name","user_pass",name));
* This function get float value if some string equal to field in table.
* Example:
PHP код:
new Float:playerX[MAX_PLAYERS],name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
playerX[playerid] = sql_GetFloatEx(Database,"Users","user_name","user_x",name);
* This function check if field exists in the table.
* Example:
PHP код:
new bool:state,name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
state = sql_Exists(Database,"Users","user_name",name)?true:false;
print(state?("User Exists!"):("User dosen't exists!"));
* This function count all fields in table.
* Example:
PHP код:
new countUsers = sql_Count(Database,"Users");
printf("Users: %d",countUsers);
Agresiv (Dan Elimelech | Dumbes) - Developer include.
Amit_B (Amit Barami) - Scripting help & Inspiration.
Downloads:
To use SQLite.inc include you don't need plugins and additives, just include a_sampdb.inc
a_sampdb.inc include you get a download server.
Pastebin: http://pastebin.com/0euXZNwW
If you find bug send me email: deagresiv16@gmail.com
All function are check and with this include right now i build new big project!