SHARE
TWEET

Untitled

a guest Oct 16th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <a_samp>
  2. #include <a_mysql>
  3. #define MYSQL_HOST "localhost"
  4. #define MYSQL_USER "root"
  5. #define MYSQL_PASS ""
  6. #define MYSQL_DB   "sa-mp"
  7.  
  8. new MySQLOpt:my_options;
  9.  
  10. public OnGameModeInit()
  11. {
  12.     my_options = mysql_init_options();
  13.     mysql_set_option(my_options, AUTO_RECONNECT, true);
  14.     mysql_set_option(my_options, MULTI_STATEMENTS, false);
  15.     mysql_set_option(my_options, POOL_SIZE, 2);
  16.     mysql_set_option(my_options, SERVER_PORT, 3306);
  17.     mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS, MYSQL_DB, my_options);
  18.     return 1;
  19. }
  20. new MySQL:db_handle;
  21.  
  22. public OnGameModeInit()
  23. {
  24.     mysql_log(ALL);
  25.  
  26.     db_handle = mysql_connect_file("mysql.ini");
  27.     if(mysql_errno(db_handle) != 0)
  28.     {
  29.         printf("** [MySQL] Nemozeshe da se konektira na bazata - (%d).", mysql_errno(db_handle));
  30.  
  31.         SendRconCommand("exit");
  32.     }
  33.     else
  34.     {
  35.         printf("** [MySQL] Uspesno MYSQLOT bese konektiran na bazata - (%d).", _:db_handle);
  36.     }
  37.     return 1;
  38. }
  39.  
  40. public OnGameModeExit()
  41. {
  42.     if(db_handle)
  43.     {
  44.         mysql_close(db_handle);
  45.     }
  46.     return 1;
  47. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top