View difference between Paste ID: HCDuEcBa and FwDGBCDP
SHOW: | | - or go back to the newest paste.
1
variables:
2
	{hg.%player%.hasjoined} = 1 #1 if false, 0 if true
3
	{hg.current.peoplejoined} = 0 #How many people in the game
4
	{hg.game.open} = 1 #1 if false, 0 if true
5
	{hg.game.playersinworld} = 0
6
7
on weather change:
8
	cancel event
9
10
command /hungergames:
11
	executable by: players
12
	trigger:
13
		broadcast "Hunger games starting in 2 minutes! Type /join to join!" #Broadcasts the game(i lost the game)
14
		set {hg.game.open} to 0 #The game is open for playing
15
		wait 2 minutes #2 minutes until start
16
		loop players in world:
17
			if {hg.%player%.hasjoined} is less than 1:
18
			add 1 to {hg.current.peoplejoined} #See how many people have joined
19
		if {hg.current.peoplejoined} is less than 2:
20
			message "Game canceled. At least 2 people need to join." #You can't have a 1-player Hunger Games!
21
			exit
22
		loop players in world:
23
			if {hg.%player%.hasjoined} is less than 1:
24
			make player execute command "/warp hungergamesspawn" #TP them to the same spot
25
		set {hg.game.open} to 1 #The game is now closed!
26
		disable pvp #No one can attack anyone for 2 minutes
27
		broadcast "Everyone is invincible for 2 minutes. Go!"
28
		wait 2 minutes
29
		enable pvp #DUN DUN DUN
30-
		on death of player: 
30+
on death: # EDITED THIS PART - LILAZNNIGHT
31-
			set {hg.%player%.hasjoined} to 1 #That player died.
31+
	victim is a player
32-
			add -1 to {hg.game.playersinworld} #Updates variables
32+
	set {hg.%victim%.hasjoined} to 1 #That player died.
33-
			add -1 to {hg.current.peoplejoined}
33+
	add -1 to {hg.game.playersinworld} #Updates variables
34-
			create explosion of force 4 at player #Cannonfire, mwahaha
34+
	add -1 to {hg.current.peoplejoined}
35-
			kick the player on account of "You Died!" #I know, kinda cruel.
35+
	create explosion of force 4 at player #Cannonfire, mwahaha
36-
			if {hg.game.playersinworld} is less than 2: #Checks for a winner
36+
	kick the victim on account of "You Died!" #I know, kinda cruel.
37-
				broadcast "We have a winner for the Hunger Games!"
37+
	if {hg.game.playersinworld} is less than 2: #Not sure if this really worked
38-
				loop players:
38+
		broadcast "We have a winner for the Hunger Games!"
39-
					if {hg.%player%.hasjoined} is less than 1: #WINNER!
39+
		loop players: # Fixed some stuffs here on.
40-
						message "You won!"
40+
			if {hg.%player%.hasjoined} is equal to 0: #WINNER!
41-
						give 2 gold ingots to the player #reward
41+
				message "You won!" to the player
42-
					else:
42+
				give 2 gold ingots to the player #reward
43-
						clear the player's inventory #VERY cruel.
43+
			else:
44-
		loop players:
44+
				clear the inventory of all players#VERY cruel.
45
			wait 2 ticks
46
			set {hg.%player%.hasjoined} to 1
47
		set {hg.current.peoplejoined} to 0
48
		set {hg.game.playersinworld} to 0
49
		broadcast "Game over. If you didn't win, better luck next time."
50
command /join:
51
	executable by: players
52
	trigger:
53
		if {hg.game.open} is more than 0: #You can only join an existiing game!
54
			message "There isn't a Hunger Games going on!"
55
			exit
56
		message "You just joined the Hunger Games!"
57
		set {hg.%player%.hasjoined} to 0 #May the odds be ever in your favor.
58
		add 1 to {hg.game.playersinworld}