Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. /* MYSQL TUTORIAL BY JOHN SMITH - VL-GAME.INFO */
  2. #include <a_samp>
  3. #include <a_mysql>
  4. #define MYSQL_HOST "localhost"
  5. #define MYSQL_USER "root"
  6. #define MYSQL_PASS ""
  7. #define MYSQL_DB "sa-mp"
  8.  
  9. new MySQLOpt:my_options;
  10.  
  11. public OnGameModeInit()
  12. {
  13. my_options = mysql_init_options();
  14. mysql_set_option(my_options, AUTO_RECONNECT, true);
  15. mysql_set_option(my_options, MULTI_STATEMENTS, false);
  16. mysql_set_option(my_options, POOL_SIZE, 2);
  17. mysql_set_option(my_options, SERVER_PORT, 3306);
  18. mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS, MYSQL_DB, my_options);
  19. return 1;
  20. }
  21. new MySQL:db_handle;
  22.  
  23. public OnGameModeInit()
  24. {
  25. mysql_log(ALL);
  26.  
  27. db_handle = mysql_connect_file("mysql.ini");
  28. if(mysql_errno(db_handle) != 0)
  29. {
  30. printf("** [MySQL] Nemozeshe da se konektira na bazata - (%d).", mysql_errno(db_handle));
  31.  
  32. SendRconCommand("exit");
  33. }
  34. else
  35. {
  36. printf("** [MySQL] Uspesno MYSQLOT bese konektiran na bazata - (%d).", _:db_handle);
  37. }
  38. return 1;
  39. }
  40.  
  41. public OnGameModeExit()
  42. {
  43. if(db_handle)
  44. {
  45. mysql_close(db_handle);
  46. }
  47. return 1;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement