×

Langue

Fermer
Atelier 801
  • Forums
  • Dev Tracker
  • Connexion
    • English Français
      Português do Brasil Español
      Türkçe Polski
      Magyar Română
      العربية Skandinavisk
      Nederlands Deutsch
      Bahasa Indonesia Русский
      中文 Filipino
      Lietuvių kalba 日本語
      Suomi עברית
      Italiano Česky
      Hrvatski Slovensky
      Български Latviešu
      Estonian
  • Langue
  • Forums
  • /
  • Transformice
  • /
  • Archives
  • /
  • [REQUEST] DEATHMATCH LUA CODE
[REQUEST] DEATHMATCH LUA CODE
Zefish
« Citoyen »
1534631760000
    • Zefish#0000
    • Profil
    • Derniers messages
    • Tribu
#1
  0
Version 1.1.4 by THEWAV if possible or current CONTEST module build.

Hey all I was curious about the deathmatch module and I would like to try and edit Thewav's deathmatch for personal use.

Anyway if you have any other code please share it if you have the permission and don't forget to credit the author. You can drop any code here even if there are already answers. Any code would be useful to me.



Thanks !
Bolodefchoco
« Sénateur »
1534791540000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2
  3
Thewav is not the owner of deathmatch and I doubt they'll share it :P

You should contact the owner through private message.
Puffie
« Citoyen »
1534806360000
    • Puffie#4948
    • Profil
    • Derniers messages
    • Tribu
#3
  0
new owner
Yionutz#0000
i think
Makinit
« Citoyen »
1534842420000
    • Makinit#0095
    • Profil
    • Derniers messages
    • Tribu
#4
  1
This is the the code of the contest module. Removing the data and tournament functionality should leave you with a simple and decent deathmatch implementation.
Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
local translation = {
en = {
welcome = "<J>Welcome to the international deathmatch tournament! ",
wrongRoom = "<J>Use \"/room *#contest\" to join one of the contest rooms. ",
info = "For more information see http://atelier801.com/topic?f=6&t=787088",
help = "<J>Duck or press space to shoot cannon balls. Change your offset using the \"!off x y\" command. ",
offsetChanged = "Your offset will be changed at the beginning of the next round.",
offsetError = "<R>Something went wrong, check your command.",
-- banned = "<R>You are banned. Reason: ",
banned = "<R>You are banned.",
qualified = "<J>Congratulations, you are qualified for the semi finals! Please leave the contest rooms to make space for the other players.",
survivor = "<J>Well done, you get one point for surviving!",
winner = "<J>Well done, you get three points for winning!",
starting = "The match begins next round!",
firstRound = "This is the first round, good luck!",
breakBegin = "There will now be a break of five minutes.",
breakEnd = "The match resumes now!",
lastRound = "This is the last round!",
ending = "Thank you all for playing. Keep an eye on the forums for the results!",
semi = "<R>To play your match go to /room *#contest",
},
nl = {
welcome = "<J>Welkom bij het internationale deathmatchtoernooi! ",
wrongRoom = "<J>Gebruik \"/kamer *#contest\" om in één van de wedstrijdkamers te komen. ",
info = "Voor meer informatie zie http://atelier801.com/topic?f=6&t=787085",
help = "<J>Buk of druk op spatie om kanonskogels te schieten. Verander je offset met behulp van het commando \"!off x y\". ",
offsetChanged = "Je offset zal aan het begin van de volgende ronde aangepast worden.",
offsetError = "<R>Er ging iets mis, controleer je commando.",
-- banned = "<R>Je bent verbannen. Reden: ",
banned = "<R>Je bent verbannen.",
qualified = "<J>Gefeliciteerd, je bent door naar de halve finale! Verlaat alsjeblieft de wedstrijdkamers om ruimte te maken voor andere spelers.",
survivor = "<J>Goed gedaan, je krijgt één punt voor het overleven!",
winner = "<J>Goed gedaan, je krijgt drie punten voor het winnen!",
starting = "De wedstrijd begint de volgende ronde!",
firstRound = "Dit is de eerste ronde, succes!",
breakBegin = "Er volgt nu een pauze van vijf minuten.",
breakEnd = "De wedstrijd gaat nu weer verder!",
lastRound = "Dit is de laatste ronde!",
ending = "Allemaal bedankt voor het spelen. Houd het forum in de gaten voor de resultaten!",
},
br = {
welcome = "<J>Bem vindo ao Torneio Internacional de Deathmatch! ",
wrongRoom = "<J>Use \"/sala *#contest\" para se juntar a uma das salas do torneio. ",
info = "Para mais informações veja o tópico: http://atelier801.com/topic?f=6&t=787096",
help = "<J>Se abaixe ou aperte barra de espaço para atirar. Mude as coordenadas (offset) do cannon usando o comando \"!off x y\". ",
offsetChanged = "As coordenadas do cannon serão modificadas no inicio do próximo mapa.",
offsetError = "<R>Alguma coisa deu errado, verifique se enviou o comando do jeito certo.",
-- banned = "<R>Você foi banido. Motivo: ",
banned = "<R>Você foi banido.",
qualified = "<J>Parabéns, você foi classificado para as semi finais! Por favor saia das salas do torneio para que outros jogadores tenham a oportunidade de participar.",
survivor = "<J>Bom trabalho, você ganhou um ponto por sobreviver!",
winner = "<J>Bom trabalho, você ganhou três pontos por vencer!",
starting = "A partida começa no próximo round!",
firstRound = "Esse é o primeiro round, boa sorte!",
breakBegin = "Intervalo de 5 minutos vai começar.",
breakEnd = "Intervalo acabou. A partida vai continuar agora!",
lastRound = "Esse é o último round!",
ending = "Obrigado por jogar. Fique de olho no tópico do fórum para saber os resultados!",
},
es = {
welcome = "<J>Bienvenido al Torneo Internacional de Deathmatch! ",
wrongRoom = "<J>Usa \"/sala *#contest\" para entrar a una de las salas del torneo. ",
info = "Para más información visita: http://atelier801.com/topic?f=6&t=787112",
help = "<J>Agáchate o pulsa espacio para lanzar cañones. Cambia la coordenadas (offset) del cañón usando el comando \"!off x y\". ",
offsetChanged = "Tus coordenadas serán cambiadas cuando comience el próximo mapa.",
offsetError = "<R>Algo falló, por favor revisa el comando introducido.",
-- banned = "<R>Has sido baneado. Razon: ",
banned = "<R>Has sido baneado.",
qualified = "<J>Felicitaciones, usted a calificado para las semifinales! Por favor abandone las salas contest para dejar espacio a los demás jugadores.",
survivor = "<J>¡Buen trabajo, has ganado un punto por sobrevivir!",
winner = "<J>¡Buen trabajo, has ganado tres puntos por ganar!",
starting = "La partida comenzará en la proxima ronda!",
firstRound = "¡Esta es la primera ronda, buena suerte!",
breakBegin = "Ahora comienza un descanso de 5 minutos.",
breakEnd = "¡La partida se reanuda ya!",
lastRound = "¡Esta es la ultima ronda!",
ending = "Gracias por jugar. Echa un vistazo al foro para ver los resultados!",
},
tr = {
welcome = "<J>Uluslararası Deathmatch Turnuvası'na hoşgeldiniz! ",
wrongRoom = "<J>Turnuva odalarından birine katılmak için \"/room *#contest\" komutunu kullanın. ",
info = "Daha fazla bilgi için http://atelier801.com/topic?f=6&t=787083 adresini ziyaret edebilirsiniz.",
help = "<J>Gülleleri atmak için \"eğilme\" ya da \"boşluk\" tuşlarını kullanabilir, koordinatları (offset) \"!off x y\" komutlarıyla değiştirebilirsiniz. ",
offsetChanged = "Koordinatlarınız yeni turun başlamasıyla birlikte değiştirilecektir.",
offsetError = "<R>Bir yerde hata yaptınız, girdiğiniz komutu kontrol ediniz.",
-- banned = "<R>Turnuvadan uzaklaştırdınız. Sebep: ",
banned = "<R>Turnuvadan uzaklaştırdınız.",
qualified = "<J>Tebrikler, yarı finallerde yarışmaya hak kazandınız! Lütfen yarışma odasından ayrılarak diğer yarışmacılara yer açınız.",
survivor = "<J>Tebrikler, hayatta kaldığınız için bir puan kazandınız!",
winner = "<J>Tebrikler, turu kazandığınız için üç puan aldınız!",
starting = "Maç önümüzdeki turda başlayacak!",
firstRound = "İlk tur başladı, herkese bol şans!",
breakBegin = "Bir dahaki tur başlayana kadar beş dakika ara veriyoruz.",
breakEnd = "Maç devam ediyor!",
lastRound = "Bu en son tur!",
ending = "Katıldığınız için hepinize teşekkür ederiz, sonuçlar için forumu takip etmeyi unutmayın!",
},
fr = {
welcome = "<J>Bienvenue au tournoi international de deathmatch ! ",
wrongRoom = "<J>Entrez \"/salon *#contest\" pour rejoindre l'un des salons du tournoi. ",
info = "Pour plus d'informations, allez sur http://atelier801.com/topic?f=6&t=787082",
help = "<J>Baissez-vous ou appuyez sur espace pour envoyer des boulets. Changez votre offset en tapant la commande \"!off x y\". ",
offsetChanged = "Votre offset sera changé dès le début du prochain tour.",
offsetError = "<R>Une erreur est survenue, vérifiez votre commande.",
-- banned = "<R>Vous êtes banni. Raison : ",
banned = "<R>Vous êtes banni.",
qualified = "<J>Félicitations, vous êtes qualifiés pour les demi-finales! S'il vous plaît, quittez les chambres du concours à faire de la place pour les autres joueurs.",
survivor = "<J>Bien joué, vous gagnez un point pour avoir survécu !",
winner = "<J>Bien joué, vous gagnez trois points pour votre victoire !",
starting = "Le match commencera au prochain tour !",
firstRound = "Le premier tour commence, bonne chance !",
breakBegin = "Une pause de 5 minutes va prendre place.",
breakEnd = "Le match va maintenant reprendre !",
lastRound = "Ceci est le dernier tour !",
ending = "Merci à tous pour avoir joué. Gardez un oeil sur le forum pour les résultats !",
},
pl = {
welcome = "<J>Witaj w międzynarodowym turnieju deathmatch! ",
wrongRoom = "<J>Użyj \"/room *#contest\" by dołączyć do jednego z pokojów konkursowych. ",
info = "Więcej informacji znajdziesz pod adresem http://atelier801.com/topic?f=6&t=787105",
help = "<J>Aby strzelać wciśnij spację lub kucnij. Możesz zmienić pozycję kuli (offset) używając komendy \"!off x y\". ",
offsetChanged = "Pozycja kuli (offset) zostanie zmieniona na początku następnej rundy.",
offsetError = "<R>Coś poszło nie tak, sprawdź swoją komendę.",
-- banned = "<R>Zostałeś zbanowany. Powód: ",
banned = "<R>Zostałeś zbanowany.",
qualified = "<J>Gratulacje, zakwalifikowałeś/aś się do półfinałów! Opuść proszę pokoje konkursowe aby zrobić miejsce dla innych graczy.",
survivor = "<J>Dobra robota, otrzymujesz jeden punkt za przetrwanie!",
winner = "<J>Dobra robota, otrzymujesz trzy punkty za wygraną!",
starting = "Mecz rozpocznie się w następnej rundzie!",
firstRound = "Pierwsza runda - powodzenia!",
breakBegin = "Czas na pięciominutową przerwę.",
breakEnd = "Koniec przerwy - wznawiamy mecz!",
lastRound = "Ostatnia runda!",
ending = "Dziękujemy wszystkim za grę. Wyniki pojawią się wkrótce na forum!",
},
ro = {
welcome = "<J>Bun venit la campionatul internațional de deathmatch! ",
wrongRoom = "<J>Scrie \"/sala *#contest\" pentru a intra într-una din sălile în care se desfășoară concursul. ",
info = "Pentru mai multe informații, vizitează http://atelier801.com/topic?f=6&t=787150",
help = "<J>Lasă-te în jos sau apasă tasta spațiu pentru a trage cu tunuri. Schimbă coordonatele/setările tunurilor tale folosind comanda \"!off x y\". ",
offsetChanged = "Noile coordonate vor intra în vigoare începând cu runda următoare.",
offsetError = "<R>Ceva nu este în regulă, verifică-ți din nou comanda.",
-- banned = "<R>Îți este interzis să te alături campionatului. Motiv: ",
banned = "<R>Îți este interzis să te alături campionatului.",
qualified = "<J>Felicitări, te-ai calificat în semi-finală! Te rog să părăsești sala concursului pentru ca ceilalți jucători să aibă loc de asemenea.",
survivor = "<J>Bravo, primești un punct pentru că ai supraviețuit!",
winner = "<J>Bravo, primești 3 puncte pentru că ești singurul supraviețuitor!",
starting = "Meciul începe runda următoare!",
firstRound = "Aceasta este prima rundă, mult succes!",
breakBegin = "Acum va fi o pauză de 5 minute.",
breakEnd = "Meciul reîncepe acum!",
lastRound = "Aceasta este ultima rundă!",
ending = "Mulțumim tuturor pentru participare. Nu uita să tragi o privire pe forum pentru a afla rezultatele!",
},
de = {
welcome = "<J>Willkommen bei dem internationalen Deathmatch-Turnier! ",
wrongRoom = "<J>Schreibe \"/zimmer *#contest\", um einen der Räume dieses Wettbewerbs beizutreten. ",
info = "Für weitere Informationen, siehe hier: http://atelier801.com/topic?f=6&t=787087",
help = "<J>Ducke dich oder drücke die Leertaste, um Kanonenkugeln zu schießen. Ändere deine Einstellungen mithilfe des Befehls \"!off x y\". ",
offsetChanged = "Deine Einstellungen werden zum Beginn der nächsten Runde geändert.",
offsetError = "<R>Ein Fehler ist aufgetreten, überprüfe deine Eingabe.",
-- banned = "<R>Du bist gebannt. Grund: ",
banned = "<R>Du bist gebannt.",
qualified = "<J>Congratulations, you are qualified for the semi finals! Please leave the contest rooms to make space for the other players.",
survivor = "<J>Gut gemacht! Du bekommst einen Punkt, weil du überlebt hast!",
winner = "<J>Gut gemacht! Du bekommst drei Punkte für deinen Sieg!",
starting = "Das Spiel beginnt ab der nächsten Runde!",
firstRound = "Das ist die erste Runde, viel Glück!",
breakBegin = "Fünf Minuten Pause.",
breakEnd = "Das Spiel geht jetzt weiter!",
lastRound = "Das ist die letzte Runde!",
ending = "Vielen Dank an alle für das Spielen. Beobachte die Foren, um die Ergebnisse einzusehen!",
},
cn = {
welcome = "<J>Welcome to the international deathmatch tournament! ",
wrongRoom = "<J>Use \"/room *#contest\" to join one of the contest rooms. ",
info = "For more information see http://atelier801.com/topic?f=5&t=784980",
help = "<J>Duck or press space to shoot cannon balls. Change your offset using the \"!off x y\" command. ",
offsetChanged = "Your offset will be changed at the beginning of the next round.",
offsetError = "<R>Something went wrong, check your command.",
-- banned = "<R>You are banned. Reason: ",
banned = "<R>You are banned.",
qualified = "<J>Congratulations, you are qualified for the semi finals! Please leave the contest rooms to make space for the other players.",
survivor = "<J>Well done, you get one point for surviving!",
winner = "<J>Well done, you get three points for winning!",
starting = "The match begins next round!",
firstRound = "This is the first round, good luck!",
breakBegin = "There will now be a break of five minutes.",
breakEnd = "The match resumes now!",
lastRound = "This is the last round!",
ending = "Thank you all for playing. Keep an eye on the forums for the results!",
},
ph = {
welcome = "<J>Maligayang pagdating sa internasyonal na paligsahan sa deathmatch! ",
wrongRoom = "<J>Gumamit ng \"/silid *#contest\" upang makasali sa isa sa mga silid ng paligsahan. ",
info = "Para sa karagdagang impormasyon pumunta sa http://atelier801.com//topic?f=6&t=787383",
help = "<J>Yuko o pindutin ang space upang bumato ng kanyong bola. Baguhin ang iyong offset gamit ang \"!off x y\" command. ",
offsetChanged = "Ang iyong offset ay magbabago sa simula ng susunod na round.",
offsetError = "<R>May maling nangyari, suriin ang iyong command.",
-- banned = "<R>Ikaw ay napagbawalang maglaro. Dahilan: ",
banned = "<R>Ikaw ay napagbawalang maglaro.",
qualified = "<J>Congratulations, you are qualified for the semi finals! Please leave the contest rooms to make space for the other players.",
survivor = "<J>Magaling, ikaw ay makakakuha ng isang punto dahil ikaw ay nakaligtas!",
winner = "<J>Magaling, ikaw ay makakakuha ng tatlong puntos sa pagkapanalo!",
starting = "Magsisimula ang laban sa susunod na round!",
firstRound = "Ito ang unang round, galingan mo!",
breakBegin = "Magkakaroon ng paghinga ng limang minuto.",
breakEnd = "Magpapatuloy ang laban ngayon!",
lastRound = "Ito ang huling round!",
ending = "Salamat sa lahat ng manlalaro. Pagmasdan ang forums para sa mga resulta!",
},

}

tfm.exec.disableAutoNewGame(true)
tfm.exec.disableAutoShaman(true)
tfm.exec.disableAutoScore(true)
tfm.exec.disableAutoTimeLeft(true)

for lang, t in pairs(translation) do
t.wrongRoom = t.wrongRoom .. t.info
t.help = t.help
t.welcome = t.welcome .. t.help
end

local admins = {Makinit = true}
local allowed = {}

local keys = {space = 32, left = 0, right = 2, down = 3}
local settings = {
offx = -2,
offy = 8,
offlimit = 25,
cooldown = 1500,
despawnTicks = 3,
leftKeys = {[keys.left] = true},
rightKeys = {[keys.right] = true},
fireKeys = {[keys.space] = true, [keys.down] = true},
dataBot = "Cfmbot",
dataInterval = 5000,
contestRoom = false,
cannon = 17,
maxPlayers = 20,
breakRound = {[10] = true, [20] = true},
breakTime = 300,
breakMap = "@5663774",
endRound = {[20] = true},
maxScore = 5,
}



local maps = {5017354,1348152,5014291,4884688,4486069,3661362,4795468,3899992,4788935,4773530,4741121,4741135,4741162,4741180,4741187,4741210,4741230,4741240,4733964,4734030,4734088,4734142,4734196,541917,541928,541943,559634,559644,589708,589736,589800,754380,770600,770656,772172,775664,901062,901411,910078,1252043,1252299,869836,1920957,1186244,1297154,4131862,3577308,3425866,1633277,2262150,1312933,1958694,2050466,1525751,4411127,1825269,1354040,1830342,1745896,1874823,1351237,2055551,1681719,1357994,965024,2060060,2105100,1459902,2174353,1531402,1643446,2232342,1975056,3798599,1738601,912118,1623188,1665413,1408124,2173804,2336509,1700322,1533678,1312411,2186198,2218853,4569940,2867433,1870360,1659906,3271109,1280342,1897390,4462420,1563534,2169886,2006617,1972275,1897960,3228893,1675013,1441370,1790994,3532350,1284861,1339474,1613092,4462440,1757227,2119800,1343986,1705433,655436,2174414,1633374,1648013,2022973,2050554,1582146,1882226,1677858,1360889,4469762,1279258,2068587,3210915,1794409,1392993,2020179,2186266,1910396,1456622,1587241,1427349,2135605,4388732,2024135,1900275,1953760,2173893,1953765,2119852,2336044,1283234,1766854,1922239,1566991,3827437,1738707,1596270,3326933,1273114,1722389,2633322,1416119,2085529,1277062,1686927,1847383,2125502,2315803,2024170,1699880,870022,1846255,1540557,2221226,3387205,3242517,1542824,1985905,4482813,3377082,2168323,1910468,2386206,873428,2140740,4392183,1559731,4383742,1997751,2130621,1979178,1393097,1312589,1370578,1960602,1450527,1967362,1891359,1298521,1971306,2394684,1888549,2226913,2135145,1905437,1757368,4374762,2103061,3654127,2614830,1688696,2222981,1997222,2181323,1768083,2097440,4000943,1852537,1969079,1561467,2155997,1897581,1318248,1583429,4446275,2183590,1884075,2135175,1569365,2124484,3734665,3274133,2061994,2217944,4550458,1362753,1585138,1997258,2009648,4464328,4383258,1196679,1642575,3192515,1741100,1737163,1901565,2417838,2130154,1829514,1583484,1988845,2242196,1686516,1389255,1292983,1881322,4381605,1888080,1624034,1276664,1288489,1558167,1545219,2195485,1424739,1407849,1627981,1971973,1980988,3242667,2004074,1354375,1296949,1740596,1626308,3219038,4376567,1349878,1971432,1286824,1978755,1967497,1314419,1314982,1426457,1900505,4428376,1846461,1675316,3237641,1967512,1943308,1997920,2117839,3610351,1951195,3654275,1749647,2184286,1616785,2203433,1829042,1622985,1986685,1700119,1879154,1826795,1533474,1966987,3497786,1766564,1280135,2184877,1616246,1057753,1085344,1646093,1646094,2090302,1443416,1632017,2324513,1407949,1993472,4381711,1255944,3485425,2040205,4419442,4464477,1929300,1840913,1539709,1761531,1311136,2088076,1995746,3255179,1817842,1826851,1888783,1531279,3364971,2787894,1708065,1682014,2152835,4589495,1362386,1313969,2059382,1312845,1255983,1420943,1890487,2147778,1531295,2200140,1910196,1737915,1873040,2068396,1824622,1879801,1817873,1338762,1579164,1872490,4386849,644588,1666996,1531316,1727243,2054347,1531320,3581766,2222125,1408028,623770,1901780,1985670,1689533,2005379,1951331,3479878,1974417,3282267,1293189,1985678,1633242,2218760,1287556,1951332,1308378,1667582,1633251,2367406,2867351,3792361,1904053,4462312,3598126}
local matchMaps = {}

local players = {}
local text = {}
local alive = {}
local aliveCount = 0
local startCount = 0
local startTicks = 0
local rounds = {}
local roundEnded = true
local roundStarted = false
local starting = false
local counting = false
local paused = false
local ending = false
local objects = {}
local log = ""

function main()
system.loadFile(settings.file)
for i = 1, settings.despawnTicks do
objects[i] = {}
end

command.setHandler("off", doOffset);
command.setHandler("offset", doOffset);
command.setHandler("help", doHelp);
command.setHandler("info", doHelp);
command.setHandler("pls", doHelp);
command.setHandler("start", doStart);
command.setHandler("duel", doDuel);
command.setHandler("stop", doStop);
command.setHandler("score", doScore);
command.setHandler("reset", doReset);
command.setHandler("skip", doSkip);
command.setHandler("a", doAnnounce, true);

tfm.exec.disableAfkDeath(false)
--tfm.exec.setRoomMaxPlayers(settings.maxPlayers)

for name in pairs(tfm.get.room.playerList) do
eventNewPlayer(name)
end
newGame()
end

function eventFileLoaded(name, data)
log = data
end

function saveLog()
--system.saveFile(log, settings.file)
--print(log)
end

function eventPlayerDataLoaded(name, data)
if name == settings.dataBot then
if data ~= "" then
local _, _, time, player, command = string.find(data, "^(%d+) (%w+) (.*)$")
if not tonumber(time) or os.time() > tonumber(time) + settings.dataInterval then
system.savePlayerData(settings.dataBot, "")
else
eventChatCommand(player, command)
end
end
else
local player = players[name]
local args = string.split(data)
if args[1] and args[2] then
player.offx = tonumber(args[1]) or settings.offx
player.offy = tonumber(args[2]) or settings.offy
end
player.status = args[3] or ""
if player.status == "ban" then
banned[name] = true
elseif player.status == "admin" then
admins[name] = true
end
end
end

function eventKeyboard(name, key, down, x, y)
if down and alive[name] then
local player = players[name]
if player then
if settings.leftKeys[key] then
player.direction = false
elseif settings.rightKeys[key] then
player.direction = true
elseif settings.fireKeys[key] and roundStarted then
local now = os.time()
if player.spawn < now - settings.cooldown then
if y < 0 then
player.offscreen = player.offscreen + 1
else
player.offscreen = 0
end

if player.offscreen < 3 then
player.spawn = now
local direction = player.direction and 1 or -1
table.insert(objects[1], tfm.exec.addShamanObject(settings.cannon, x + player.offx * direction, y + player.offy, 90 * direction))
end
end
end
end
end
end

function eventLoop(passed, left)
if left <= 0 then
newGame()
elseif not roundStarted then
startTicks = startTicks + 1
if startTicks >= 6 and startTicks < 12 then
ui.updateTextArea(0, "<p align='center'><font size='64'><b>" .. (6 - math.floor(startTicks/2)) .. "</b></font></p>")
elseif startTicks == 12 then
roundStarted = true
startTicks = -1
ui.updateTextArea(0, "<p align='center'><font size='48'><b>GO</b></font></p>")
end
elseif startTicks == -1 then
ui.removeTextArea(0)
startTicks = 0
else
local despawn = table.remove(objects, #objects)
table.insert(objects, 1, {})
for i, object in ipairs(despawn) do
tfm.exec.removeObject(object)
end
end
if not roundEnded and left <= 5000 then
roundEnded = true
if paused then
paused = false
defaultAnnounce("breakEnd")
elseif counting then
local names = {}
for name in pairs(alive) do
table.insert(names, name)
end
table.insert(rounds, names)
if #names == 1 then
local name = names[1]
local player = players[name]
local score = player.score + 1
player.score = score
player.winner = player.winner + 1
tfm.exec.setPlayerScore(name, score)
tfm.exec.chatMessage(text[name].survivor, name)
if score == settings.maxScore then
defaultAnnounce("ending")
counting = false
end
end
end
end
end

function eventNewGame()
if starting then
defaultAnnounce("firstRound")
starting = false
counting = true
elseif ending then
defaultAnnounce("ending")
ending = false
counting = false
local scores = {}
for name, player in pairs(players) do
if allowed[name] then
table.insert(scores, {name = name, score = player.score, winner = player.winner, survivor = player.survivor})
end
end
local compare = function(arg1, arg2) return (arg1.score > arg2.score or arg1.score == arg2.score and arg1.winner > arg2.winner or arg1.winner == arg2.winner and arg1.survivor > arg2.survivor) end
table.sort(scores, compare)
for i, player in ipairs(scores) do
log = log .. player.name .. "\t" .. player.winner .. "\t" .. player.survivor .. "\t" .. player.score .. "\n"
end
log = log .."\n"
saveLog()
end
if paused then
tfm.exec.setUIShamanName("Round: break")
tfm.exec.setGameTime(settings.breakTime)
elseif counting then
tfm.exec.setUIShamanName("Round: " .. #rounds + 1)
else
tfm.exec.setUIShamanName("Round: training")
end
ui.addTextArea(0, "", nil, 350, 300, 100, nil, nil, nil, 0, true)
startTicks = 0
roundEnded = false
roundStarted = false
alive = {}
aliveCount = 0
for name in pairs(tfm.get.room.playerList) do
if not allowed[name] and counting then
tfm.exec.killPlayer(name)
tfm.exec.setPlayerScore(name, -1)
else
alive[name] = true
aliveCount = aliveCount + 1
local player = players[name]
if player and player.newoffx and player.newoffy then
player.offx = player.newoffx
player.offy = player.newoffy
player.newoffx = nil
player.newoffy = nil
end
end
end
startCount = aliveCount
end

function newGame()
if paused then
tfm.exec.newGame(settings.breakMap)
elseif counting or starting then
tfm.exec.newGame(matchMaps[#rounds + 1] or maps[math.random(#maps)])
else
tfm.exec.newGame(maps[math.random(#maps)])
end
end

function eventPlayerDied(name)
if not roundEnded and not paused then
if alive[name] then
alive[name] = nil
aliveCount = aliveCount - 1
end
if aliveCount == 1 then
tfm.exec.setGameTime(10)
elseif aliveCount < 1 then
tfm.exec.setGameTime(5)
end
end
end

function eventNewPlayer(name)
text[name] = translation[tfm.get.room.playerList[name].community or "en"] or translation.en
tfm.exec.chatMessage(text[name].welcome, name)
if not players[name] then
players[name] = {name = name, score = 0, direction = true, offx = settings.offx, offy = settings.offy, spawn = 0, offscreen = 0, winner = 0, survivor = 0, status = ""}
end
system.loadPlayerData(name)
--if string.sub(name, 1, 1) == "*" then
-- banned[name] = true
--end
if not allowed[name] then
tfm.exec.setPlayerScore(name, -1)
else
tfm.exec.setPlayerScore(name, players[name].score)
end

for key, code in pairs(keys) do
tfm.exec.bindKeyboard(name, code, true, true)
end
end

function formatName(t)
t = string.gsub(t, "%W", "")
return string.upper(string.sub(t, 1, 1)) .. string.lower(string.sub(t, 2, -1))
end

function doOffset(name, x, y)
local player = players[name]
if player then
x, y = tonumber(x), tonumber(y)
if x and y then
local limit = settings.offlimit
player.newoffx = x > limit and limit or x < -limit and -limit or x
player.newoffy = y > limit and limit or y < -limit and -limit or y
tfm.exec.chatMessage(text[name].offsetChanged, name)
save(player)
else
tfm.exec.chatMessage(text[name].offsetError, name)
end
end
end

function save(player)
system.savePlayerData(player.name, (player.newoffx or player.offx) .. " " .. (player.newoffy or player.offy) .. " " .. (player.status or ""))
end

function doHelp(name)
if text[name] then
tfm.exec.chatMessage(text[name].help, name)
end
end

function doStart(name)
if admins[name] then
defaultAnnounce("starting")
starting = true
rounds = {}
end
end

function doDuel(name, ...)
local arg = {...}
if admins[name] then
allowed = {}
for i, player in ipairs(arg) do
allowed[formatName(player)] = true
end
end
end

function doStop(name)
if admins[name] then
ending = true
newGame()
end
end

function doScore(name, playerName, score)
if admins[name] and playerName then
score = tonumber(score)
player = players[formatName(playerName)]
if player then
player.score = score or 0
tfm.exec.setPlayerScore(playerName, player.score)
end
end
end

function doReset(name)
if admins[name] then
rounds = {}
for name, player in pairs(players) do
player.score = 0
tfm.exec.setPlayerScore(name, 0)
end
newGame()
end
end

function doSkip(name)
if admins[name] then
newGame()
end
end

function doAnnounce(name, message)
if admins[name] then
tfm.exec.chatMessage("<ROSE> [~Contest] " .. message)
end
end

function defaultAnnounce(message)
for name in pairs(tfm.get.room.playerList) do
tfm.exec.chatMessage("<ROSE> [~Contest] " .. text[name][message], name)
end
end


function eventChatCommand(name, message)
local _, _, text, args = string.find(message, "^(%w+)")
local _, _, args = string.find(message, "^%w+%s+(.*)$")
if text then
command.handle(text, name, args)
end
end

command = {handlers = {}}

function command.setHandler(text, callback, raw)
text = string.lower(text)
command.handlers[text] = {callback = callback, raw = raw}
system.disableChatCommandDisplay(text, true)
end

function command.handle(text, name, args)
text = string.lower(text)
local handler = command.handlers[text]
if handler then
if handler.raw then
handler.callback(name, args)
else
handler.callback(name, table.unpack(string.split(args or "")))
end
end
end

function string.split(t, s)
local r = {};
for p in string.gmatch(t, "[^" .. (s or "%s") .. "]+") do
table.insert(r, p)
end
return r;
end

-- system unpack is unavailable
function unpack(t, i)
i = i or 1
if t[i] ~= nil then
return t[i], unpack(t, i + 1)
end
end

main()
Batt_mellamy
« Consul »
1534857180000
    • Batt_mellamy#0015
    • Profil
    • Derniers messages
    • Tribu
#5
  0
If you have any other questions related to modules, or any script requests, you can ask questions in the Module FAQ & Documentation, and post script requests in the Script Requests thread.

Thanks!
  • Forums
  • /
  • Transformice
  • /
  • Archives
  • /
  • [REQUEST] DEATHMATCH LUA CODE
© Atelier801 2018

Equipe Conditions Générales d'Utilisation Politique de Confidentialité Contact

Version 1.27