Migrated from "old school Pawn" to sampctl and having trouble finding database location
#2

Might aswell show my code.

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;
}
main.pwn
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.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)