28.05.2015, 13:17
Also look at this
I'm trying to make two save systems in my gamemode
Код:
//- mysql connection #define mysql_host "localhost" #define mysql_user "root" #define mysql_password "bg3diti0n" #define mysql_database "bgeditiontestsamp" //- news new DB:sql_handle[50], mysql_handle[50], mysql_conatt = 5, bool:mysql_connected[50] = false; public OnGameModeInit() { mysql_conatt = 5; mysql_log(LOG_ERROR | LOG_WARNING | LOG_DEBUG); mysql_handle[0] = mysql_connect(mysql_host, mysql_user, mysql_database, mysql_password); if(mysql_errno(mysql_handle[0]) == 0)return print("[DEBUG]: Connected to the MySQL database!"), mysql_connected[0] = true; else { mysql_reconnect(mysql_handle[0]); mysql_conatt--; if(mysql_conatt == 0) { mysql_connected[0] = false; print("[ERROR]: Could not connect to the MySQL database! Loading the SQLite database."); sql_handle[0] = db_open("/Databases/Server.db"); SQLTable(sql_handle[0], SQLTYPE_SQLITE, SQLTABLE_ACTION_CREATE, "accounts", "`ID` int(11) NOT NULL, `Username` varchar(25) NOT NULL, `Password` varchar(150) NOT NULL, `IP` varchar(16) NOT NULL"); } } return 1; }