Advertisement
CREAMPAN0408

Untitled

Feb 20th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.22 KB | None | 0 0
  1. function fHelp(p: player):
  2. send "&9----------------------------------------------------" to {_p}
  3. send "&aFriend Commands:" to {_p}
  4. send "&e/friend help &b- Prints this help message" to {_p}
  5. send "&e/friend add &b- Add a player as a friend" to {_p}
  6. send "&e/friend accept &b- Accept a friend request" to {_p}
  7. send "&e/friend deny &b- Decline a friend request" to {_p}
  8. send "&e/friend list &b- List your friends" to {_p}
  9. send "&e/friend remove <player> &b- Remove a player from your friends" to {_p}
  10. #send "&e/friend removeall &b- Remove all your friends" to {_p}
  11. send "&9----------------------------------------------------" to {_p}
  12. function fReq(p: player, r: offline player):
  13. set {_id} to {_p}'s uuid
  14. set {_rd} to {_r}'s uuid
  15. if {ignore.%{_id}%::%{_rd}%} is {_rd}:
  16. send "&9----------------------------------------------------" to {_p}
  17. send "&cYou aren't allowed to send friend requests to this person!" to {_p}
  18. send "&9----------------------------------------------------" to {_p}
  19. stop
  20. if {ignore.%{_rd}%::%{_id}%} is {_id}:
  21. send "&9----------------------------------------------------" to {_p}
  22. send "&cYou aren't allowed to send friend requests to this person!" to {_p}
  23. send "&9----------------------------------------------------" to {_p}
  24. stop
  25. if {friend.%{_id}%::%{_rd}%} is {_rd}:
  26. send "&9----------------------------------------------------" to {_p}
  27. send "&cYou're already friends with this person!" to {_p}
  28. send "&9----------------------------------------------------" to {_p}
  29. stop
  30. if {waitf.%{_id}%::%{_rd}%} is set:
  31. send "&9----------------------------------------------------" to {_p}
  32. send "&cPlease wait before sending this person another request!" to {_p}
  33. send "&9----------------------------------------------------" to {_p}
  34. stop
  35. if {waitf.%{_rd}%::%{_id}%} is set:
  36. {_p} command "/f accept %{_r}%"
  37. stop
  38. send "&9----------------------------------------------------" to {_p}
  39. send "&eYou sent a friend request to %{_r}%! They have 5 minutes to accept it!" to {_p}
  40. send "&9----------------------------------------------------" to {_p}
  41. set {waitf.%{_id}%::%{_rd}%} to now
  42.  
  43. send "&9&m----------------------------------------------------" to {_r}
  44. send "&eFriend request from %{rankcolor2.%{_p}%}% %{name.%{_p}%}%" to {_r}
  45. console command "tellraw %{_r}% ["""",{""text"":""[ACCEPT]"",""bold"":true,""color"":""green"",""clickEvent"":{""action"":""run_command"",""value"":""/f accept %{_p}%""}},{""text"":"" "",""bold"":true,""color"":""green""},{""text"":""- "",""color"":""dark_gray""},{""text"":""[DENY]"",""bold"":true,""color"":""red"",""clickEvent"":{""action"":""run_command"",""value"":""/f deny %{_p}%""}},{""text"":"" "",""bold"":true,""color"":""red""},{""text"":""- "",""color"":""dark_gray""},{""text"":""[IGNORE]"",""bold"":true,""color"":""gray"",""clickEvent"":{""action"":""run_command"",""value"":""/ignore add %{_p}%""}}]"
  46. #send "&eClick to accept: &a&l[ACCEPT]" to {_r}
  47. #json("%{_r}%", "&eClick to accept: &a&l[ACCEPT]||cmd:/f accept %{_p}%")
  48. send "&9&m----------------------------------------------------" to {_r}
  49. wait 5 minutes
  50. if {friend.%{_id}%::%{_rd}%} is {_rd}:
  51. delete {waitf.%{_id}%::%{_rd}%}
  52. stop
  53. delete {waitf.%{_id}%::%{_rd}%}
  54. if {waitf.%{_id}%::%{_rd}%} is set:
  55. send "&9----------------------------------------------------" to {_p}
  56. send "&eYour friend request to %{rankcolor3.%{_r}%}% %{_r}% &ehas expired." to {_p}
  57. send "&9----------------------------------------------------" to {_p}
  58.  
  59. send "&9----------------------------------------------------" to {_r}
  60. send "&eThe friend request from %{rankcolor3.%{_p}%}% %{_p}% &ehas expired." to {_r}
  61. send "&9----------------------------------------------------" to {_r}
  62. delete {waitf.%{_id}%::%{_rd}%}
  63. function fList(p: player):
  64. set {_id} to {_p}'s uuid
  65. send "&9----------------------------------------------------" to {_p}
  66. send centered "&6Friends(%number of {friend.%{_id}%::*}% Players)" to {_p}
  67. loop {friend.%{_id}%::*}:
  68. set {_a} to offline player from uuid loop-value
  69. if {_a} is online:
  70. if {_a} is in "world":
  71. set {_on::%loop-index%} to "%{rankcolor2.%{_a}%}% %{name.%{_a}%}% &eis in a Lobby"
  72. else if {_a} is in "ffa":
  73. set {_on::%loop-index%} to "%{rankcolor2.%{_a}%}% %{name.%{_a}%}% &eis in a FFA"
  74.  
  75. else if {_a} is offline:
  76. set {_off::%loop-index%} to "%{rankcolor3.%{_a}%}% %{_a}% &cis currently offline"
  77. loop {_on::*}:
  78. send "%loop-value%" to {_p}
  79. loop {_off::*}:
  80. send "%loop-value%" to {_p}
  81. send "&9----------------------------------------------------" to {_p}
  82. function fAccept(p: player, r: offline player):
  83. set {_id} to {_p}'s uuid
  84. set {_rd} to {_r}'s uuid
  85. if {friend.%{_id}%::%{_rd}%} is {_rd}:
  86. send "&9----------------------------------------------------" to {_p}
  87. send "&cYou're already friends with this person!" to {_p}
  88. send "&9----------------------------------------------------" to {_p}
  89. stop
  90. if {waitf.%{_rd}%::%{_id}%} is not set:
  91. send "&9----------------------------------------------------" to {_p}
  92. send "&cThat person hasn't invited you to be friends! Try &e/friend add %{_r}%" to {_p}
  93. send "&9----------------------------------------------------" to {_p}
  94. stop
  95. send "&9----------------------------------------------------" to {_p}
  96. send "&aYou are now friends with %{rankcolor3.%{_r}%}% %{_r}%" to {_p}
  97. send "&9----------------------------------------------------" to {_p}
  98. send "&9----------------------------------------------------" to {_r}
  99. send "&aYou are now friends with %{rankcolor3.%{_p}%}% %{_p}%" to {_r}
  100. send "&9----------------------------------------------------" to {_r}
  101. delete {waitf.%{_id}%::%{_rd}%}
  102. delete {waitf.%{_rd}%::%{_id}%}
  103. set {friend.%{_id}%::%{_rd}%} to {_rd}
  104. set {friend.%{_rd}%::%{_id}%} to {_id}
  105. function fDecline(p: player, r: offline player):
  106. set {_id} to {_p}'s uuid
  107. set {_rd} to {_r}'s uuid
  108. if {friend.%{_id}%::%{_rd}%} is {_rd}:
  109. send "&9----------------------------------------------------" to {_p}
  110. send "&cYou're already friends with this person!" to {_p}
  111. send "&9----------------------------------------------------" to {_p}
  112. stop
  113. if {waitf.%{_rd}%::%{_id}%} is not set:
  114. send "&9----------------------------------------------------" to {_p}
  115. send "&cThat person hasn't invited you to be friends! Try &e/friend add %{_r}%" to {_p}
  116. send "&9----------------------------------------------------" to {_p}
  117. stop
  118. send "&9----------------------------------------------------" to {_p}
  119. send "&eDeclined %{_r}%'s friend request!" to {_p}
  120. send "&9----------------------------------------------------" to {_p}
  121. delete {waitf.%{_id}%::%{_rd}%}
  122. delete {waitf.%{_rd}%::%{_id}%}
  123. function fRemove(p: player, r: offline player):
  124. set {_id} to {_p}'s uuid
  125. set {_rd} to {_r}'s uuid
  126. if {friend.%{_id}%::%{_rd}%} is not {_rd}:
  127. send "&9----------------------------------------------------" to {_p}
  128. send "%{rankcolor3.%{_r}%}% %{_r}% &cisn't on your friends list!" to {_p}
  129. send "&9----------------------------------------------------" to {_p}
  130. stop
  131. if {friend.%{_id}%::%{_rd}%} is not set:
  132. send "&9----------------------------------------------------" to {_p}
  133. send "%{rankcolor3.%{_r}%}% %{_r}% &cisn't on your friends list!" to {_p}
  134. send "&9----------------------------------------------------" to {_p}
  135. stop
  136. else if {friend.%{_id}%::%{_rd}%} is {_rd}:
  137. send "&9----------------------------------------------------" to {_p}
  138. send "&eYou removed %{rankcolor3.%{_r}%}% %{_r}% &efrom your friends list!" to {_p}
  139. send "&9----------------------------------------------------" to {_p}
  140.  
  141. send "&9----------------------------------------------------" to {_r}
  142. send "%{rankcolor3.%{_p}%}% %{_p}% &eremoved you from their friend list!" to {_r}
  143. send "&9----------------------------------------------------" to {_r}
  144. delete {friend.%{_id}%::%{_rd}%}
  145. delete {friend.%{_rd}%::%{_id}%}
  146. function fJoin(p: player):
  147. set {_id} to {_p}'s uuid
  148. loop all players:
  149. if {friend.%loop-player's uuid%::%{_id}%} is {_id}:
  150. send "%{rankcolor3.%{_p}%}% %{_p}% &ejoined the lobby!" to loop-player
  151. function fQuit(p: player):
  152. set {_id} to {_p}'s uuid
  153. loop all players:
  154. if {friend.%loop-player's uuid%::%{_id}%} is {_id}:
  155. send "%{rankcolor3.%{_p}%}% %{_p}% &eleft." to loop-player
  156.  
  157. command /friend [<text>] [<offline player>]:
  158. aliases: f
  159. trigger:
  160. if arg 1 is not set:
  161. fHelp(player)
  162. stop
  163. else if arg 1 is set:
  164. if arg 1 is "help":
  165. fHelp(player)
  166. stop
  167. if arg 1 is "add":
  168. if arg 2 is set:
  169. if arg 2 is player:
  170. send "&9----------------------------------------------------" to player
  171. send "&eYou can't add yourself as a friend!" to player
  172. send "&9----------------------------------------------------" to player
  173. stop
  174. fReq(player, arg 2)
  175. stop
  176. else:
  177. send "&9----------------------------------------------------" to player
  178. send "&cInvalid usage! Valid usage: /friend add Player" to player
  179. send "&9----------------------------------------------------" to player
  180. stop
  181. if arg 1 is "list":
  182. set {_num} to 1
  183. $ thread
  184. loop {friend.%player's uuid%::*}:
  185. set {_player} to offline player from uuid loop-value
  186. if {_player} is online:
  187. set {_list::%{_num}%} to loop-value
  188. add 1 to {_num}
  189. loop {friend.%player's uuid%::*}:
  190. set {_player} to offline player from uuid loop-value
  191. if {_player} is offline:
  192. set {_list::%{_num}%} to loop-value
  193. add 1 to {_num}
  194. set {_loops} to 8
  195. if arg 2 is set:
  196. set {_n} to "%arg 2%" parsed as integer
  197. else:
  198. set {_n} to 1
  199. if {_n} is not set:
  200. send "&9----------------------------------------------------" to player
  201. send "&cInvalid page number!" to player
  202. send "&9----------------------------------------------------" to player
  203. stop
  204. if {_n} <= 0:
  205. send "&9----------------------------------------------------" to player
  206. send "&cPage number must be positive!" to player
  207. send "&9----------------------------------------------------" to player
  208. stop
  209. if {_n} <= 1:
  210. set {_min} to 1
  211. else:
  212. set {_min} to {_loops}*({_n}-1) + 1
  213. set {_max} to ceil(number of {_list::*} / {_loops})
  214. send "&9----------------------------------------------------" to player
  215. send centered "&6Friends (Page %{_n}% of %{_max}%)" to player
  216. loop {_loops} times:
  217. set {__i} to {_min} + loop-number - 1
  218. if {_list::%{__i}%} is not set:
  219. stop loop
  220. set {_hoge} to offline player from uuid {_list::%{__i}%}
  221. if {_hoge} is online:
  222. if {rankcolor3.%{_hoge}%} is "<gray>":
  223. send "%{rankcolor3.%{_hoge}%}%%{_hoge}% &eis in Revive FFA"
  224. else:
  225. send "%{rankcolor3.%{_hoge}%}% %{_hoge}% &eis in Revive FFA"
  226. if {_hoge} is offline:
  227. if {rankcolor3.%{_hoge}%} is "<gray>":
  228. send "%{rankcolor3.%{_hoge}%}%%{_hoge}% &cis currently offline"
  229. else:
  230. send "%{rankcolor3.%{_hoge}%}% %{_hoge}% &cis currently offline"
  231. send "&9----------------------------------------------------" to player
  232. stop
  233. if arg 1 is "accept":
  234. if arg 2 is set:
  235. if arg 2 is player:
  236. send "&9----------------------------------------------------" to player
  237. send "&eYou can't add yourself as a friend!" to player
  238. send "&9----------------------------------------------------" to player
  239. stop
  240. else:
  241. fAccept(player, arg 2)
  242. stop
  243. else:
  244. send "&9----------------------------------------------------" to player
  245. send "&cInvalid usage! Valid usage: /friend accept Player" to player
  246. send "&9----------------------------------------------------" to player
  247. stop
  248. if arg 1 is "deny":
  249. if arg 2 is set:
  250. if arg 2 is player:
  251. send "&9----------------------------------------------------" to player
  252. send "&eYou can't deny yourself as a friend!" to player
  253. send "&9----------------------------------------------------" to player
  254. stop
  255. else:
  256. fDecline(player, arg 2)
  257. stop
  258. else:
  259. send "&9----------------------------------------------------" to player
  260. send "&cInvalid usage! Valid usage: /friend deny Player" to player
  261. send "&9----------------------------------------------------" to player
  262. stop
  263. if arg 1 is "remove":
  264. if arg 2 is set:
  265. if arg 2 is player:
  266. send "&9----------------------------------------------------" to player
  267. send "&eYou can't remove yourself as a friend!" to player
  268. send "&9----------------------------------------------------" to player
  269. stop
  270. else:
  271. fRemove(player, arg 2)
  272. stop
  273. else:
  274. send "&9----------------------------------------------------" to player
  275. send "&cInvalid usage! Valid usage: /friend remove Player" to player
  276. send "&9----------------------------------------------------" to player
  277. stop
  278. else:
  279. set {_a} to "%arg 1%" parsed as offline player
  280. if {_a} is player:
  281. send "&9----------------------------------------------------" to player
  282. send "&eYou can't add yourself as a friend!" to player
  283. send "&9----------------------------------------------------" to player
  284. stop
  285. if {_a} is online:
  286. fReq(player, {_a})
  287. stop
  288. else:
  289. fHelp(player)
  290. stop
  291. command /fl [<text>]:
  292. trigger:
  293. set {_num} to 1
  294. $ thread
  295. loop {friend.%player's uuid%::*}:
  296. set {_player} to offline player from uuid loop-value
  297. if {_player} is online:
  298. set {_list::%{_num}%} to loop-value
  299. add 1 to {_num}
  300. loop {friend.%player's uuid%::*}:
  301. set {_player} to offline player from uuid loop-value
  302. if {_player} is offline:
  303. set {_list::%{_num}%} to loop-value
  304. add 1 to {_num}
  305. set {_loops} to 8
  306. if arg 1 is set:
  307. set {_n} to "%arg 1%" parsed as integer
  308. else:
  309. set {_n} to 1
  310. if {_n} is not set:
  311. send "&9----------------------------------------------------" to player
  312. send "&cInvalid page number!" to player
  313. send "&9----------------------------------------------------" to player
  314. stop
  315. if {_n} <= 0:
  316. send "&9----------------------------------------------------" to player
  317. send "&cPage number must be positive!" to player
  318. send "&9----------------------------------------------------" to player
  319. stop
  320. if {_n} <= 1:
  321. set {_min} to 1
  322. else:
  323. set {_min} to {_loops}*({_n}-1) + 1
  324. set {_max} to ceil(number of {_list::*} / {_loops})
  325. send "&9----------------------------------------------------" to player
  326. send centered "&6Friends (Page %{_n}% of %{_max}%)" to player
  327. loop {_loops} times:
  328. set {__i} to {_min} + loop-number - 1
  329. if {_list::%{__i}%} is not set:
  330. stop loop
  331. set {_hoge} to offline player from uuid {_list::%{__i}%}
  332. if {_hoge} is online:
  333. if {rankcolor3.%{_hoge}%} is "<gray>":
  334. send "%{rankcolor3.%{_hoge}%}%%{_hoge}% &eis in Revive FFA"
  335. else:
  336. send "%{rankcolor3.%{_hoge}%}% %{_hoge}% &eis in Revive FFA"
  337. if {_hoge} is offline:
  338. if {rankcolor3.%{_hoge}%} is "<gray>":
  339. send "%{rankcolor3.%{_hoge}%}%%{_hoge}% &cis currently offline"
  340. else:
  341. send "%{rankcolor3.%{_hoge}%}% %{_hoge}% &cis currently offline"
  342. send "&9----------------------------------------------------" to player
  343. on join:
  344. fJoin(player)
  345. on quit:
  346. fQuit(player)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement