26.07.2018, 23:59
Might aswell show my code.
database_init.pwn
main.pwn
---
Update: I created a "Scriptfiles" folder and the database is created, but for some reason the tables are not being created.
database_init.pwn
pawn Код:
#include <a_samp>
#include "defines.pwn"
new DB:Database;
DatabaseConnection() {
Database = db_open(DB_NAME);
if (Database == DB:0) {
printf("SQLite: Failed to establish connection to \"%s\".", DB_NAME);
return SendRconCommand("exit");
} else {
printf("SQLite: Established connection to \"%s\".", DB_NAME);
db_query(Database, "CREATE TABLE IF NOT EXISTS `users` (`id` INTEGER AUTOINCREMENT PRIMARY KEY, `name` VARCHAR(24) UNIQUE, `password` TEXT NOT NULL, `password_hash` TEXT NOT NULL, `online` INTEGER)");
}
return 1;
}
pawn Код:
#include "modules\general.pwn" // Imports the code above.
main(){
DatabaseConnection();
}
---
Update: I created a "Scriptfiles" folder and the database is created, but for some reason the tables are not being created.