View difference between Paste ID: GXbMZw3g and avLtZcp8
SHOW: | | - or go back to the newest paste.
1
#------------------------------#
2
#                              #
3
#      Villager Defense        #
4-
#          v. 0.0.1            #
4+
#           v. 0.1             #
5-
#        by kukubaczek         #
5+
#      by kukubaczek           #
6
#      dla bukkit.pl           #
7
#                              #
8
#------------------------------#
9
10-
#          Kongiguracja        #
10+
11
#        Kongiguracja          #
12
#------------------------------#
13
14
options:
15-
	graczydorozpoczecia: 1
15+
16
	graczydorozpoczecia: 2
17
18
#------------------------------#
19
#          Variables           #
20
#------------------------------#
21
22
variables:
23
	{VD.fala} = 1
24
	{VD.kasa.%player%} = 0
25
	{VD.gra} = false
26
	{VD.iloscgraczy} = 0
27
28
#------------------------------#
29
#          Dolaczanie          #
30
#------------------------------#
31
32
on join:
33
	set {_allplayers} to number of all players
34
	if {_allplayers} is greater than 9:
35-
	if {VD.gra123} is not set:
35+
		kick player due to "&aZa duzo graczy!"
36
		stop
37
	if {VD.klasa.%player%} is not set:
38-
		set join message to "{@tag} Gracz &a%player% &6dolaczyl do gry &f[%number of {VD.gracze::*}%/12]"
38+
39
		stop
40
	if {VD.klasa.%player%} is not "rycerz" or "lucznik" or "wojownik":
41
		set {VD.klasa.%player%} to "rycerz"
42
		stop
43-
	set quit message to "{@tag} Gracz &a%player% &6wyszedl z gry &f[%number of {VD.gracze::*}%/12]"
43+
	if {VD.gra} is not "true":
44
		teleport player to {VD.tp.lobby}
45
		add player to {VD.gracze::*}
46
		set join message to "{@tag} Gracz &a%player% &6dolaczyl do gry &f[%number of all players%/10]"
47
		clear player's inventory
48
	set {_allplayers} to number of all players * 10
49
	wait 1 tick
50
	loop all players:
51
		if {VD.odlicznie} is not true:
52
			if {VD.gra} is not true:
53
				set boss bar of loop-player to "&5[&a%number of all players%&e/&b10&5]"
54-
		set motd to "&aVillager&bDefense  &eFala: &d%{VD.fala}%  Villagerow: &d%{_villagerowie}%/5"
54+
				set bar volume of loop-player to {_allplayers}
55
				stop
56
		stop
57
58
on quit:
59
	set quit message to "{@tag} Gracz &a%player% &6wyszedl z gry &f[%number of all players%/10]"
60
	remove player from {VD.gracze::*}
61
	stop
62
63
#------------------------------#
64
#        Sklep - lobby         #
65
#------------------------------#
66
67
on ping:
68
	set {_villagerowie} to number of all villagers
69
	if {VD.gra} is true:
70
		set motd to "&aVillager&bDefense  &eFala: &5%{VD.fala}%  &eVillagerow: &d%{_villagerowie}% &eZywych: &d%number of {VD.gracze::*}%"
71
72
	else:
73
		set motd to "&a&lVillager&b&lDefense &e>            &cZbieranie graczy..."
74
75
command /sklepreset:
76
	trigger:
77
		set {VD.sklep.lobby.mieczkamienny.%player%} to "&cnie kupiony!"
78
		stop
79
80
command /lobbysklep [<text>] [<text>] [<player>]:
81
	description: Zakupuje przez gracza wybrany przedmiot.
82
	usage: /lobbysklep <item> <gracz>
83
	permission: VD.lobby.sklep
84
	permission message: Nie masz permisji!
85
	executable by: console
86
	trigger:
87
		if arg 1 is "mieczkamienny":
88
			if {VD.sklep.lobby.mieczkamienny.%arg 2%} is not "&akupiony!":
89
				if arg-player's balance is greater than 2999:
90
					send "{@tag} Wykupiles staly item: &eKamienny Miecz &6za &a3000 &6monet!" to arg 3
91
					set {VD.sklep.lobby.mieczkamienny.%arg 3%} to "&akupiony!"
92
					execute command "eco take %arg 3% 3000"
93
					stop
94
				else:
95
					send "{@tag} Do kupienia tego przedmiotu potrzeba &e3000 &6kasy!" to arg 3
96
					stop
97
			else:
98
				send "{@tag} Juz wykupiles ten przedmiot!" to arg 3
99
100
on rightclick on zombie:
101
	if name of entity is "&eRycerz":
102
		if {VD.klasa.%player%} is not "rycerz":
103
			set {VD.klasa.%player%} to "rycerz"
104
			send "{@tag} Wybrales klase &eRycerz&6!"
105
			send "&eSet:&a Zelazna klata"
106
			send "&eMiecz:&a Drewniany"
107
			stop
108
		else:
109
			send "{@tag} &eRycerz&6 juz jest twoja klasa!"
110
			stop
111
	if name of entity is "&eWojownik":
112
		if {VD.klasa.%player%} is not "wojownik":
113
			set {VD.klasa.%player%} to "wojownik"
114
			send "{@tag} Wybrales klase &eWojownik&6!"
115
			send "&eSet:&a Skorzana klata"
116
			send "&eMiecz:&a Kamienny"
117
			stop
118
		else:
119
			send "{@tag} &eWojownik&6 juz jest twoja klasa!"
120
			stop
121
	if name of entity is "&eLucznik":
122
		if {VD.klasa.%player%} is not "lucznik":
123
			set {VD.klasa.%player%} to "lucznik"
124
			send "{@tag} Wybrales klase &eLucznik&6!"
125
			send "&eSet:&c BRAK"
126
			send "&eMiecz:&a Drewniany"
127
			send "&eDodatkowo:&a Luk i 16 strzal"
128
			stop
129
		else:
130
			send "{@tag} &eLucznik&6 juz jest twoja klasa!"
131
			stop
132
133
#------------------------------#
134
#         Sklep lobby          #
135
#------------------------------#
136
137
on damage:
138
	if victim is zombie:
139
		if name of victim is set:
140
			cancel event
141
			if name of victim is "&eRycerz":
142
				show "s;14;i;stone sword;n;&bKamienny miecz &a[&63000&a];l;&eStan: ;c;say %attacker%;" with 6 rows named "&a&lItemki stale" to attacker
143
			if name of victim is "&eWojownik":
144
				send "{@tag} Wybrales klase &eWojownik&6!" to attacker
145
			if name of victim is "&eLucznik":
146
				send "{@tag} Wybrales klase &eLucznik&6!" to attacker
147
	if attacker is a zombie:
148-
	if {_gracze} is greater than 0:
148+
149
			cancel event
150
	if attacker is not zombie or player:
151
		if victim is not player:
152
			cancel event
153
	if victim is villager:
154
		if attacker is player:
155
			cancel event
156
			stop
157
158
#------------------------------#
159
#          Start gry           #
160
#------------------------------#
161
162
every 5 seconds:
163
	set {_gracze} to number of all players
164
	if {_gracze} is greater than {@graczydorozpoczecia} - 1:
165
		if {VD.fala} is not set:
166
			if {VD.gra} is false:
167
				if {VD.odlicznie} is false:
168
					loop all players:
169
						set {VD.odlicznie} to true
170
						loop all entities:
171
							if type of loop-entity-1 is creature:
172
								if name of loop-entity-1 is not set:
173
									if type of loop-entity-1 is a zombie:
174
										kill loop-entity-1
175
						create timed bar with text "&aStartowanie gry..." to loop-player for 30 seconds
176
						wait 1 second
177
						send "{@tag} Gra rozpocznie sie za 30 sekund!" to all players
178
						wait 20 seconds
179
						if {_gracze} is greater than {@graczydorozpoczecia} - 1:
180
							send "{@tag} Gra rozpocznie sie za 10 sekund!" to all players
181
						else:
182
							send "{@tag} Za malo graczy!" to all players and console
183
							stop
184
						wait 5 seconds
185
						send "{@tag} Gra rozpocznie sie za 5 sekund!" to all players
186
						if loop-player doesn't have a bar:   		#'
187
							create timed bar with text "&aStartowanie gry..." to loop-player for 5 seconds
188
						wait 2 seconds
189
						send "{@tag} Gra rozpocznie sie za 3 sekundy!" to all players
190
						wait 1 second
191
						send "{@tag} Gra rozpocznie sie za 2 sekundy!" to all players
192
						wait 1 second
193
						send "{@tag} Gra rozpocznie sie za 1 sekunde!" to all players
194
						wait 1 second
195
						clear loop-player's inventory #'
196
						clear {VD.gracze::*}
197
						add all players to {VD.gracze::*}
198
						if {_gracze} is greater than {@graczydorozpoczecia} - 1:
199
							send "{@tag} Gra rozpoczela sie! Nadciaga fala 1!" to all players
200
							kill all villagers
201
							loop all entities:
202
								if type of loop-entity-1 is creature:
203
									if name of loop-entity-1 is not set:
204
										if type of loop-entity-1 is a zombie:
205
											kill loop-entity-1
206
							if {VD.klasa.%loop-player%} is "rycerz":
207
								set chestplate of loop-player to a iron chestplate
208
								give wooden sword of unbreaking 1 to loop-player
209
							if {VD.klasa.%loop-player%} is "wojownik":
210
								set chestplate of loop-player to a leather chestplate
211
								give stone sword to loop-player
212
							if {VD.klasa.%loop-player%} is "lucznik":
213
								give wooden sword to loop-player
214
								give bow of power 5 to loop-player
215
								give 16 arrows to loop-player
216
							heal all players
217
							add 20 to loop-player's hunger bar
218
							loop all entities:
219
								if type of loop-entity-1 is creature:
220
									if name of loop-entity-1 is not set:
221
										if type of loop-entity-1 is a zombie:
222
											kill loop-entity-1
223
							teleport all players to {VD.tp.gra}
224
							spawn 5 villagers at {VD.spawnvillagers}
225
							wait 10 seconds
226
							set {VD.fala} to 1
227
							send "{@tag} 1 fala!" to all players
228
							spawn 2 zombies at {VD.spawnzombie.1}
229
							spawn 2 zombies at {VD.spawnzombie.2}
230
							spawn 2 zombies at {VD.spawnzombie.3}
231
							spawn 2 zombies at {VD.spawnzombie.4}
232
							set {VD.fala} to 1
233
							set {VD.kasa.%loop-player%} to 0
234
							set {VD.gra} to true
235
							set {VD.odlicznie} to false
236
							stop
237
						else:
238
							send "{@tag} &cZa malo graczy!" to all players
239
							set {VD.gra} to false 
240
							clear {VD.fala}
241
							stop
242
243
	if number of {VD.gracze::*} is equal to 0:
244
		if {VD.odlicznie} is false:
245
			if {VD.gra} is true:
246
				heal all players
247
				send "{@tag} Gra zostala przegrana po %{VD.fala}% fali!" to all players
248
				clear {VD.fala}
249
				loop entities:
250
					if type of loop-entity-1 is creature:
251
						if name of loop-entity-1 is not set:
252
							if loop-entity-1 is a zombie:
253
								kill loop-entity-1
254
				loop all players:
255
					set {VD.kasa.%loop-player%} to 0
256
				set {VD.gra} to false
257
				set {VD.odlicznie} to true
258
				wait 10 seconds
259
				set {VD.odlicznie} to false
260
				teleport all players to {VD.tp.lobby}
261
				clear {VD.gracze::*}
262
				stop
263
	set {_villagerowie} to number of all villagers
264
	if {_villagerowie} is 0:
265
		if {VD.odlicznie} is false:
266
			if {VD.gra} is true:
267
				heal all players
268
				send "{@tag} Gra zostala przegrana po %{VD.fala}% fali!" to all players
269
				loop all players:
270
					clear loop-player's inventory
271
				clear {VD.fala}
272
				loop entities:
273
					if type of loop-entity-1 is creature:
274
						if name of loop-entity-1 is not set:
275
							if loop-entity-1 is a zombie:
276
								kill loop-entity-1
277
				loop all players:
278
					set {VD.kasa.%loop-player%} to 0
279
				set {VD.gra} to false
280
				set {VD.odlicznie} to true
281
				wait 10 seconds
282
				set {VD.odlicznie} to false
283
				teleport all players to {VD.tp.lobby}
284
				clear {VD.gracze::*}
285
				stop
286
287
every 5 seconds:
288
	if number of all players is less than {@graczydorozpoczecia} - 1:
289
		if {VD.gra} is false:
290
			if {VD.fala} is not set:
291
				loop entities:
292
					if type of loop-entity-1 is creature:
293
						if name of loop-entity-1 is not set:
294
							if loop-entity-1 is a zombie:
295
								kill loop-entity-1
296
								stop
297
298
299
on xp spawn:
300
	cancel event
301
	stop
302
303
at 17:00:
304
	set time to 7:00
305
	stop
306
307
every 1 second:
308
	set {_allplayers} to number of all players * 10
309
	if {VD.odlicznie} is not true:
310
		if {VD.gra} is not true:
311
			loop all players:
312
				set boss bar of loop-player to "&5[&a%number of all players%&e/&b10&5]"
313
				set bar volume of loop-player to {_allplayers}
314
				stop
315
	loop all players:
316
		if loop-player has emerald:
317
			add 5 to {VD.kasa.%loop-player%}
318
			remove emerald from loop-player's inventory
319
	set {_onlineplayers} to number of all players
320
	if {_onlineplayers} is 0:
321
		clear {VD.gracze::*}
322
		set {VD.gra} to false
323
		clear {VD.fala}
324
		set {VD.odlicznie} to false
325
		stop
326
	loop all players:
327
		if {VD.gra} is true:
328
			set {_zombie} to number of zombies
329
			set {_villagerowie} to number of villagers
330
			set {_gracze} to number of {VD.gracze::*}
331
			display board named "&aVillager&bDefense" to loop-player
332
			make score "&eZombie:" in board of loop-player to {_zombie}
333
			make score "&eVillagerowie:" in board of loop-player to {_villagerowie}
334
			make score "&eFala:" in board of loop-player to {VD.fala}
335
			make score "&eGracze:" in board of loop-player to {_gracze}
336
			make score "&eMonety:" in board of loop-player to {VD.kasa.%loop-player%}
337
			move display of loop-player to "sidebar"
338-
			remove all players from {VD.gracze::*}
338+
339
		else:
340
			set {_money} to loop-player's balance
341
			display board named "&aVillager&bDefense" to loop-player
342
			make score "&eKasa:" in board of loop-player to {_money}
343
			make score "&e" in board of loop-player to 3
344
			make score "&eKit:" in board of loop-player to 2
345
			make score "&e%{VD.klasa.%loop-player%}%" in board of loop-player to 1
346
			move display of loop-player to "sidebar"
347
			stop
348
	stop
349
350
on pick up of emerald:
351
	wait 1 tick
352
	remove emerald from player's inventory
353
	add 5 to {VD.kasa.%player%}
354
	stop
355
356
on death:
357
	if victim is player:
358
		clear drops
359
		wait 1 second
360
		add player to {VD.dednieci::*}
361
		remove victim from {VD.gracze::*}
362
		if {VD.klasa.%player%} is "rycerz":
363
			set chestplate of player to a iron chestplate
364
			give wooden sword to player
365
		if {VD.klasa.%player%} is "wojownik":
366
			set chestplate of player to a leather chestplate
367
			give stone sword to player
368
		if {VD.klasa.%player%} is "lucznik":
369
			give wooden sword to player
370
			give bow of power 5 to player
371
			give 16 arrows to player
372
	if victim is zombie:
373
		if attacker is player:
374
			clear drops
375
			drop 1 emerald at location of victim
376
			stop
377
		else:
378
			clear drops
379
			stop
380
381
on respawn:
382
	wait 1 tick
383
	teleport player to {VD.tp.death}
384
	stop
385
386
#FALE!!
387
388
every 1 minutes:
389
	if {VD.gra} is true:
390
		if {VD.fala} is not empty:
391
			add 1 to {VD.fala}
392
			teleport {VD.dednieci::*} to {VD.tp.gra}
393
			clear {VD.dednieci::*}
394
			clear {VD.gracze::*}
395
			add all players to {VD.gracze::*}
396
			send "{@tag} Rozpoczynam %{VD.fala}% fale!" to all players
397
			loop all players:
398
				apply regeneration 2 to last spawned entity for 8 seconds
399
			if {VD.fala} is 2:
400
				spawn 3 zombies at {VD.spawnzombie.1}
401
				spawn 3 zombies at {VD.spawnzombie.2}
402
				spawn 3 zombies at {VD.spawnzombie.3}
403
				spawn 3 zombies at {VD.spawnzombie.4}
404
			if {VD.fala} is 3:
405
				spawn 4 zombies at {VD.spawnzombie.1}
406
				spawn 4 zombies at {VD.spawnzombie.2}
407
				spawn 4 zombies at {VD.spawnzombie.3}
408
				spawn 4 zombies at {VD.spawnzombie.4}
409
			if {VD.fala} is 4:
410
				spawn 5 zombies at {VD.spawnzombie.1}
411
				spawn 5 zombies at {VD.spawnzombie.2}
412
				spawn 5 zombies at {VD.spawnzombie.3}
413
				spawn 5 zombies at {VD.spawnzombie.4}
414
				stop
415
416
on quit:
417
	remove player from {VD.gracze::*}
418
	stop
419
420
421
on rightclick on villager:
422
	cancel event
423
	stop
424
425
on combust:
426
	cancel event
427
428
#------------------------------#
429
#         Komendy adma         #
430
#------------------------------#
431
432
command /villagerdefense [<text>] [<number>]:
433
	permission: VD.commendy
434
	aliases: /vd
435
	trigger:
436
		if arg 1 is "setlobby":
437
			set {VD.tp.lobby} to location of player
438
			send "{@tag} Ustawiles lobby!"
439
			stop
440
		if arg 1 is "setgra":
441
			set {VD.tp.gra} to location of player
442
			send "{@tag} Ustawiles gre!"
443
			stop
444
		if arg 1 is "setobserwowanie" or "death":
445
			set {VD.tp.death} to location of player
446
			send "{@tag} Ustawiles miejsce spawnu dednietych!"
447
			stop
448
		if arg 1 is "spawnzombie":
449
			if arg 2 is 1:
450
				set {VD.spawnzombie.1} to location of player
451
				send "{@tag} Ustawiles spawn zombie nr. %arg 2%!"
452
				stop
453
			if arg 2 is 2:
454
				set {VD.spawnzombie.2} to location of player
455
				send "{@tag} Ustawiles spawn zombie nr. %arg 2%!"
456
				stop
457
			if arg 2 is 3:
458
				set {VD.spawnzombie.3} to location of player
459
				send "{@tag} Ustawiles spawn zombie nr. %arg 2%!"
460-
		send "%{VD.gra}% %{VD.fala}% %{VD.gracze::*}%"
460+
461
			if arg 2 is 4:
462
				set {VD.spawnzombie.4} to location of player
463
				send "{@tag} Ustawiles spawn zombie nr. %arg 2%!"
464
				stop
465
		if arg 1 is "spawnvillagers" or "spawnvil":
466
			set {VD.spawnvillagers} to location of player
467
			send "{@tag} Ustawiles spawn villagerow!"
468
			stop
469
		if arg 1 is "kit":
470
			if arg 2 is 1:
471
				spawn a zombie
472
				set the name of last spawned entity to "&eRycerz"
473
				set chestplate of last spawned entity to a iron chestplate
474
				set tool of last spawned entity to a wooden sword
475
				apply slowness 100 to last spawned entity for 9999 days
476
				apply regeneration 100 to last spawned entity for 9999 days
477
				stop
478
			if arg 2 is 2:
479
				spawn a zombie
480
				set the name of last spawned entity to "&eWojownik"
481
				set chestplate of last spawned entity to a leather chestplate
482
				set tool of last spawned entity to a stone sword
483
				apply slowness 100 to last spawned entity for 9999 days
484
				apply regeneration 100 to last spawned entity for 9999 days
485
				stop
486
			if arg 2 is 3:
487
				spawn a zombie
488
				set the name of last spawned entity to "&eLucznik"
489
				set tool of last spawned entity to a bow
490
				apply slowness 100 to last spawned entity for 9999 days
491
				apply regeneration 100 to last spawned entity for 9999 days
492
				stop
493
			else:
494
				send "{@tag} Kity: 1-4"
495
				send "1 - rycerz"
496
				send "2 - wojownik"
497
				send "3 - lucznik"
498
		if arg 1 is not set:
499
			send "/vd setlobby or /vd setgra"
500
			stop
501
502
on spawn:
503
	if spawned entity is not zombie and villager:
504
		cancel event
505
		stop
506
507
on break:
508
	player has permission "admin":
509
		stop
510
	else:
511
		cancel event
512
		stop
513
514
command /joinreset:
515
	permission: VD.joinreset
516
	aliases: /jr
517
	trigger:
518
		clear {VD.gracze::*}
519
		stop
520
521
command /startreset:
522
	permission: VD.startreset
523
	trigger:
524
		set {VD.gra} to false
525
		clear {VD.fala}
526
		send "%{VD.gra}% %{VD.fala}%"
527
		stop
528
529
command /startinfo:
530
	permission: VD.startreset
531
	trigger:
532
		send "%{VD.gra}% %{VD.fala}% %{VD.gracze::*}% %{VD.dednieci::*}%"
533
		stop