Advertisement
danya777_kirov

[CLEO][INC] Check Player Licenses

Oct 28th, 2013
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 5.87 KB | None | 0 0
  1. /************************************************
  2.     0AB1: @CheckLicenses 1 scriptname 0@ return: result 1@
  3.         Если результат (в переменной 1@) равен 1, то юзер успешно прошел проверку.
  4.     if 1@ == 0
  5.     then end_thread // "выключаем" скрипт.
  6.     end
  7.  
  8.     Засовываем, например, этот файл в папку CLEO\INC\Licenses.txt
  9.     Вставляем в самый вниз скрипта ссылку на инклюд.
  10.     {$I CLEO\INC\Licenses.txt}
  11. ***********************************************/
  12. const
  13.     server = "e3zend.zz.mu"
  14.     login = "u661640629"
  15.     password = ""
  16. end
  17.  
  18. :CheckLicenses
  19. /************************
  20.     0AB1: @CheckLicenses 1 scriptname 0@ return: result 1@
  21.     scriptname - название скрипта (ну, как название, уникальное имя, чтобы не путать ключи).
  22. ************************/
  23. wait 0
  24. 0085: 15@ = 0@
  25. 0AC8: 0@ = allocate_memory_size 60
  26. 0AC8: 1@ = allocate_memory_size 60
  27. 0AC8: 2@ = allocate_memory_size 60
  28. 0AD3: 0@ = server
  29. 0AD3: 1@ = login
  30. 0AD3: 2@ = password
  31. 0AB1: @InternetOpen 0 return: hInternet 3@
  32. 0AB1: @InternetConnect 4 hInternet 3@ server 0@ user 1@ password 2@ return: hConnection 25@
  33. 0AB1: @GetVolumeInformation 0 return: serial 26@
  34. 26@ *= -1
  35. 0AD3: 0@ = "/SCRIPTS/FILES/%s/CODE/%d.txt" 15@ 26@
  36. 0AD3: 1@ = "CLEO/CLEO_TEXT/temp_key.txt"
  37. if 0AB1: @FtpGetFile 3 hConntection 25@ remote_file 0@ local_file 1@
  38. then
  39.     28@ = File.Open("CLEO\CLEO_TEXT\temp_key.txt", "rt")
  40.     0AD7: read_string_from_file 28@ to 2@ size 60
  41.     File.Close(28@)
  42.     while 8B00: delete_file "CLEO\CLEO_TEXT\temp_key.txt"
  43.          wait 0
  44.     end
  45.     0AD3: 0@ = "/SCRIPTS/FILES/%s/KEYS/%s.txt" 15@ 2@
  46.     if 0AB1: @FtpGetFile 3 hConntection 25@ remote_file 0@ local_file 1@
  47.     then
  48.         28@ = File.Open("CLEO\CLEO_TEXT\temp_key.txt", "rt")
  49.         0ADA: 29@ = scan_file 28@ format "%d" 30@
  50.         File.Close(28@)  
  51.         while 8B00: delete_file "CLEO\CLEO_TEXT\temp_key.txt"
  52.             wait 0
  53.         end
  54.         if 003B: 26@ == 30@
  55.         then 27@ = 1
  56.         end
  57.     end
  58. else
  59.     SAMP.ShowDialog(990, "Регистрация юзера", "{FFFFFF}Вы не были найдены в списке зарегестрированых пользователей. Введите ключ, выданный вам продавцом.", "Далее", "Отмена", 1)
  60.     repeat
  61.         wait 0
  62.     until SAMP.DialogRespond(990, 3@, 0, 2@)
  63.     if 3@ == 1
  64.     then
  65.         0C17: 3@ = strlen 2@
  66.         if 3@ > 0
  67.         then
  68.             0AD3: 0@ = "/SCRIPTS/FILES/%s/KEYS/%s.txt" 15@ 2@
  69.             0AD3: 1@ = "CLEO/CLEO_TEXT/temp_key.txt"
  70.             if 0AB1: @FtpGetFile 3 hConntection 25@ remote_file 0@ local_file 1@
  71.             then
  72.                 28@ = File.Open("CLEO\CLEO_TEXT\temp_key.txt", "rt")
  73.                 if 0ADA: 29@ = scan_file 28@ format "%d" 20@
  74.                 then SAMP.AddChatMessage(" *Такой ключ зарегистрирован!", -1)
  75.                 else
  76.                     File.Close(28@)
  77.                     while 8B00: delete_file "CLEO\CLEO_TEXT\temp_key.txt"
  78.                         wait 0
  79.                     end
  80.                     28@ = File.Open("CLEO\CLEO_TEXT\temp_key.txt", "wt")
  81.                     0AD9: write_formatted_text "%d" in_file 28@ 26@
  82.                     File.Close(28@)
  83.                     if 0AB1: @FtpPutFile 3 hConntection 25@ local_file 1@ remote_file 0@
  84.                     then
  85.                         0AD3: 0@ = "/SCRIPTS/FILES/%s/CODE/%d.txt" 15@ 26@
  86.                         28@ = File.Open("CLEO\CLEO_TEXT\temp_key.txt", "wt")
  87.                         0AD8: write_string_to_file 28@ from 2@
  88.                         File.Close(28@)  
  89.                         if 0AB1: @FtpPutFile 3 hConntection 25@ local_file 1@ remote_file 0@
  90.                         then
  91.                             while 8B00: delete_file "CLEO\CLEO_TEXT\temp_key.txt"
  92.                                 wait 0
  93.                             end
  94.                             27@ = 1
  95.                         end
  96.                     end
  97.                 end
  98.                 File.Close(28@)    
  99.             else SAMP.AddChatMessage(" *Такого ключа не существует!", -1)
  100.             end            
  101.         end
  102.     else 27@ = 0
  103.     end
  104. end
  105. //0AB1: @InternetCloseHandle 1 hConnection 25@
  106. 0AB2: ret 1 27@
  107.  
  108. :GetVolumeInformation
  109. // 0AB1: @GetVolumeInformation 0 return: id 0@
  110. 0AA2: 30@ = load_library "kernel32.dll"
  111. 0AA4: 29@ = get_proc_address "GetVolumeInformationA" library 30@
  112. 0AC7: 1@ = var 0@ offset
  113. 0AA5: call 29@ num_params 8 pop 0 0 0 0 0 1@ 0 0 0
  114. 0AB2: ret 1 0@
  115.  
  116. :FtpGetFile
  117. // 0AB1: @FtpGetFile 3 hConntection 0@ remote_file 1@ local_file 2@ // IF or SET
  118. 0AA2: 17@ = load_library "wininet.dll"
  119. 0AA4: 18@ = get_proc_address "FtpGetFileA" library 17@
  120. 0AA7: call_function 18@ num_params 7 pop 0 {context}0 {flags}0 {attribugs}128 {fail}0 {localfile}2@ {remotefile}1@ {connect}0@ 3@
  121. if 3@ == 1
  122. then 0485: return_true
  123. end
  124. 0AB2: return 0
  125.  
  126. :FtpPutFile
  127. // 0AB1: @FtpPutFile 3 hConntection 0@ local_file 1@ remote_file 2@ // IF or SET
  128. 0AA2: 17@ = load_library "wininet.dll"
  129. 0AA4: 18@ = get_proc_address "FtpPutFileA" library 17@
  130. 0AA7: call_function 18@ num_params 5 pop 0 0 1 2@ 1@ 0@ 3@
  131. if 3@ == 1
  132. then 0485: return_true
  133. end
  134. 0AB2: return 0
  135.  
  136. :InternetConnect
  137. // 0AB1: @InternetConnect 4 hInternet 0@ server 1@ user 2@ password 3@ return: hConnection 4@
  138. 0AA2: 17@ = load_library "wininet.dll"
  139. 0AA4: 18@ = get_proc_address "InternetConnectA" library 17@
  140. 0AA7: call_function 18@ num_params 8 pop 0 0 0x08000000 1 3@ 2@ 21 1@ 0@ 4@
  141. 0AB2: return 1 4@
  142.  
  143. :InternetOpen
  144. // 0AB1: @InternetOpen 0 return: hInternet 0@
  145. 0AA2: 17@ = load_library "wininet.dll"
  146. 0AA4: 18@ = get_proc_address "InternetOpenA" library 17@
  147. 0AA7: call_function 18@ num_params 5 pop 0 0 0 0 1 0 0@
  148. 0AB2: return 1 0@
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement