nfell2009

CodeGenAPI - 1.1

Jul 7th, 2014
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.18 KB | None | 0 0
  1. #CodeGenAPI
  2. #By nfell2009
  3.  
  4. options:
  5. P: &8[&aCGA&8]&a
  6.  
  7. on script load:
  8. delete {cga.alphabet::*}
  9. add "a" to {cga.alphabet::*}
  10. add "b" to {cga.alphabet::*}
  11. add "c" to {cga.alphabet::*}
  12. add "d" to {cga.alphabet::*}
  13. add "e" to {cga.alphabet::*}
  14. add "f" to {cga.alphabet::*}
  15. add "g" to {cga.alphabet::*}
  16. add "h" to {cga.alphabet::*}
  17. add "i" to {cga.alphabet::*}
  18. add "j" to {cga.alphabet::*}
  19. add "k" to {cga.alphabet::*}
  20. add "l" to {cga.alphabet::*}
  21. add "m" to {cga.alphabet::*}
  22. add "n" to {cga.alphabet::*}
  23. add "o" to {cga.alphabet::*}
  24. add "p" to {cga.alphabet::*}
  25. add "q" to {cga.alphabet::*}
  26. add "r" to {cga.alphabet::*}
  27. add "s" to {cga.alphabet::*}
  28. add "t" to {cga.alphabet::*}
  29. add "u" to {cga.alphabet::*}
  30. add "v" to {cga.alphabet::*}
  31. add "w" to {cga.alphabet::*}
  32. add "x" to {cga.alphabet::*}
  33. add "y" to {cga.alphabet::*}
  34. add "z" to {cga.alphabet::*}
  35.  
  36. command /codegenapi [<text>] [<text>] [<text>] [<text>] [<text>]:
  37. executable by: console
  38. trigger:
  39. if arg 1 is "generate" or "gen" or "g":
  40. if arg 2 is "key" or "k":
  41. if arg 3 is not set:
  42. broadcast "{@P} A Skript just tried to create an API key for CodeGenAPI, however it failed to give its name"
  43. else:
  44. loop 100000000 times:
  45. set {_type1} to a rounded random integer between 1 and 10
  46. set {_type2} to a rounded random integer between 1 and 10
  47. set {_type3} to a rounded random integer between 1 and 10
  48. set {_type4} to a rounded random integer between 1 and 10
  49. set {_type5} to a rounded random integer between 1 and 10
  50. set {_type6} to a rounded random integer between 1 and 10
  51.  
  52. if {_type1} is equal to 1 or 3 or 5 or 7 or 9:
  53. set {_char1} to a rounded random integer between 1 and 9
  54. else:
  55. set {_rand} to a rounded random integer between 1 and 26
  56. set {_char1} to {cga.alphabet::%{_rand}%}
  57.  
  58. if {_type2} is equal to 1 or 3 or 5 or 7 or 9:
  59. set {_char2} to a rounded random integer between 1 and 9
  60. else:
  61. set {_rand} to a rounded random integer between 1 and 26
  62. set {_char2} to {cga.alphabet::%{_rand}%}
  63.  
  64. if {_type3} is equal to 1 or 3 or 5 or 7 or 9:
  65. set {_char3} to a rounded random integer between 1 and 9
  66. else:
  67. set {_rand} to a rounded random integer between 1 and 26
  68. set {_char3} to {cga.alphabet::%{_rand}%}
  69.  
  70. if {_type4} is equal to 1 or 3 or 5 or 7 or 9:
  71. set {_char4} to a rounded random integer between 1 and 9
  72. else:
  73. set {_rand} to a rounded random integer between 1 and 26
  74. set {_char4} to {cga.alphabet::%{_rand}%}
  75.  
  76. if {_type5} is equal to 1 or 3 or 5 or 7 or 9:
  77. set {_char5} to a rounded random integer between 1 and 9
  78. else:
  79. set {_rand} to a rounded random integer between 1 and 26
  80. set {_char5} to {cga.alphabet::%{_rand}%}
  81.  
  82. if {_type6} is equal to 1 or 3 or 5 or 7 or 9:
  83. set {_char6} to a rounded random integer between 1 and 9
  84. else:
  85. set {_rand} to a rounded random integer between 1 and 26
  86. set {_char6} to {cga.alphabet::%{_rand}%}
  87.  
  88. set {_code} to "%{_char1}%%{_char2}%%{_char3}%%{_char4}%%{_char5}%%{_char6}%"
  89. if {cga.codelist::%{_code}%} is not set:
  90. set {cga.codelist::%{_code}%} to {_code}
  91. set {cga.%arg 3%.code} to {_code}
  92. broadcast "%arg 3% %{_code}% %{cga.%arg 3%.code}%"
  93. exit
  94.  
  95. else if arg 2 is "code" or "c":
  96. set {_key} to arg 3
  97. if arg 3 is not set:
  98. broadcast "{@P} A Skript tried to generate a code with CodeGenAPI, but failed to supply its API Key"
  99. else if {cga.codelist::%{_key}%} is not set:
  100. broadcast "{@P} A Skript tried to generate a code with CodeGenAPI, but the API Key given doesn't exist"
  101. else if {cga.codelist::%{_key}%} is set:
  102. if arg 4 is set:
  103. loop 100000000 times:
  104. set {_type1} to a rounded random integer between 1 and 10
  105. set {_type2} to a rounded random integer between 1 and 10
  106. set {_type3} to a rounded random integer between 1 and 10
  107. set {_type4} to a rounded random integer between 1 and 10
  108. set {_type5} to a rounded random integer between 1 and 10
  109. set {_type6} to a rounded random integer between 1 and 10
  110.  
  111. if {_type1} is equal to 1 or 3 or 5 or 7 or 9:
  112. set {_char1} to a rounded random integer between 1 and 9
  113. else:
  114. set {_rand} to a rounded random integer between 1 and 26
  115. set {_char1} to {cga.alphabet::%{_rand}%}
  116.  
  117. if {_type2} is equal to 1 or 3 or 5 or 7 or 9:
  118. set {_char2} to a rounded random integer between 1 and 9
  119. else:
  120. set {_rand} to a rounded random integer between 1 and 26
  121. set {_char2} to {cga.alphabet::%{_rand}%}
  122.  
  123. if {_type3} is equal to 1 or 3 or 5 or 7 or 9:
  124. set {_char3} to a rounded random integer between 1 and 9
  125. else:
  126. set {_rand} to a rounded random integer between 1 and 26
  127. set {_char3} to {cga.alphabet::%{_rand}%}
  128.  
  129. if {_type4} is equal to 1 or 3 or 5 or 7 or 9:
  130. set {_char4} to a rounded random integer between 1 and 9
  131. else:
  132. set {_rand} to a rounded random integer between 1 and 26
  133. set {_char4} to {cga.alphabet::%{_rand}%}
  134.  
  135. if {_type5} is equal to 1 or 3 or 5 or 7 or 9:
  136. set {_char5} to a rounded random integer between 1 and 9
  137. else:
  138. set {_rand} to a rounded random integer between 1 and 26
  139. set {_char5} to {cga.alphabet::%{_rand}%}
  140.  
  141. if {_type6} is equal to 1 or 3 or 5 or 7 or 9:
  142. set {_char6} to a rounded random integer between 1 and 9
  143. else:
  144. set {_rand} to a rounded random integer between 1 and 26
  145. set {_char6} to {cga.alphabet::%{_rand}%}
  146.  
  147. set {_code} to "%{_char1}%%{_char2}%%{_char3}%%{_char4}%%{_char5}%%{_char6}%"
  148. if {cga.%{_key}%.list::%{_code}%} is not set:
  149. set {cga.%{_key}%.%arg 4%.code} to {_code}
  150. set {cga.%{_key}%.list::%{_code}%} to {_code}
  151. stop loop
  152. else:
  153. broadcast "{@P} A Skript tried to generate a code with CodeGenAPI, but failed to give a unique identifier"
Advertisement
Add Comment
Please, Sign In to add comment