seroff

Active Key By Seroff

Aug 5th, 2022 (edited)
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.55 KB | None | 0 0
  1. /* Plugin generated by AMXX-Studio */
  2.  
  3. #include <amxmodx>
  4. #include <amxmisc>
  5. #include <sqlx>
  6.  
  7. #define PLUGIN "Active Key"
  8. #define VERSION "1.0"
  9. #define AUTHOR "Seroff"
  10.  
  11. // key
  12. new sKey[]="228FRZPG228FRZPG228FRZPGdsdfsSD23REFCVBDFFRTGT1324RTERWTHY2345HRTRTGH2435YH4TGHFR"
  13.  
  14. new const gsz_SLINFO[][] = {
  15. { "127.0.0.1" }, // HOST
  16. { "seroff" }, // USER
  17. { "seroff" }, // User's password
  18. { "seroff" } // Database Name
  19. }
  20.  
  21.  
  22. new Handle:SQL_Tuple
  23. new Handle:SQL_Connection
  24.  
  25. new g_ServerPort, g_ServerIP[32], gServerIP[32]
  26.  
  27. public plugin_init() {
  28.  
  29. register_plugin(PLUGIN, VERSION, AUTHOR)
  30. get_user_ip(0, g_ServerIP, 32,g_ServerPort)
  31. // only ip
  32. copyc(gServerIP,charsmax(gServerIP),g_ServerIP,':')
  33. //register_concmd("select_sql_result","sqlx_select_result")
  34.  
  35. // bad ip
  36. if(equal(gServerIP, "0.0.0.0", 7) || equal(gServerIP, "127.0.0.1", 9) || equal(gServerIP, "", 0)){
  37. set_fail_state("Error! Incorrect server IP!");
  38. }
  39. set_task(1.0,"sqlx_select_result"); // getinfo active
  40. }
  41.  
  42.  
  43. public plugin_cfg(){
  44. // connect base
  45. SQL_Tuple = SQL_MakeDbTuple(gsz_SLINFO[0],gsz_SLINFO[1],gsz_SLINFO[2],gsz_SLINFO[3]) // Создание картежа данных для соединения с БД
  46. new err, error[256]
  47. SQL_Connection = SQL_Connect(SQL_Tuple, err, error, charsmax(error)) // Соединение с БД
  48.  
  49. if(SQL_Connection != Empty_Handle)
  50. {
  51. log_amx("[SQLx connect ok]") // Если соединение установлено
  52. }else{
  53. log_amx("[SQLX sql error] %s ",error) // Если нет и выводим причину(ошибку)
  54. pause("a")
  55. }
  56.  
  57. }
  58. public sqlx_select_result(){
  59.  
  60. // Подготовка Запроса
  61. new Handle:query = SQL_PrepareQuery(SQL_Connection,"SELECT * FROM `act_id` WHERE skey = '%s'",sKey)
  62. // Выполняем запрос к базе даанных
  63. SQL_Execute (query)
  64.  
  65. //new id = SQL_ReadResult(query, 0)
  66. new str[512]
  67. SQL_ReadResult(query, 1, str, 511)
  68. new ip[32]
  69. SQL_ReadResult(query, 2, ip, 31)
  70.  
  71. //server_print("SQL Select Result: str [%s] ip [%s]",str,ip)
  72. if(!equali(gServerIP, ip)){
  73. server_print("ip [%s] [%s]",gServerIP, ip)
  74. server_print("sKey [%s] [%s]",sKey, str)
  75. set_fail_state("You use LicensedBad!");
  76. }else{
  77. server_print("Licensed is good!")
  78. }
  79. server_print("server %s",g_ServerIP)
  80.  
  81. }
  82. public plugin_end(){
  83. // off
  84. SQL_FreeHandle(SQL_Connection)
  85. }
  86.  
Advertisement
Add Comment
Please, Sign In to add comment