There's an issue with your query:
CREATE TABLE IF NOT EXISTS Account ( Name TEXT, Password TEXT, IP NUMERIC, Level NUMERIC, Cash NUMERIC, Bank NUMERIC, )
Can you see it?
Bank NUMERIC, )
There's a comma "," symbol that isn't supposed to be there at the end:
CREATE TABLE IF NOT EXISTS Account ( Name TEXT, Password TEXT, IP NUMERIC, Level NUMERIC, Cash NUMERIC, Bank NUMERIC )
EDIT:
But that whole query is wrong and my recommendation is to get rid or it. Try the following example and see if it works:
// General global constants
const MAX_NAME_LENGTH = 128;
const MAX_PASSWORD_LENGTH = 128;
const MAX_ADDRESS_LENGTH = 16;
// Global variable holding the database handle
local g_DB = null;
function checkDb(name)
{
// If the database file doesn't exist then try to create one
local fp = file(name, "a");
// Check if the previous action succeeded
if (fp == null)
{
print("Unable to open or create the file: " + name);
// No point in going forward
return false;
}
// Now we know the database file exists and can be opened.
else fp.close();
// Try to open the file as an SQLite database
g_DB = ConnectSQL(name);
// Check if the previous action succeeded
if (g_DB == null)
{
print("Unable to open the SQLite database: " + name);
// No point in going forward
return false;
}
else return true;
}
function onServerStart()
{
if (!checkDb("mydb.db")) return 0;
// Try to create the table
QuerySQL(g_DB, format(@"CREATE TABLE IF NOT EXISTS [Account] (
[Name] VARCHAR(%u) NOT NULL,
[Password] VARCHAR(%u) NOT NULL,
[IP] VARCHAR(%u) NULL,
[Level] NUMERIC DEFAULT '0' NULL,
[Cash] NUMERIC DEFAULT '0' NULL,
[Bank] NUMERIC DEFAULT '0' NULL
);", MAX_NAME_LENGTH, MAX_PASSWORD_LENGTH, MAX_ADDRESS_LENGTH));
}