//the format line was the error line
new Query[128];
format(Query, sizeof(Query), "UPDATE users SET admin = %d, vip = %d, faction = %d, faction rank = %d, money = %d, rank = %d, exp = %d, kills = %d, deaths = %d WHERE username = '%s'", User[playerid][USER_ADMIN], User[playerid][USER_VIP], User[playerid][USER_FACTION], User[playerid][USER_FACTIONRANK], GetPlayerMoney(playerid), GetPlayerScore(playerid), User[playerid][USER_EXP], User[playerid][USER_KILLS], User[playerid][USER_DEATHS], DB_Escape(User[playerid][USER_NAME]));
db_query(Database, Query);
Is the size of the .db file 0?
I used to get that error when it created the .db file from the script and then tried to open it with a SQLite Browser before creating atleast a table (from the script). EDIT: If the problem remains, then try to downgrade the version of the SQLite Browser. |
Yes the file size is 0, which SQLite browser do you use or suggest?
|
I used SQLite Database Browser 2.0 b1 and I recommend you to use it as well.
You can get rid of it easily, I've got two solutions. 1st: After opening the database to the script, execute a query to create a table (through the script). 2nd: Creating a new database and a table through the SQLite Browser. For both of them, you will be able to open the .db file later on. |
Yeah thats what i use aswell, how do i execute a query to create a table in the script?
|
// In OnGameModeInit or OnFilterScriptInit:
Database = db_open( "server.db" );
db_query( Database, "CREATE TABLE IF NOT EXISTS users (userid INTEGER PRIMARY KEY AUTOINCREMENT, username VARCHAR(24) COLLATE NOCASE, password VARCHAR(129), admin INTEGER DEFAULT 0 NOT NULL)" );
db_query(Database, "CREATE TABLE IF NOT EXISTS users (userid INTEGER PRIMARY KEY AUTOINCREMENT, username VARCHAR(24) COLLATE NOCASE, password VARCHAR(129), admin INTEGER DEFAULT 0 NOT NULL, vip INTEGER DEFAULT 0 NOT NULL, faction VARCHAR(24) COLLATE NOCASE, factionrank INTEGER DEFAULT 0 NOT NULL, money INTEGER DEFAULT 0 NOT NULL, rank INTEGER DEFAULT 0 NOT NULL, exp INTEGER DEFAULT 0 NOT NULL, kills INTEGER DEFAULT 0 NOT NULL, deaths INTEGER DEFAULT 0 NOT NULL)");
#define DB_QUERY_ERRORS true
// automatically print errors (it's true by default)
#define DB_PRINT_ERRORS true
#include <sqlitei>
If your doing anything with SQLite make sure you use this include
https://sampforum.blast.hk/showthread.php?tid=303682 Add this to your gamemode pawn Код:
https://github.com/Zeex/amx_assembly Now if there is any errors they will be printed out. |