Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <a_mysql>
- #define MYSQL_HOST "localhost"
- #define MYSQL_USER "root"
- #define MYSQL_PASS ""
- #define MYSQL_DB "sa-mp"
- new MySQLOpt:my_options;
- public OnGameModeInit()
- {
- my_options = mysql_init_options();
- mysql_set_option(my_options, AUTO_RECONNECT, true);
- mysql_set_option(my_options, MULTI_STATEMENTS, false);
- mysql_set_option(my_options, POOL_SIZE, 2);
- mysql_set_option(my_options, SERVER_PORT, 3306);
- mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS, MYSQL_DB, my_options);
- return 1;
- }
- new MySQL:db_handle;
- public OnGameModeInit()
- {
- mysql_log(ALL);
- db_handle = mysql_connect_file("mysql.ini");
- if(mysql_errno(db_handle) != 0)
- {
- printf("** [MySQL] Nemozeshe da se konektira na bazata - (%d).", mysql_errno(db_handle));
- SendRconCommand("exit");
- }
- else
- {
- printf("** [MySQL] Uspesno MYSQLOT bese konektiran na bazata - (%d).", _:db_handle);
- }
- return 1;
- }
- public OnGameModeExit()
- {
- if(db_handle)
- {
- mysql_close(db_handle);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement