· 6 years ago · Dec 28, 2019, 06:16 PM
1public OnGameModeInit()
2{
3 SetTimer("Savers", 360000, true);
4 sqldb = mysql_connect(SQL_HOSTNAME, SQL_USERNAME, SQL_DATABASE, SQL_PASSWORD);
5 if(mysql_errno(sqldb) == 0)
6 {
7 new MySQL_Format[528];
8 mysql_format(sqldb, MySQL_Format, sizeof MySQL_Format, "CREATE TABLE IF NOT EXISTS `bans` ( \
9 `id` INT(10) PRIMARY KEY NOT NULL AUTO_INCREMENT, \
10 `name` VARCHAR(24), \
11 `ip` VARCHAR(16), \
12 `date` VARCHAR(40), \
13 `admin` VARCHAR(24), \
14 `reason` VARCHAR(20))");
15 mysql_query(sqldb, MySQL_Format);
16 new MySQL_Format1[528];
17 mysql_format(sqldb, MySQL_Format1, sizeof MySQL_Format1, "CREATE TABLE IF NOT EXISTS `gpci` ( \
18 `name` VARCHAR(24), \
19 `gpci` VARCHAR(64))");
20 mysql_query(sqldb, MySQL_Format1);
21 }
22 else
23 {
24 printf("[MySQL] (sqldb) Fatal Error! Could not connect to MySQL: Host %s - DB: %s - User: %s", SQL_HOSTNAME, SQL_DATABASE, SQL_USERNAME);
25 print("[MySQL] Note: Make sure that you have provided the correct connection credentials.");
26 printf("[MySQL] Error number: %d", mysql_errno(sqldb));
27 SendRconCommand("exit");
28 }
29 mysql_tquery(sqldb, "UPDATE `PlayerInfo` SET `connected` = 0");