04.05.2018, 10:27
As far as I know, Ultra-H's databases are named like server_142_DATABASENAME.
You need to create a new database ( I guess it's done through CP > MySQL > Create new database )
You need to create a new database ( I guess it's done through CP > MySQL > Create new database )
PHP код:
// At the top of your gamemode
new MySQL: Database;
#define MYSQL_HOST "127.0.0.1"
#define MYSQL_USER "server_142"
#define MYSQL_PASS "PASSWORD"
#define MYSQL_DATABASE "server_142_DATABASENAME"
PHP код:
// OnGameModeInit
new MySQLOpt: option_id = mysql_init_options();
mysql_set_option(option_id, AUTO_RECONNECT, true); // We will set that option to automatically reconnect on timeouts.
Database = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS, MYSQL_DATABASE, option_id);
if(Database == MYSQL_INVALID_HANDLE || mysql_errno(Database) != 0) // Checking if the database connection is invalid to shutdown.
{
print("MySQL Database: Connection to database failed!");
SendRconCommand("exit");
return 1;
}
else
print("MySQL Database: Successfully connected.");