Advertisement
Guest User

Untitled

a guest
Feb 20th, 2018
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.56 KB | None | 0 0
  1. #todo
  2. #fix the spawn bug
  3. #the top 3 count is incomplete
  4. #haven't make give player reward
  5. #add a variable to lock them cannot use the sign to spam the autostart message
  6. #player cannot hoe land when script reload
  7. #player cannot hoe land when script reload
  8. #continue scoreboard format fix
  9. #
  10. options:
  11. HoePrefix: &e[&aHoeHoeHoe&e]
  12. HoeItem: "&fMagic Hoe"
  13. HoeNoSelfBlockFound: "&c&lNo Self color blocks found"
  14. #Scoreboard
  15. HoeBoardTitle: "&a&lHoe Hoe Hoe"
  16. HoeBoardWaiting: "&eWaiting..."
  17. HoeBoardStarting: "&eStarting..."
  18. HoeBoardStartingIn: "&eStarts in %{HoeReadyCount}%"
  19. HoeBoardEndsIn: "&eEnds in %{EndGameTimer}%"
  20. HoeBoardLastLine: "&b&lSimpleMinigame"
  21. HoeBoardScoreTitle: "&eScore of player:"
  22. HoePlayerCount: &b%{HoePlayerCount}%&e/&b16
  23. #Title
  24. HoeTitle: "&aHoe Hoe Hoe"
  25. HoeSubTitle: "&2SimpleMinigameServer"
  26. #Sound
  27. HoeSound: "step.gravel"
  28. HoeLv1Sound: "note.pling"
  29. HoeLv2Sound: "random.successful_hit"
  30. #Sign
  31. HoeSignLine1: "&1[&4hhh&1]"
  32. HoeSignWaiting: &9Waiting...
  33. HoeSignStarting: &aStarting...
  34. HoeSignEndingIn: &1Ending in %{EndGameTimer}%
  35. HoeSignEnding: &9Ending...
  36. HoeSignPlayerCount1: &b0&e/&b16
  37. HoeSignPlayerCount2: &b%{HoePlayerCount}%&e/&b16
  38. #messages via chat
  39. HoeGameFull: &eThe arena is full. Please wait untill the game ends.
  40. HoeAlreadyInGame: &eYou are already in the arena.
  41. HoeGameInProcess: &eThe game is in process, wait or join later.
  42. HoeHasJoined: &e%event-player% has joined (&b%{HoePlayerCount}%&e/&b16&e)!
  43. HoeYouLeft: &eYou left the arena.
  44. HoeNotInAnyArena: &eYou are not in any arena.
  45. HoeDataBaseReset: &cResetted.
  46. HoeStartingInDiv5: &eThe game will starts in %{HoeStartCountDown}% second.
  47. HoeStartingBig1: &eThe game will starts in %{HoeStartCountDown}% seconds.
  48. HoeStarting1Second: &eThe game will starts in 1 second.
  49. HoeMessageWhileTitle: &aGame starts in %{HoeReadyCount}% seconds
  50. HoeNewSignSet: &eYou setted a new join sign.
  51. HoeDeletedSign: &eYou deleted a join sign
  52. HoeGameSpawnSet: &eYou setted the gamespawn to
  53. HoeMainLobbySet: &eYou setted the mainlobby to
  54. HoeWaitRoomSet: &eYou setted the waitroom to
  55. HoeGameStopped: &eThe game has stopped
  56. HoeUnknownCommand: &eUnknown command. Please type /hhh help for help
  57. #variables:
  58. # #player variables
  59. # {HoeSelfWoolColor.%player%} = 0
  60. # {HoeBlockToRestore::*} = 0
  61. # {HoeFirstBlock.%player%} = 0
  62. # {HoePlayerInGame.%player%} = 0
  63. # {HoePlayerScoreCount.%player%} = 0
  64. # #map variables
  65. # {HoeCurrentWoolColor} = 0
  66. # {HoePlayerCount} = 0
  67. # {GameSpawn} = 0
  68. # {MainLobby} = 0
  69. # {GameWaitRoom} = 0
  70. # {ArenaLock} = 0
  71. # {AutoStartRenewLock} = 0
  72. # {EndGameTimer} = 0
  73. # {DefaultEndGameTimer} = 180
  74. # {Top1Players} = 0
  75. # {Top2Players} = 0
  76. # {Top3Players} = 0
  77. # {HoeStartCountDown} = 0
  78. # {JoinCountDownLock} = 0
  79. # {HoeBlockAllowHoe.%player%} = 0
  80. variables:
  81. {DefaultEndGameTimer} = 180
  82. {HoeDynamicSign::*} = 0
  83.  
  84. on script load:
  85. loop all players:
  86. delete {HoeSelfWoolColor.%loop-player%}
  87. delete {HoeFirstBlock.%loop-player%}
  88. delete {HoePlayerInGame.%loop-player%}
  89. delete {HoePlayerScoreCount.%loop-player%}
  90. delete {HoeBlockToRestore::*}
  91. set {HoeCurrentWoolColor} to 0
  92. delete {HoePlayerCount}
  93. delete {ArenaLock}
  94. delete {AutoStartRenewLock}
  95. set {EndGameTimer} to 180
  96. set {DefaultEndGameTimer} to 180
  97. delete {Top1Players}
  98. delete {Top2Players}
  99. delete {Top3Players}
  100. delete {HoeStartCountDown}
  101. delete {HoeBoardState}
  102. delete {JoinCountDownLock}
  103. #===============
  104. #===============
  105. #Function
  106. #===============
  107. #===============
  108. function HoeBoard(Empty: integer):
  109. loop all players:
  110. if {HoePlayerInGame.%loop-player%} is 1:
  111. if {JoinCountDownLock} is not set:
  112. wipe loop-player's sidebar
  113. set name of sidebar of loop-player to {@HoeBoardTitle}
  114. set score "" in sidebar of loop-player to 999
  115.  
  116. if {HoeBoardState} = 1:
  117. set score {@HoeBoardWaiting} in sidebar of loop-player to 0
  118.  
  119. if {HoeBoardState} = 2:
  120. set score {@HoeBoardStarting} in sidebar of loop-player to 0
  121.  
  122. if {HoeBoardState} = 3:
  123. set score {@HoeBoardStartingIn} in sidebar of loop-player to 999
  124.  
  125. if {HoeBoardState} = 4:
  126. set score {@HoeBoardEndsIn} in sidebar of loop-player to 998
  127. set score " " in sidebar of loop-player to 997
  128. set score "&e%loop-player%:" in sidebar of loop-player to {HoePlayerScoreCount.%loop-player%}
  129. set score " " in sidebar of loop-player to -1
  130. set score {@HoeBoardLastLine} in sidebar of loop-player to -2
  131.  
  132. if {HoeBoardState} = 5:
  133. set score {@HoeBoardScoreTitle} in sidebar of loop-player to 998
  134. set score " " in sidebar of loop-player to 997
  135. loop all players:
  136. if {HoePlayerInGame.%loop-player-2%} is 1:
  137. set score "&e%loop-player-2%:" in sidebar of loop-player-1 to {HoePlayerScoreCount.%loop-player-2%}
  138. set score " " in sidebar of loop-player to -1
  139. set score " " in sidebar of loop-player to -1
  140. set score {@HoeBoardLastLine} in sidebar of loop-player to -2
  141.  
  142. if {HoeBoardState} is not 4 or 5:
  143. set score " " in sidebar of loop-player to -1
  144. set score "{@HoePlayerCount}" in sidebar of loop-player to -2
  145. set score " " in sidebar of loop-player to -3
  146. set score {@HoeBoardLastLine} in sidebar of loop-player to -4
  147. delete {HoeBoardState}
  148. #===============
  149. #===============
  150. function HoeCountDownMsg(Time: integer):
  151. loop all players:
  152. if {HoePlayerInGame.%loop-player%} is 1:
  153. if {_Time} is divisible by 5:
  154. message "{@HoeStartingInDiv5}" to loop-player
  155. else if {_Time} > 1:
  156. message "{@HoeStartingBig1}" to loop-player
  157. else if {_Time} = 1:
  158. message "{@HoeStarting1Second}" to loop-player
  159. #===============
  160. #===============
  161. function HoeAutoStart(CountDown: integer, Player: player):
  162. if {HoePlayerCount} > 1:
  163. set {HoeStartCountDown} to {_CountDown}
  164. if {JoinCountDownLock} is 0:
  165. set {JoinCountDownLock} to 1
  166. loop all players:
  167. if {HoePlayerInGame.%loop-player%} is 1:
  168. wipe loop-player's sidebar
  169. while {HoeStartCountDown} > 0:
  170. HoeCountDownMsg({HoeStartCountDown})
  171. remove 1 from {HoeStartCountDown}
  172. wait 1 second
  173. make console execute command "/hoehoehoe start"
  174. delete {HoeStartCountDown}
  175. if {JoinCountDownLock} is 1:
  176. message "&ethe autostart renew is blocked" to {_Player}
  177. function HoeTitleCountDown(Empty: integer):
  178. while {HoeReadyCount} > 0:
  179. loop all players:
  180. if {HoePlayerInGame.%loop-player%} is 1:
  181. send loop-player title "&e%{HoeReadyCount}%" for 1 second
  182. message "{@HoeMessageWhileTitle}" to loop-player
  183. if {HoeReadyCount} is not 1 or 2 or 3:
  184. play raw sound {@HoeLv1Sound} at loop-player with pitch 1 volume 1
  185. else:
  186. play raw sound {@HoeLv2Sound} at loop-player with pitch 1 volume 1
  187.  
  188. if {HoeReadyCount} < 6:
  189. set {ArenaLock} to 1
  190.  
  191. set {HoeBoardState} to 3
  192. HoeBoard(3)
  193. remove 1 from {HoeReadyCount}
  194. wait 1 second
  195. function HoeDynamicSign(Empty: integer):
  196. set {_HoeSignTemp} to 0
  197. loop {HoeDynamicSign::*}:
  198. add 1 to {_HoeSignTemp}
  199. while {_HoeSignTemp} > 0:
  200. if {HoeDynamicSignState} = 1:
  201. set line 3 of block at {HoeDynamicSign::%{_HoeSignTemp}%} to "{@HoeSignWaiting}"
  202. if {HoeDynamicSignState} = 2:
  203. loop {HoeDynamicSign::*}:
  204. set line 3 of block at {HoeDynamicSign::%{_HoeSignTemp}%} to "{@HoeSignStarting}"
  205. if {HoeDynamicSignState} = 3:
  206. loop {HoeDynamicSign::*}:
  207. set line 3 of block at {HoeDynamicSign::%{_HoeSignTemp}%} to "{@HoeSignEndingIn}"
  208. if {HoeDynamicSignState} = 4:
  209. loop {HoeDynamicSign::*}:
  210. set line 3 of block at {HoeDynamicSign::%{_HoeSignTemp}%} to "{@HoeSignEnding}"
  211. if {HoePlayerCount} is not set:
  212. set line 4 of block at {HoeDynamicSign::%{_HoeSignTemp}%} to "{@HoeSignPlayerCount1}"
  213. else:
  214. set line 4 of block at {HoeDynamicSign::%{_HoeSignTemp}%} to "{@HoeSignPlayerCount2}"
  215.  
  216. remove 1 from {_HoeSignTemp}
  217. delete {hoedynamicsignstate}
  218. #===============
  219. #===============
  220. on right click:
  221. if target block is sign:
  222. if line 1 is {@HoeSignLine1}:
  223. if line 2 is "join":
  224. make event-player execute command "/hhh join"
  225. loop {HoeDynamicSign::*}:
  226. if location of clicked block = {HoeDynamicSign::%loop-index%}:
  227. set {_HoeSignAlreadyExist} to 1
  228. if {_HoeSignAlreadyExist} is not set:
  229. add location of clicked block to {HoeDynamicSign::*}
  230. message "{@HoePrefix} {@HoeNewSignSet}"
  231.  
  232. set {HoeDynamicSignState} to 1
  233. HoeDynamicSign(1)
  234.  
  235. if line 2 is "leave":
  236. make event-player execute command "/hhh leave"
  237. set {HoeDynamicSignState} to 1
  238. HoeDynamicSign(1)
  239. on break of sign:
  240. if line 1 is {@HoeSignLine1}:
  241. if line 2 is "join":
  242. loop {HoeDynamicSign::*}:
  243. if {HoeDynamicSign::%loop-index%} = location of event-block:
  244. delete {HoeDynamicSign::%loop-index%}
  245. message "{@HoePrefix} {@HoeDeletedSign}"
  246. #==============
  247. #==============
  248. #Default Game Logic
  249. #==============
  250. #==============
  251. on right click:
  252. if player's tool is diamond hoe named {@HoeItem}:
  253. if {HoePlayerInGame.%event-player%} is 1:
  254. if clicked block is grass:
  255. cancel event
  256. #===============
  257. #first block to hoe
  258. #===============
  259. if {HoeFirstBlock.%event-player%} is not set:
  260. set {HoeFirstBlock.%event-player%} to 1
  261. set {HoeBlockAllowHoe.%event-player%} to 1
  262.  
  263. play raw sound {@HoeSound} at player with pitch 1 volume 1
  264. #==========
  265. #if self block found
  266. #==========
  267. else if block in front of clicked block is {HoeSelfWoolColor.%event-player%}:
  268. set {HoeBlockAllowHoe.%event-player%} to 1
  269. else if block behind clicked block is {HoeSelfWoolColor.%event-player%}:
  270. set {HoeBlockAllowHoe.%event-player%} to 1
  271. else if block left clicked block is {HoeSelfWoolColor.%event-player%}:
  272. set {HoeBlockAllowHoe.%event-player%} to 1
  273. else if block right clicked block is {HoeSelfWoolColor.%event-player%}:
  274. set {HoeBlockAllowHoe.%event-player%} to 1
  275. #==========
  276. #no self block found
  277. #==========
  278. if {HoeBlockAllowHoe.%event-player%} is not set:
  279. if {HoeFirstBlock.%event-player%} = 1:
  280. set action bar of event-player to {@HoeNoSelfBlockFound}
  281. #==========
  282. #set block
  283. #==========
  284. if {HoeBlockAllowHoe.%event-player%} = 1:
  285. add 1 to {HoePlayerScoreCount.%event-player%}
  286. add location of event-block to {HoeBlockToRestore::*}
  287. delete {HoeBlockAllowHoe.%event-player%}
  288.  
  289. set block at location of clicked block to {HoeSelfWoolColor.%event-player%}
  290. play raw sound {@HoeSound} at event-player with pitch 1 volume 1
  291.  
  292. set {HoeBoardState} to 4
  293. HoeBoard(4)
  294. on quit:
  295. delete {HoePlayerInGame.%event-player%}
  296. delete {HoeSelfWoolColor.%event-player%}
  297. delete {HoeFirstBlock.%event-player%}
  298. delete {HoePlayerInGame.%event-player%}
  299. delete {HoePlayerScoreCount.%event-player%}
  300. remove 1 from {HoePlayerCount}
  301. set {HoeDynamicSignState} to 1
  302. HoeDynamicSign(1)
  303. command /hoehoehoe <text="help">:
  304. aliases: /hhh, /hoe
  305. trigger:
  306. #===============
  307. #===============
  308. #Join
  309. #===============
  310. #===============
  311. if arg-1 is "help":
  312. message ""
  313. message "&e==========[&eHoeHoeHoe&e]=========="
  314. message "&eSimpleMinigameServer"
  315. message "&aCommands:"
  316. message "&e/hoehoehoe"
  317. message "&aAliases: /hhh, /hoe"
  318. message "&ehelp: Show this help page"
  319. message "&ejoin: Join a game"
  320. message "&eleave | quit: Leave a game"
  321. message "&estart: Force start a game"
  322. message "&esetgamespawn: Set the game spawn"
  323. message "&esetmainlobby: Set the main lobby"
  324. message "&esetwaitroom: set the wait room"
  325. message "&e==============================="
  326. message ""
  327. else if arg-1 is "join":
  328. if {HoePlayerCount} > 15:
  329. message "{@HoePrefix} {@HoeGameFull}"
  330. if {HoePlayerInGame.%event-player%} is set:
  331. message "{@HoePrefix} {@HoeAlreadyInGame}"
  332. if {HoePlayerInGame.%event-player%} is not set:
  333. if {ArenaLock} is 1:
  334. message "{@HoePrefix} {@HoeGameInProcess}"
  335. if {ArenaLock} is not set:
  336. set {HoePlayerInGame.%event-player%} to 1
  337. add 1 to {HoePlayerCount}
  338. delete {HoeFirstBlock.%event-player%}
  339. set {HoeSelfWoolColor.%event-player%} to "wool:%{HoeCurrentWoolColor}%" parsed as item
  340. add 1 to {HoeCurrentWoolColor}
  341.  
  342. set {HoeBoardState} to 1
  343. HoeBoard(1)
  344. HoeAutoStart({HoeStartCountDown}, event-player)
  345. set {HoeDynamicSignState} to 1
  346. HoeDynamicSign(1)
  347.  
  348. teleport event-player to {GameWaitRoom}
  349. set event-player's gamemode to survival
  350. clear event-player's inventory
  351. loop all players:
  352. if {HoePlayerInGame.%event-player%} is set:
  353. message "{@HoePrefix} {@HoeHasJoined}" to loop-player
  354. else if arg-1 is "quit" or "leave":
  355. if {HoePlayerInGame.%event-player%} is 1:
  356. teleport player to {MainLobby}
  357. delete {HoePlayerInGame.%event-player%}
  358. remove 1 from {HoePlayerCount}
  359. clear event-player's inventory
  360. wipe event-player's sidebar
  361. message "{@HoePrefix} {@HoeYouLeft}"
  362. set {HoeDynamicSignState} to 1
  363. HoeDynamicSign(1)
  364. else:
  365. message "{@HoePrefix} {@HoeNotInAnyArena}"
  366. #===============
  367. #===============
  368. #reset all the stuff
  369. #===============
  370. #===============
  371. else if arg-1 is "reset":
  372. loop all players:
  373. set {HoeSelfWoolColor.%event-player%} to 0
  374. set {HoeFirstBlock.%event-player%} to 0
  375. set {HoePlayerScoreCount.%event-player%} to 0
  376. delete {HoePlayerInGame.%event-player%}
  377. set {HoeBlockToRestore::*} to 0
  378. set {HoeCurrentWoolColor} to 0
  379. set {HoePlayerCount} to 0
  380. set {DefaultEndGameTimer} to 180
  381. delete {EndGameTimer}
  382. delete {Top1Players}
  383. delete {Top2Players}
  384. delete {Top3Players}
  385. delete {ArenaLock}
  386. delete {JoinCountDownLock}
  387. delete {AutoStartRenewLock}
  388. delete {HoeDynamicSign::*}
  389. message "{@HoePrefix} {@HoeDataBaseReset}"
  390. #===============
  391. #===============
  392. #set the spawn that player will be teleport when join game
  393. #===============
  394. #===============
  395. else if arg-1 is "setgamespawn":
  396. set {GameSpawn} to location of event-player
  397. message "{@HoePrefix} {@HoeGameSpawnSet}"
  398. message "{@HoePrefix} &e%{GameSpawn}%"
  399. else if arg-1 is "setmainlobby":
  400. set {MainLobby} to location of player
  401. message "{@HoePrefix} {@HoeMainLobbySet}"
  402. message "{@HoePrefix} &e%{MainLobby}%"
  403. else if arg-1 is "setwaitroom":
  404. set {GameWaitRoom} to location of player
  405. message "{@HoePrefix} {@HoeWaitRoomSet}"
  406. message "{@HoePrefix} &e%{GameWaitRoom}%"
  407. #===============
  408. #===============
  409. #force stop arena
  410. #===============
  411. #===============
  412. else if arg-1 is "stop":
  413. delete {EndGameTimer}
  414. loop all players:
  415. if {HoePlayerInGame.%event-player%} is 1:
  416. message "{@HoePrefix} {@HoeGameStopped}" to loop-player
  417. set {HoeDynamicSignState} to 4
  418. HoeDynamicSign(4)
  419. #===============
  420. #===============
  421. #force start arena
  422. #===============
  423. #===============
  424. else if arg-1 is "start":
  425. set {HoeSignState} to 1
  426. loop all players:
  427. if {HoePlayerInGame.%loop-player%} is 1:
  428. teleport loop-player to {GameSpawn}
  429. send loop-player title {@HoeTitle} with subtitle {@HoeSubTitle} for 3 seconds
  430. set {HoePlayerScoreCount.%loop-player%} to 0
  431.  
  432. set {HoeDynamicSignState} to 2
  433. HoeDynamicSign(2)
  434. set {HoeBoardState} to 2
  435. HoeBoard(2)
  436. wait 5 seconds
  437.  
  438. set {HoeReadyCount} to 10
  439. HoeTitleCountDown({HoeReadyCount})
  440. loop {HoeReadyCount}+1 times:
  441. wait 1 second
  442. #====================
  443. #game start and give player item
  444. #show the time left
  445. #====================
  446. loop all players:
  447. if {HoePlayerInGame.%loop-player%} is 1:
  448. give loop-player a diamond hoe named {@HoeItem}
  449.  
  450. set {EndGameTimer} to {DefaultEndGameTimer}
  451. while {EndGameTimer} > 0:
  452. set {HoeBoardState} to 4
  453. HoeBoard(4)
  454. set {HoeDynamicSignState} to 3
  455. HoeDynamicSign(3)
  456. remove 1 from {EndGameTimer}
  457. wait 1 second
  458. delete {EndGameTimer}
  459. #===============
  460. #End Game
  461. #===============
  462. loop all players:
  463. if {HoePlayerInGame.%loop-player%} is 1:
  464. clear loop-player's inventory
  465. heal loop-player
  466. set {HoeBoardState} to 5
  467. HoeBoard(5)
  468.  
  469. set {HoeDynamicSignState} to 4
  470. HoeDynamicSign(4)
  471.  
  472. wait 5 seconds
  473. #===============
  474. #system reset
  475. #===============
  476. loop all players:
  477. if {HoePlayerInGame.%loop-player%} is 1:
  478. wipe loop-player's sidebar
  479. teleport loop-player to {MainLobby}
  480. set event-player's gamemode to survival
  481. loop all players:
  482. if {HoePlayerInGame.%loop-player%} is 1:
  483. delete {HoeSelfWoolColor.%loop-player%}
  484. delete {HoeFirstBlock.%loop-player%}
  485. delete {HoePlayerInGame.%loop-player%}
  486. delete {HoePlayerScoreCount.%loop-player%}
  487. #set {HoeSelfWoolColor.%event-player%} to "wool:%{HoeCurrentWoolColor}%" parsed as item
  488. set {HoeCurrentWoolColor} to 0
  489. delete {HoePlayerCount}
  490. set {EndGameTimer} to {DefaultEndGameTimer}
  491. delete {Top1Players}
  492. delete {Top2Players}
  493. delete {Top3Players}
  494. delete {ArenaLock}
  495. delete {JoinCountDownLock}
  496. set {HoeDynamicSignState} to 1
  497. HoeDynamicSign(1)
  498. #===============
  499. #restore the arena to grass
  500. #===============
  501. loop {HoeBlockToRestore::*}:
  502. set block at {HoeBlockToRestore::%loop-index%} to grass
  503. delete {HoeBlockToRestore::%loop-index%}
  504. else:
  505. message "{@HoePrefix} {@HoeUnknownCommand}"
  506. on drop:
  507. if event-item is a diamond hoe named {@HoeItem}:
  508. cancel event
  509. on break:
  510. if {HoePlayerInGame.%event-player%} is 1:
  511. cancel event
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement