×

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
  • /
  • DOES ANYONE KNOW THE LEGIT FRANCE DEATHMATCH LUA CODE?
DOES ANYONE KNOW THE LEGIT FRANCE DEATHMATCH LUA CODE?
King_tiablo_xv
« Citoyen »
1500850920000
    • King_tiablo_xv#2918
    • Profil
    • Derniers messages
#1
  0
SO BASICALLY ITS A TEAM DEATHMATCH LUA SCRIPT

IF U KNOW IT TELL MEH TY

http://vignette3.wikia.nocookie.net/transformice/images/5/58/Deathmatch_Leaderboard_Mouse.png/revision/latest?cb=20150903162650
Onkei
« Citoyen »
1500851700000
    • Onkei#0000
    • Profil
    • Derniers messages
    • Tribu
#2
  0
I don't exactly have what you want, but below is a Team DM script I made for my tribe. The commands list contains info on how to activate team mode. Athesdrake also made something similar.


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
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
--[[
[Tutorial] Adding teams to your games by Onkei.
]]

local maps = {5017354, 1348152, 5014291, 4826471, 4884688, 4486069, 3661362, 4795468, 3899992, 4826673, 4788935, 4787956, 4773530, 4741121, 4741135, 4741162, 4741180, 4741187, 4741210, 4741230, 4741240, 4733964, 4734030, 4734088, 4734142, 4734196, 541917, 541928, 541943, 559634, 559644, 589708, 589736, 589800, 4725345, 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, 2221623, 1830342, 1745896, 1874823, 1351237, 2055551, 1681719, 1357994, 965024, 2060060, 2105100, 1459902, 2174353, 1531402, 1643446, 2232342, 1975056, 1757177, 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, 1792773, 2125502, 2315803, 2024170, 1699880, 870022, 1846255, 1540557, 2221226, 3387205, 3242517, 1542824, 3446890, 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, 2145870, 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, 1298164, 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, 1271249, 4462312, 3598126}

local teams = {
Blue = {
playerList = {},
color = 0x2323bf,
score = 0,
},

Red = {
playerList = {},
color = 0xbf2323,
score = 0,
},
}

local admin, host = {Onkei = true, Ehw = true, Tomstoms = true, Pie = true, Ninjafood = true, Elt1abl0 = true}, ""

local keys = {space = 32, left = 37, right = 39, down = 40, a = 65, d = 68, q = 81, s = 83}

local settings = {
ID = 17,
OFF = {X = -2, Y = 8},
COOLDOWN = 1.5,
DESPAWNTICKS = 3,

TILLALLOWSHOOTING = 10,

NOTEAMCOLOR = 0xFFFFFF,

leftKeys = {[keys.left] = true, [keys.a] = true, [keys.q] = true},
rightKeys = {[keys.right] = true, [keys.d] = true},
fireKeys = {[keys.space] = true, [keys.down] = true, [keys.s] = true},
}

local allowShooting = false
local ffa = true
local gameLoaded = false

local changeTime = tfm.exec.setGameTime
local abs, floor, random = math.abs, math.floor, math.random
local setShamanName, setNameColor = ui.setShamanName, tfm.exec.setNameColor
local spawnObject, removeObject = tfm.exec.addShamanObject, tfm.exec.removeObject

local Task, tasks = {}, {}
function Task.new(when, func)
--[[
Task class to manage tined functions.
]]
local self = {}

self.when = (when or 5) * 1000 + os.time()
self.func = func

function self:canHappen(now)
if self.when <= now then
return true
end
return false
end

function self:happen()
self.func()
end

return self
end

local Cannons = {}
function Cannons.new()
--[[
Cannons class to manage a player's cannoning data.
]]
local self = {}

self.id = settings.ID

self.direction = 1
self.cooldown = settings.COOLDOWN
self.lastSpawned = 0
self.off = {
x = settings.OFF.X,
y = settings.OFF.Y,
}

self.offscreen = {
temp = 0,
thisRound = 0,
}

function self:canShoot(y)
if self.lastSpawned > os.time() - self.cooldown * 1000 then
return false
end

if y <= 0 then
if self.offscreen.temp >= 2 or self.offscreen.thisRound >= 30 then
return false
else
self.offscreen.temp = self.offscreen.temp + 1
self.offscreen.thisRound = self.offscreen.thisRound + 1
end
else
self.offscreen.temp = 0
end
return true
end

function self:hasSpawned()
self.lastSpawned = os.time()
end

function self:shoot(x, y)
if self:canShoot(y) then
local id = spawnObject(self.id, x + self.off.x * self.direction, y + self.off.y, 90 * self.direction)
table.insert(tasks, Task.new(settings.DESPAWNTICKS, function() removeObject(id) end))

self:hasSpawned()
end
end

return self
end

local Player, players = {}, {}
function Player.new(n)
--[[
Player class to manage an individual player.
]]
local self = {}

self.n = n
self.cannons = Cannons.new()
self.score = 0
self.spectating = false

function self:changeDirection(newDirection)
self.cannons.direction = newDirection
end

function self:changeOffset(x, y)
if abs(x) <= 25 and abs(y) <= 25 then
self.cannons.off.x = x
self.cannons.off.y = y
end
end

function self:ready()
self.cannons.offscreen = {
temp = 0,
thisRound = 0,
}
self.cannons.spawned = {
temp = 0,
thisRound = 0,
}
end

function self:updateScore()
tfm.exec.setPlayerScore(self.n, self.score, false)
end

function self:won(score)
tfm.exec.giveCheese(self.n)
tfm.exec.playerVictory(self.n)

self.score = self.score + (score or 1)
end

return self
end

function bindKeys(n, bool)
for i, key in pairs(keys) do
system.bindKeyboard(n, key, true, bool)
end
end

function capitalize(word)
return string.upper(word:sub(1, 1)) .. string.lower(word:sub(2));
end

function highestScorer()
local highest = {"Etho", 0}

for n, data in pairs(players) do
if data.score >= highest[2] then
highest[1] = n
highest[2] = data.score
end
end
return highest
end

local tempMaps = {}
function loadMap()
--[[
Loads a new random map and makes sure it doesn't get loaded again
until all the other maps are loaded.
]]
if #tempMaps == 0 then
tempMaps = table.copy(maps)
end

local randomIndex = random(#tempMaps)
local randomMap = tempMaps[randomIndex]
table.remove(tempMaps, randomIndex)

tfm.exec.newGame(randomMap, random(100) > 50)
end

function main()
tfm.exec.disableAutoNewGame(true)
tfm.exec.disableAutoShaman(true)
tfm.exec.disableAutoTimeLeft(true)
tfm.exec.disableAutoScore(true)
tfm.exec.disablePhysicalConsumables(true)

table.foreach(tfm.get.room.playerList, eventNewPlayer)

resetScores() -- Resetting scores of players.
newGame()
end

function manageTeams()
--[[
Assigning team colors to the players' nametags.
]]
for team, data in pairs(teams) do
for i, n in pairs(data.playerList) do
if not players[n].spectating then
setNameColor(n, data.color)
end
end
end
end

function manualTeams()
--[[
Function to display the manual teams selection system.
]]
ui.addTextArea(0, "", nil, -1100, -1300, 3000, 3000, 0xffffff, 0xffffff, 0.2, true)

local numTeams, maxHeight = numOfTeams(), 300
local teamIdCount, eachH, nextY = 1, maxHeight / numTeams, 30

for team, data in pairs(teams) do
--[[
Showing each team's members and changing the y coord of each textArea accordingly.
]]
local members = teamToString(team)

teamIdCount = teamIdCount + 1 -- To prevent the id of each team textArea from overwriting each other.

ui.addTextArea(teamIdCount, "<p align='center'><font size='14'><b><a href='event:join_" .. team .. "'>" .. team .. "</a></b><br><br><font size='10'><n>" .. members, nil, 150, nextY, 500, eachH, 0x324650, data.color, 0.8, true)

nextY = nextY + eachH
end

ui.addTextArea(1, "<p align='center'><font size='18'><a href='event:teamsSelected'>Close", host, 150, 340, 500, 30, 0x324650, 0xe5e5e5, 0.8, true)
end

function map(value, start1, stop1, start2, stop2)
local value2 = ((value - start1) / (stop1 - start1)) * (stop2 - start2) + start2
return value2
end

function newGame()
--[[
Handles the starting of new rounds.
]]

for n, data in pairs(players) do
if not data.spectating then
data:ready()
data:updateScore()
bindKeys(n, true)
end
end

allowShooting = false
loadMap()
end

function numOfTeams()
local numTeams = 0

for team in pairs(teams) do
numTeams = numTeams + 1
end
return numTeams
end

function resetScores(num)
local newScore = num or 0

for team, data in pairs(teams) do
data.score = newScore
end

for n, data in pairs(players) do
data.score = newScore
data:updateScore()
end
end

function randTeams()
--[[
Seperating the room into random teams.
]]
for team, data in pairs(teams) do
data.playerList = {}
end

local playersLeft = {}

for n in pairs(tfm.get.room.playerList) do
table.insert(playersLeft, n)
end

--[[
Making sure all new teams are defined correctly.
]]
for team, data in pairs(teams) do
if not data.color then
teams[team] = nil
end
end

while (#playersLeft > 0) do
local smallestTeam = {playerList = {"Onkei", "Random Guy", "Another Guy", "More Guys", "Johnny Cash"}}
for team, data in pairs(teams) do
if #data.playerList < #smallestTeam.playerList then
smallestTeam = teams[team]
end
end

local randomIndex = random(#playersLeft)
local randomPlayer = playersLeft[randomIndex]
table.insert(smallestTeam.playerList, randomPlayer)
table.remove(playersLeft, randomIndex)
end
end

function table.copy(t1)
--[[
Returning a copy of the table given.
]]
local t2 = {}

for k, v in pairs(t1) do
t2[k] = v
end
return t2
end

function teamToString(team)
--[[
Getting the team members of a team and formatting it into a string.
]]
if not teams[team] then
return
end

team = teams[team]

local members, checked, numMembers = "", 0, #team.playerList

for i, n in pairs(team.playerList) do
members = members .. n
checked = checked + 1

if checked + 1 == numMembers then
members = members .. " and "
elseif checked + 1 < numMembers then
members = members .. ", "
end
end

return members
end

function ui.addBotText(text, n)
ui.addTextArea(100, "<v>[~Soupbot]<n> " .. text, n, 6, 380, nil, 30, 0x324650, 0x89A7F5, 0.7, true)
end

function updateMapBar()
if ffa then
local highest = highestScorer()

setShamanName(highest[1] .. " " .. highest[2])
else
local teamStr, teamsChecked = " ", {}
local numTeams = numOfTeams()

for team, data in pairs(teams) do
table.insert(teamsChecked, team)
teamStr = teamStr .. team .. " " .. data.score

if #teamsChecked + 1 <= numTeams then
teamStr = teamStr .. " - "
end
end

setShamanName(teamStr)
end
end

function eventNewGame()
gameLoaded = true

if not ffa then
manageTeams()
end

updateMapBar()
end

function eventKeyboard(n, key, down, x, y)
if settings.leftKeys[key] then
players[n]:changeDirection(-1)
elseif settings.rightKeys[key] then
players[n]:changeDirection(1)
elseif settings.fireKeys[key] and allowShooting then
players[n].cannons:shoot(x, y)
end
end

function eventLoop(passed, left)
if not gameLoaded then
return
end

local now = os.time()
for i, task in pairs(table.copy(tasks)) do
if task:canHappen(now) then
task:happen()
table.remove(tasks, i)
end
end

if not allowShooting and passed >= 5000 and passed <= settings.TILLALLOWSHOOTING * 1000 then
local tillAllow = floor(settings.TILLALLOWSHOOTING - passed / 1000)

ui.addBotText("You can shoot in " .. tillAllow .. "s..", nil)

if tillAllow <= 0 then
allowShooting = true

ui.addBotText("You can now shoot.", nil)
end
elseif left <= 0 then
local winners = ""

for n, data in pairs(tfm.get.room.playerList) do
if not data.isDead then
winners = winners .. "| " .. n .. " "

players[n]:won(1)
end
end

if ffa and winners ~= "" then
winners = winners .. "|"

ui.addBotText(winners .. " won the last round!", nil)
end

newGame()
end
end

function eventPlayerDied(n)
bindKeys(n, false)

if not gameLoaded then
--[[
To prevent rounds from changing when teams are being selected manually.
]]
return
end

if ffa then
local alive = {}

for n, data in pairs(tfm.get.room.playerList) do
if not data.isDead and not players[n].spectating then
table.insert(alive, n)
end
end

if #alive == 1 then
changeTime(5)
elseif #alive == 0 then
newGame()
end
else
local aliveTeams = {}

for team, data in pairs(teams) do
for i, n in pairs(data.playerList) do
local data = tfm.get.room.playerList[n]
if data and not data.isDead then
table.insert(aliveTeams, team)

break
end
end
end

if #aliveTeams == 1 then
local aliveTeam = teams[aliveTeams[1]]
aliveTeam.score = aliveTeam.score + 1
ui.addBotText("Team | " .. aliveTeams[1] .. " | earned a point from being the last ones surviving!", nil)

changeTime(5)
elseif #aliveTeams == 0 then
newGame()
end
end
end

function eventNewPlayer(n)
if not players[n] then
players[n] = Player.new(n)
eventChatCommand(n, "help")
end

players[n]:updateScore()

if admin[n] then
ui.addBotText("If you want to host a session, please do !host. View commands with !commands.", n)
end
end

function eventColorPicked(id, n, color)
--[[
Finalising the process of making a new team.
Since there's only one host, we do not need to worry about multiple undefined teams.
]]
local newteam = ""

for team, data in pairs(teams) do
if not data.color then
newteam = team
data.color = color

break
end
end
ui.addBotText(newteam .. " team is now available.", nil)
end

function eventTextAreaCallback(id, n, cb)
if cb:sub(1, 4) == "join" then
local team = cb:sub(6)

eventChatCommand(host, team .. " " .. n)
manualTeams()
elseif cb == "teamsSelected" then
--[[
Start a new round with the custom teams.
]]
local startId = 0
local endId = startId + 1 + numOfTeams()

for id = startId, endId do
ui.removeTextArea(id, nil)
end
newGame()
end
end

function eventChatCommand(n, cmd)
local arg = {}
for args in cmd:gmatch("[^%s]+") do
table.insert(arg, args:lower())
end

if admin[n] then
if n == host then
if arg[1] == "teams" and arg[2] then
if arg[2] == "random" then
--[[
Setting random teams.
]]
ffa = false
randTeams()
newGame()
elseif arg[2] == "manual" then
--[[
Setting manual-chosen teams.
]]
gameLoaded = false
ffa = false
manualTeams()
elseif arg[2] == "nil" then
ffa = true
newGame()
end
elseif cmd == "reset" then
resetScores()
elseif (arg[1] == "setscore" or arg[1] == "score") and arg[2] and arg[3] then
--[[
Sets a team or a player's score.
]]
local n = capitalize(arg[2])

if teams[n] then
teams[n].score = tonumber(arg[3])
ui.addBotText("Team " .. n .. "'s score has been set to " .. arg[3], n)
end
if players[n] then
players[n].score = tonumber(arg[3])
players[n]:updateScore()
elseif n == "All" then
resetScores(tonumber(arg[3]))
ui.addBotText("Everyone's score has been set to " .. arg[3], n)
end
updateMapBar()
elseif cmd == "challenge" then
--[[
Readies to the next round for a challenge.
]]
eventChatCommand(n, "reset")
eventChatCommand(n, "map")
elseif arg[1] == "newteam" and arg[2] then
local team = capitalize(arg[2])

if not teams[team] then
teams[team] = {
playerList = {},
score = 0,
}

ui.showColorPicker(0, n, 0, team .. "'s Team Color")
end
elseif teams[capitalize(arg[1])] and arg[2] then
--[[
Allowing a player to join another team.
]]
local team = teams[capitalize(arg[1])]
local n = capitalize(arg[2])

if players[n] then
for oldteam, data in pairs(teams) do
for i, n2 in pairs(data.playerList) do
if n2 == n then
table.remove(data.playerList, i)

break
end
end
end

table.insert(team.playerList, n)
setNameColor(n, team.color)
ui.addBotText(n .. " has joined the " .. capitalize(arg[1]) .. " team.", nil)
end
elseif arg[1] == "noteam" and arg[2] then
--[[
Forcing a player to leave a team.
]]
local n = capitalize(arg[2])

if players[n] then
for team, data in pairs(teams) do
for i, n2 in pairs(data.playerList) do
if n2 == n then
table.remove(data.playerList, i)

break
end
end
end

setNameColor(n, settings.NOTEAMCOLOR)
ui.addBotText(n .. " no longer belongs in any team.", nil)
end
elseif cmd == "unhost" then
host = ""
ui.addBotText(n .. " is no longer the host.", n)
end
end

if cmd == "host" and host == "" then
host = n
ui.addBotText(n .. " is now the host.", n)
elseif cmd == "map" then
newGame()
elseif arg[1] == "time" and arg[2] then
changeTime(tonumber(arg[2]))
elseif arg[1] == "spec" and arg[2] then
--[[
Puts someone on or off to spectator mode.
]]
local n = capitalize(arg[2])

if players[n] then
players[n].spectating = not players[n].spectating
ui.addBotText(n .. "'s spectating mode is now set to " .. tostring(players[n].spectating) .. ".", n)
end
end
end

--[[
Non-admin commands here.
]]
if cmd == "help" or cmd == "info" or cmd == "guide" then
local str =
"Welcome to Souper Deathmatch. This is a rebuilt version of #deathmatch with adjustable teaming options for hosting challenges. Your aim in this game is to be the last person or team standing. You achieve this by killing others by pressing down or spacebar to shoot cannons.<br><br>" ..
"Please do !commands to view a list of commands you can use. They're quite important.<br><br>" ..
"---<br><br>" ..
"<u>Recommended offsetting options;</u><br>" ..
"!off -2 8 | <i>Default offset. To cnj, simply moving forward before spawning is required.</i><br><br>" ..
"!off -25 25 | <i>Offset used by campers. Cannons will spawn just below your arse, so cnjing is assisted heavily. To not cnj, jumping before you spawn is required.</i><br><br>" ..
"!off -15 20 | <i>Onkei's usual offset. Simillar to the -25 25, but cannons will be spawned closer to the mouse, hitting the mouse earlier. This is slightly harder to not cnj with.</i>"

ui.addPopup(1, 0, str, n, 270, 30, 520, true)
elseif arg[1]:sub(1, 3) == "off" and arg[2] and arg[3] then
players[n]:changeOffset(tonumber(arg[2]), tonumber(arg[3]))

local off = players[n].cannons.off
ui.addBotText("Your new offset is now X" .. off.x .. " Y" .. off.y .. ".", n)
elseif cmd == "allteams" then
--[[
Shows all the teams in the game.
]]
local allTeams = ""

for team, data in pairs(teams) do
allTeams = allTeams .. "| " .. team .. " (" .. data.score .. ") "
end
allTeams = allTeams .. "|"

ui.addBotText("Teams available: " .. allTeams, n)
elseif arg[1] == "members" and teams[capitalize(arg[2])] then
--[[
Shows the team members of a team.
]]
local team = capitalize(arg[2])
local members = teamToString(team)

ui.addBotText("Team " .. team .. ": " .. members, n)
elseif capitalize(cmd) == "Mvp" then
local MVP = highestScorer()

ui.addBotText("MVP: " .. MVP[1] .. " (Leading with " .. MVP[2] .. " points)", n)
elseif cmd:sub(1, 7) == "command" or cmd:sub(1, 3) == "cmd" then
local str =
"All commands are listed here.<br><br>" ..
"<u>Host-only commands</u><br>" ..
"!teams random/manual/nil - Enables a team mode e.g. !teams manual<br>" ..
"!reset - Reset everyone's scores<br>" ..
"!setscore [team]/[name]/all [num] - Sets someone's score e.g. !setscore Onkei 9001<br>" ..
"!challenge - Resets everyone's scores and loads a new round<br>" ..
"![team] [name] - Assigns someone to a team e.g. !Blue Onkei<br>" ..
"!noteam [name] - Force someone to leave their team !noteam Onkei<br>" ..
"!unhost - Stops hosting so other admins can host<br><br>" ..
"<u>Admin-only commands</u><br>" ..
"!host - Starts hosting, which grants usage of more commands<br>" ..
"!map - Changes the map<br>" ..
"!time [num] - Changes the time e.g. !time 120<br>" ..
"!spec [name] - Gives a player spectator mode e.g. !spec Onkei<br><br>" ..
"<u>Normal commands</u><br>" ..
"!off [x] [y] - Sets personal cannon coordinates e.g. !off -25 25<br>" ..
"!allteams - Shows all the teams and their scores<br>" ..
"!members [team] - Shows the members of a team e.g. !members Blue<br>" ..
"!MVP - Gets the MVP of the game so far"
ui.addPopup(1, 0, str, n, 270, 30, 520, true)
end
end

main()

Dernière modification le 1500851820000
King_tiablo_xv
« Citoyen »
1500852300000
    • King_tiablo_xv#2918
    • Profil
    • Derniers messages
#3
  0
Onkei a dit :
I don't exactly have what you want, but below is a Team DM script I made for my tribe. The commands list contains info on how to activate team mode. Athesdrake also made something similar.


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
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
--[[
[Tutorial] Adding teams to your games by Onkei.
]]

local maps = {5017354, 1348152, 5014291, 4826471, 4884688, 4486069, 3661362, 4795468, 3899992, 4826673, 4788935, 4787956, 4773530, 4741121, 4741135, 4741162, 4741180, 4741187, 4741210, 4741230, 4741240, 4733964, 4734030, 4734088, 4734142, 4734196, 541917, 541928, 541943, 559634, 559644, 589708, 589736, 589800, 4725345, 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, 2221623, 1830342, 1745896, 1874823, 1351237, 2055551, 1681719, 1357994, 965024, 2060060, 2105100, 1459902, 2174353, 1531402, 1643446, 2232342, 1975056, 1757177, 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, 1792773, 2125502, 2315803, 2024170, 1699880, 870022, 1846255, 1540557, 2221226, 3387205, 3242517, 1542824, 3446890, 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, 2145870, 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, 1298164, 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, 1271249, 4462312, 3598126}

local teams = {
Blue = {
playerList = {},
color = 0x2323bf,
score = 0,
},

Red = {
playerList = {},
color = 0xbf2323,
score = 0,
},
}

local admin, host = {Onkei = true, Ehw = true, Tomstoms = true, Pie = true, Ninjafood = true, Elt1abl0 = true}, ""

local keys = {space = 32, left = 37, right = 39, down = 40, a = 65, d = 68, q = 81, s = 83}

local settings = {
ID = 17,
OFF = {X = -2, Y = 8},
COOLDOWN = 1.5,
DESPAWNTICKS = 3,

TILLALLOWSHOOTING = 10,

NOTEAMCOLOR = 0xFFFFFF,

leftKeys = {[keys.left] = true, [keys.a] = true, [keys.q] = true},
rightKeys = {[keys.right] = true, [keys.d] = true},
fireKeys = {[keys.space] = true, [keys.down] = true, [keys.s] = true},
}

local allowShooting = false
local ffa = true
local gameLoaded = false

local changeTime = tfm.exec.setGameTime
local abs, floor, random = math.abs, math.floor, math.random
local setShamanName, setNameColor = ui.setShamanName, tfm.exec.setNameColor
local spawnObject, removeObject = tfm.exec.addShamanObject, tfm.exec.removeObject

local Task, tasks = {}, {}
function Task.new(when, func)
--[[
Task class to manage tined functions.
]]
local self = {}

self.when = (when or 5) * 1000 + os.time()
self.func = func

function self:canHappen(now)
if self.when <= now then
return true
end
return false
end

function self:happen()
self.func()
end

return self
end

local Cannons = {}
function Cannons.new()
--[[
Cannons class to manage a player's cannoning data.
]]
local self = {}

self.id = settings.ID

self.direction = 1
self.cooldown = settings.COOLDOWN
self.lastSpawned = 0
self.off = {
x = settings.OFF.X,
y = settings.OFF.Y,
}

self.offscreen = {
temp = 0,
thisRound = 0,
}

function self:canShoot(y)
if self.lastSpawned > os.time() - self.cooldown * 1000 then
return false
end

if y <= 0 then
if self.offscreen.temp >= 2 or self.offscreen.thisRound >= 30 then
return false
else
self.offscreen.temp = self.offscreen.temp + 1
self.offscreen.thisRound = self.offscreen.thisRound + 1
end
else
self.offscreen.temp = 0
end
return true
end

function self:hasSpawned()
self.lastSpawned = os.time()
end

function self:shoot(x, y)
if self:canShoot(y) then
local id = spawnObject(self.id, x + self.off.x * self.direction, y + self.off.y, 90 * self.direction)
table.insert(tasks, Task.new(settings.DESPAWNTICKS, function() removeObject(id) end))

self:hasSpawned()
end
end

return self
end

local Player, players = {}, {}
function Player.new(n)
--[[
Player class to manage an individual player.
]]
local self = {}

self.n = n
self.cannons = Cannons.new()
self.score = 0
self.spectating = false

function self:changeDirection(newDirection)
self.cannons.direction = newDirection
end

function self:changeOffset(x, y)
if abs(x) <= 25 and abs(y) <= 25 then
self.cannons.off.x = x
self.cannons.off.y = y
end
end

function self:ready()
self.cannons.offscreen = {
temp = 0,
thisRound = 0,
}
self.cannons.spawned = {
temp = 0,
thisRound = 0,
}
end

function self:updateScore()
tfm.exec.setPlayerScore(self.n, self.score, false)
end

function self:won(score)
tfm.exec.giveCheese(self.n)
tfm.exec.playerVictory(self.n)

self.score = self.score + (score or 1)
end

return self
end

function bindKeys(n, bool)
for i, key in pairs(keys) do
system.bindKeyboard(n, key, true, bool)
end
end

function capitalize(word)
return string.upper(word:sub(1, 1)) .. string.lower(word:sub(2));
end

function highestScorer()
local highest = {"Etho", 0}

for n, data in pairs(players) do
if data.score >= highest[2] then
highest[1] = n
highest[2] = data.score
end
end
return highest
end

local tempMaps = {}
function loadMap()
--[[
Loads a new random map and makes sure it doesn't get loaded again
until all the other maps are loaded.
]]
if #tempMaps == 0 then
tempMaps = table.copy(maps)
end

local randomIndex = random(#tempMaps)
local randomMap = tempMaps[randomIndex]
table.remove(tempMaps, randomIndex)

tfm.exec.newGame(randomMap, random(100) > 50)
end

function main()
tfm.exec.disableAutoNewGame(true)
tfm.exec.disableAutoShaman(true)
tfm.exec.disableAutoTimeLeft(true)
tfm.exec.disableAutoScore(true)
tfm.exec.disablePhysicalConsumables(true)

table.foreach(tfm.get.room.playerList, eventNewPlayer)

resetScores() -- Resetting scores of players.
newGame()
end

function manageTeams()
--[[
Assigning team colors to the players' nametags.
]]
for team, data in pairs(teams) do
for i, n in pairs(data.playerList) do
if not players[n].spectating then
setNameColor(n, data.color)
end
end
end
end

function manualTeams()
--[[
Function to display the manual teams selection system.
]]
ui.addTextArea(0, "", nil, -1100, -1300, 3000, 3000, 0xffffff, 0xffffff, 0.2, true)

local numTeams, maxHeight = numOfTeams(), 300
local teamIdCount, eachH, nextY = 1, maxHeight / numTeams, 30

for team, data in pairs(teams) do
--[[
Showing each team's members and changing the y coord of each textArea accordingly.
]]
local members = teamToString(team)

teamIdCount = teamIdCount + 1 -- To prevent the id of each team textArea from overwriting each other.

ui.addTextArea(teamIdCount, "<p align='center'><font size='14'><b><a href='event:join_" .. team .. "'>" .. team .. "</a></b><br><br><font size='10'><n>" .. members, nil, 150, nextY, 500, eachH, 0x324650, data.color, 0.8, true)

nextY = nextY + eachH
end

ui.addTextArea(1, "<p align='center'><font size='18'><a href='event:teamsSelected'>Close", host, 150, 340, 500, 30, 0x324650, 0xe5e5e5, 0.8, true)
end

function map(value, start1, stop1, start2, stop2)
local value2 = ((value - start1) / (stop1 - start1)) * (stop2 - start2) + start2
return value2
end

function newGame()
--[[
Handles the starting of new rounds.
]]

for n, data in pairs(players) do
if not data.spectating then
data:ready()
data:updateScore()
bindKeys(n, true)
end
end

allowShooting = false
loadMap()
end

function numOfTeams()
local numTeams = 0

for team in pairs(teams) do
numTeams = numTeams + 1
end
return numTeams
end

function resetScores(num)
local newScore = num or 0

for team, data in pairs(teams) do
data.score = newScore
end

for n, data in pairs(players) do
data.score = newScore
data:updateScore()
end
end

function randTeams()
--[[
Seperating the room into random teams.
]]
for team, data in pairs(teams) do
data.playerList = {}
end

local playersLeft = {}

for n in pairs(tfm.get.room.playerList) do
table.insert(playersLeft, n)
end

--[[
Making sure all new teams are defined correctly.
]]
for team, data in pairs(teams) do
if not data.color then
teams[team] = nil
end
end

while (#playersLeft > 0) do
local smallestTeam = {playerList = {"Onkei", "Random Guy", "Another Guy", "More Guys", "Johnny Cash"}}
for team, data in pairs(teams) do
if #data.playerList < #smallestTeam.playerList then
smallestTeam = teams[team]
end
end

local randomIndex = random(#playersLeft)
local randomPlayer = playersLeft[randomIndex]
table.insert(smallestTeam.playerList, randomPlayer)
table.remove(playersLeft, randomIndex)
end
end

function table.copy(t1)
--[[
Returning a copy of the table given.
]]
local t2 = {}

for k, v in pairs(t1) do
t2[k] = v
end
return t2
end

function teamToString(team)
--[[
Getting the team members of a team and formatting it into a string.
]]
if not teams[team] then
return
end

team = teams[team]

local members, checked, numMembers = "", 0, #team.playerList

for i, n in pairs(team.playerList) do
members = members .. n
checked = checked + 1

if checked + 1 == numMembers then
members = members .. " and "
elseif checked + 1 < numMembers then
members = members .. ", "
end
end

return members
end

function ui.addBotText(text, n)
ui.addTextArea(100, "<v>[~Soupbot]<n> " .. text, n, 6, 380, nil, 30, 0x324650, 0x89A7F5, 0.7, true)
end

function updateMapBar()
if ffa then
local highest = highestScorer()

setShamanName(highest[1] .. " " .. highest[2])
else
local teamStr, teamsChecked = " ", {}
local numTeams = numOfTeams()

for team, data in pairs(teams) do
table.insert(teamsChecked, team)
teamStr = teamStr .. team .. " " .. data.score

if #teamsChecked + 1 <= numTeams then
teamStr = teamStr .. " - "
end
end

setShamanName(teamStr)
end
end

function eventNewGame()
gameLoaded = true

if not ffa then
manageTeams()
end

updateMapBar()
end

function eventKeyboard(n, key, down, x, y)
if settings.leftKeys[key] then
players[n]:changeDirection(-1)
elseif settings.rightKeys[key] then
players[n]:changeDirection(1)
elseif settings.fireKeys[key] and allowShooting then
players[n].cannons:shoot(x, y)
end
end

function eventLoop(passed, left)
if not gameLoaded then
return
end

local now = os.time()
for i, task in pairs(table.copy(tasks)) do
if task:canHappen(now) then
task:happen()
table.remove(tasks, i)
end
end

if not allowShooting and passed >= 5000 and passed <= settings.TILLALLOWSHOOTING * 1000 then
local tillAllow = floor(settings.TILLALLOWSHOOTING - passed / 1000)

ui.addBotText("You can shoot in " .. tillAllow .. "s..", nil)

if tillAllow <= 0 then
allowShooting = true

ui.addBotText("You can now shoot.", nil)
end
elseif left <= 0 then
local winners = ""

for n, data in pairs(tfm.get.room.playerList) do
if not data.isDead then
winners = winners .. "| " .. n .. " "

players[n]:won(1)
end
end

if ffa and winners ~= "" then
winners = winners .. "|"

ui.addBotText(winners .. " won the last round!", nil)
end

newGame()
end
end

function eventPlayerDied(n)
bindKeys(n, false)

if not gameLoaded then
--[[
To prevent rounds from changing when teams are being selected manually.
]]
return
end

if ffa then
local alive = {}

for n, data in pairs(tfm.get.room.playerList) do
if not data.isDead and not players[n].spectating then
table.insert(alive, n)
end
end

if #alive == 1 then
changeTime(5)
elseif #alive == 0 then
newGame()
end
else
local aliveTeams = {}

for team, data in pairs(teams) do
for i, n in pairs(data.playerList) do
local data = tfm.get.room.playerList[n]
if data and not data.isDead then
table.insert(aliveTeams, team)

break
end
end
end

if #aliveTeams == 1 then
local aliveTeam = teams[aliveTeams[1]]
aliveTeam.score = aliveTeam.score + 1
ui.addBotText("Team | " .. aliveTeams[1] .. " | earned a point from being the last ones surviving!", nil)

changeTime(5)
elseif #aliveTeams == 0 then
newGame()
end
end
end

function eventNewPlayer(n)
if not players[n] then
players[n] = Player.new(n)
eventChatCommand(n, "help")
end

players[n]:updateScore()

if admin[n] then
ui.addBotText("If you want to host a session, please do !host. View commands with !commands.", n)
end
end

function eventColorPicked(id, n, color)
--[[
Finalising the process of making a new team.
Since there's only one host, we do not need to worry about multiple undefined teams.
]]
local newteam = ""

for team, data in pairs(teams) do
if not data.color then
newteam = team
data.color = color

break
end
end
ui.addBotText(newteam .. " team is now available.", nil)
end

function eventTextAreaCallback(id, n, cb)
if cb:sub(1, 4) == "join" then
local team = cb:sub(6)

eventChatCommand(host, team .. " " .. n)
manualTeams()
elseif cb == "teamsSelected" then
--[[
Start a new round with the custom teams.
]]
local startId = 0
local endId = startId + 1 + numOfTeams()

for id = startId, endId do
ui.removeTextArea(id, nil)
end
newGame()
end
end

function eventChatCommand(n, cmd)
local arg = {}
for args in cmd:gmatch("[^%s]+") do
table.insert(arg, args:lower())
end

if admin[n] then
if n == host then
if arg[1] == "teams" and arg[2] then
if arg[2] == "random" then
--[[
Setting random teams.
]]
ffa = false
randTeams()
newGame()
elseif arg[2] == "manual" then
--[[
Setting manual-chosen teams.
]]
gameLoaded = false
ffa = false
manualTeams()
elseif arg[2] == "nil" then
ffa = true
newGame()
end
elseif cmd == "reset" then
resetScores()
elseif (arg[1] == "setscore" or arg[1] == "score") and arg[2] and arg[3] then
--[[
Sets a team or a player's score.
]]
local n = capitalize(arg[2])

if teams[n] then
teams[n].score = tonumber(arg[3])
ui.addBotText("Team " .. n .. "'s score has been set to " .. arg[3], n)
end
if players[n] then
players[n].score = tonumber(arg[3])
players[n]:updateScore()
elseif n == "All" then
resetScores(tonumber(arg[3]))
ui.addBotText("Everyone's score has been set to " .. arg[3], n)
end
updateMapBar()
elseif cmd == "challenge" then
--[[
Readies to the next round for a challenge.
]]
eventChatCommand(n, "reset")
eventChatCommand(n, "map")
elseif arg[1] == "newteam" and arg[2] then
local team = capitalize(arg[2])

if not teams[team] then
teams[team] = {
playerList = {},
score = 0,
}

ui.showColorPicker(0, n, 0, team .. "'s Team Color")
end
elseif teams[capitalize(arg[1])] and arg[2] then
--[[
Allowing a player to join another team.
]]
local team = teams[capitalize(arg[1])]
local n = capitalize(arg[2])

if players[n] then
for oldteam, data in pairs(teams) do
for i, n2 in pairs(data.playerList) do
if n2 == n then
table.remove(data.playerList, i)

break
end
end
end

table.insert(team.playerList, n)
setNameColor(n, team.color)
ui.addBotText(n .. " has joined the " .. capitalize(arg[1]) .. " team.", nil)
end
elseif arg[1] == "noteam" and arg[2] then
--[[
Forcing a player to leave a team.
]]
local n = capitalize(arg[2])

if players[n] then
for team, data in pairs(teams) do
for i, n2 in pairs(data.playerList) do
if n2 == n then
table.remove(data.playerList, i)

break
end
end
end

setNameColor(n, settings.NOTEAMCOLOR)
ui.addBotText(n .. " no longer belongs in any team.", nil)
end
elseif cmd == "unhost" then
host = ""
ui.addBotText(n .. " is no longer the host.", n)
end
end

if cmd == "host" and host == "" then
host = n
ui.addBotText(n .. " is now the host.", n)
elseif cmd == "map" then
newGame()
elseif arg[1] == "time" and arg[2] then
changeTime(tonumber(arg[2]))
elseif arg[1] == "spec" and arg[2] then
--[[
Puts someone on or off to spectator mode.
]]
local n = capitalize(arg[2])

if players[n] then
players[n].spectating = not players[n].spectating
ui.addBotText(n .. "'s spectating mode is now set to " .. tostring(players[n].spectating) .. ".", n)
end
end
end

--[[
Non-admin commands here.
]]
if cmd == "help" or cmd == "info" or cmd == "guide" then
local str =
"Welcome to Souper Deathmatch. This is a rebuilt version of #deathmatch with adjustable teaming options for hosting challenges. Your aim in this game is to be the last person or team standing. You achieve this by killing others by pressing down or spacebar to shoot cannons.<br><br>" ..
"Please do !commands to view a list of commands you can use. They're quite important.<br><br>" ..
"---<br><br>" ..
"<u>Recommended offsetting options;</u><br>" ..
"!off -2 8 | <i>Default offset. To cnj, simply moving forward before spawning is required.</i><br><br>" ..
"!off -25 25 | <i>Offset used by campers. Cannons will spawn just below your arse, so cnjing is assisted heavily. To not cnj, jumping before you spawn is required.</i><br><br>" ..
"!off -15 20 | <i>Onkei's usual offset. Simillar to the -25 25, but cannons will be spawned closer to the mouse, hitting the mouse earlier. This is slightly harder to not cnj with.</i>"

ui.addPopup(1, 0, str, n, 270, 30, 520, true)
elseif arg[1]:sub(1, 3) == "off" and arg[2] and arg[3] then
players[n]:changeOffset(tonumber(arg[2]), tonumber(arg[3]))

local off = players[n].cannons.off
ui.addBotText("Your new offset is now X" .. off.x .. " Y" .. off.y .. ".", n)
elseif cmd == "allteams" then
--[[
Shows all the teams in the game.
]]
local allTeams = ""

for team, data in pairs(teams) do
allTeams = allTeams .. "| " .. team .. " (" .. data.score .. ") "
end
allTeams = allTeams .. "|"

ui.addBotText("Teams available: " .. allTeams, n)
elseif arg[1] == "members" and teams[capitalize(arg[2])] then
--[[
Shows the team members of a team.
]]
local team = capitalize(arg[2])
local members = teamToString(team)

ui.addBotText("Team " .. team .. ": " .. members, n)
elseif capitalize(cmd) == "Mvp" then
local MVP = highestScorer()

ui.addBotText("MVP: " .. MVP[1] .. " (Leading with " .. MVP[2] .. " points)", n)
elseif cmd:sub(1, 7) == "command" or cmd:sub(1, 3) == "cmd" then
local str =
"All commands are listed here.<br><br>" ..
"<u>Host-only commands</u><br>" ..
"!teams random/manual/nil - Enables a team mode e.g. !teams manual<br>" ..
"!reset - Reset everyone's scores<br>" ..
"!setscore [team]/[name]/all [num] - Sets someone's score e.g. !setscore Onkei 9001<br>" ..
"!challenge - Resets everyone's scores and loads a new round<br>" ..
"![team] [name] - Assigns someone to a team e.g. !Blue Onkei<br>" ..
"!noteam [name] - Force someone to leave their team !noteam Onkei<br>" ..
"!unhost - Stops hosting so other admins can host<br><br>" ..
"<u>Admin-only commands</u><br>" ..
"!host - Starts hosting, which grants usage of more commands<br>" ..
"!map - Changes the map<br>" ..
"!time [num] - Changes the time e.g. !time 120<br>" ..
"!spec [name] - Gives a player spectator mode e.g. !spec Onkei<br><br>" ..
"<u>Normal commands</u><br>" ..
"!off [x] [y] - Sets personal cannon coordinates e.g. !off -25 25<br>" ..
"!allteams - Shows all the teams and their scores<br>" ..
"!members [team] - Shows the members of a team e.g. !members Blue<br>" ..
"!MVP - Gets the MVP of the game so far"
ui.addPopup(1, 0, str, n, 270, 30, 520, true)
end
end

main()

ty
Honorabilis
« Consul »
1500898680000
    • Honorabilis#0000
    • Profil
    • Derniers messages
    • Tribu
#4
  0
Onkei a dit :
I don't exactly have what you want, but below is a Team DM script I made for my tribe. The commands list contains info on how to activate team mode. Athesdrake also made something similar.


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
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
--[[
[Tutorial] Adding teams to your games by Onkei.
]]

local maps = {5017354, 1348152, 5014291, 4826471, 4884688, 4486069, 3661362, 4795468, 3899992, 4826673, 4788935, 4787956, 4773530, 4741121, 4741135, 4741162, 4741180, 4741187, 4741210, 4741230, 4741240, 4733964, 4734030, 4734088, 4734142, 4734196, 541917, 541928, 541943, 559634, 559644, 589708, 589736, 589800, 4725345, 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, 2221623, 1830342, 1745896, 1874823, 1351237, 2055551, 1681719, 1357994, 965024, 2060060, 2105100, 1459902, 2174353, 1531402, 1643446, 2232342, 1975056, 1757177, 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, 1792773, 2125502, 2315803, 2024170, 1699880, 870022, 1846255, 1540557, 2221226, 3387205, 3242517, 1542824, 3446890, 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, 2145870, 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, 1298164, 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, 1271249, 4462312, 3598126}

local teams = {
Blue = {
playerList = {},
color = 0x2323bf,
score = 0,
},

Red = {
playerList = {},
color = 0xbf2323,
score = 0,
},
}

local admin, host = {Onkei = true, Ehw = true, Tomstoms = true, Pie = true, Ninjafood = true, Elt1abl0 = true}, ""

local keys = {space = 32, left = 37, right = 39, down = 40, a = 65, d = 68, q = 81, s = 83}

local settings = {
ID = 17,
OFF = {X = -2, Y = 8},
COOLDOWN = 1.5,
DESPAWNTICKS = 3,

TILLALLOWSHOOTING = 10,

NOTEAMCOLOR = 0xFFFFFF,

leftKeys = {[keys.left] = true, [keys.a] = true, [keys.q] = true},
rightKeys = {[keys.right] = true, [keys.d] = true},
fireKeys = {[keys.space] = true, [keys.down] = true, [keys.s] = true},
}

local allowShooting = false
local ffa = true
local gameLoaded = false

local changeTime = tfm.exec.setGameTime
local abs, floor, random = math.abs, math.floor, math.random
local setShamanName, setNameColor = ui.setShamanName, tfm.exec.setNameColor
local spawnObject, removeObject = tfm.exec.addShamanObject, tfm.exec.removeObject

local Task, tasks = {}, {}
function Task.new(when, func)
--[[
Task class to manage tined functions.
]]
local self = {}

self.when = (when or 5) * 1000 + os.time()
self.func = func

function self:canHappen(now)
if self.when <= now then
return true
end
return false
end

function self:happen()
self.func()
end

return self
end

local Cannons = {}
function Cannons.new()
--[[
Cannons class to manage a player's cannoning data.
]]
local self = {}

self.id = settings.ID

self.direction = 1
self.cooldown = settings.COOLDOWN
self.lastSpawned = 0
self.off = {
x = settings.OFF.X,
y = settings.OFF.Y,
}

self.offscreen = {
temp = 0,
thisRound = 0,
}

function self:canShoot(y)
if self.lastSpawned > os.time() - self.cooldown * 1000 then
return false
end

if y <= 0 then
if self.offscreen.temp >= 2 or self.offscreen.thisRound >= 30 then
return false
else
self.offscreen.temp = self.offscreen.temp + 1
self.offscreen.thisRound = self.offscreen.thisRound + 1
end
else
self.offscreen.temp = 0
end
return true
end

function self:hasSpawned()
self.lastSpawned = os.time()
end

function self:shoot(x, y)
if self:canShoot(y) then
local id = spawnObject(self.id, x + self.off.x * self.direction, y + self.off.y, 90 * self.direction)
table.insert(tasks, Task.new(settings.DESPAWNTICKS, function() removeObject(id) end))

self:hasSpawned()
end
end

return self
end

local Player, players = {}, {}
function Player.new(n)
--[[
Player class to manage an individual player.
]]
local self = {}

self.n = n
self.cannons = Cannons.new()
self.score = 0
self.spectating = false

function self:changeDirection(newDirection)
self.cannons.direction = newDirection
end

function self:changeOffset(x, y)
if abs(x) <= 25 and abs(y) <= 25 then
self.cannons.off.x = x
self.cannons.off.y = y
end
end

function self:ready()
self.cannons.offscreen = {
temp = 0,
thisRound = 0,
}
self.cannons.spawned = {
temp = 0,
thisRound = 0,
}
end

function self:updateScore()
tfm.exec.setPlayerScore(self.n, self.score, false)
end

function self:won(score)
tfm.exec.giveCheese(self.n)
tfm.exec.playerVictory(self.n)

self.score = self.score + (score or 1)
end

return self
end

function bindKeys(n, bool)
for i, key in pairs(keys) do
system.bindKeyboard(n, key, true, bool)
end
end

function capitalize(word)
return string.upper(word:sub(1, 1)) .. string.lower(word:sub(2));
end

function highestScorer()
local highest = {"Etho", 0}

for n, data in pairs(players) do
if data.score >= highest[2] then
highest[1] = n
highest[2] = data.score
end
end
return highest
end

local tempMaps = {}
function loadMap()
--[[
Loads a new random map and makes sure it doesn't get loaded again
until all the other maps are loaded.
]]
if #tempMaps == 0 then
tempMaps = table.copy(maps)
end

local randomIndex = random(#tempMaps)
local randomMap = tempMaps[randomIndex]
table.remove(tempMaps, randomIndex)

tfm.exec.newGame(randomMap, random(100) > 50)
end

function main()
tfm.exec.disableAutoNewGame(true)
tfm.exec.disableAutoShaman(true)
tfm.exec.disableAutoTimeLeft(true)
tfm.exec.disableAutoScore(true)
tfm.exec.disablePhysicalConsumables(true)

table.foreach(tfm.get.room.playerList, eventNewPlayer)

resetScores() -- Resetting scores of players.
newGame()
end

function manageTeams()
--[[
Assigning team colors to the players' nametags.
]]
for team, data in pairs(teams) do
for i, n in pairs(data.playerList) do
if not players[n].spectating then
setNameColor(n, data.color)
end
end
end
end

function manualTeams()
--[[
Function to display the manual teams selection system.
]]
ui.addTextArea(0, "", nil, -1100, -1300, 3000, 3000, 0xffffff, 0xffffff, 0.2, true)

local numTeams, maxHeight = numOfTeams(), 300
local teamIdCount, eachH, nextY = 1, maxHeight / numTeams, 30

for team, data in pairs(teams) do
--[[
Showing each team's members and changing the y coord of each textArea accordingly.
]]
local members = teamToString(team)

teamIdCount = teamIdCount + 1 -- To prevent the id of each team textArea from overwriting each other.

ui.addTextArea(teamIdCount, "<p align='center'><font size='14'><b><a href='event:join_" .. team .. "'>" .. team .. "</a></b><br><br><font size='10'><n>" .. members, nil, 150, nextY, 500, eachH, 0x324650, data.color, 0.8, true)

nextY = nextY + eachH
end

ui.addTextArea(1, "<p align='center'><font size='18'><a href='event:teamsSelected'>Close", host, 150, 340, 500, 30, 0x324650, 0xe5e5e5, 0.8, true)
end

function map(value, start1, stop1, start2, stop2)
local value2 = ((value - start1) / (stop1 - start1)) * (stop2 - start2) + start2
return value2
end

function newGame()
--[[
Handles the starting of new rounds.
]]

for n, data in pairs(players) do
if not data.spectating then
data:ready()
data:updateScore()
bindKeys(n, true)
end
end

allowShooting = false
loadMap()
end

function numOfTeams()
local numTeams = 0

for team in pairs(teams) do
numTeams = numTeams + 1
end
return numTeams
end

function resetScores(num)
local newScore = num or 0

for team, data in pairs(teams) do
data.score = newScore
end

for n, data in pairs(players) do
data.score = newScore
data:updateScore()
end
end

function randTeams()
--[[
Seperating the room into random teams.
]]
for team, data in pairs(teams) do
data.playerList = {}
end

local playersLeft = {}

for n in pairs(tfm.get.room.playerList) do
table.insert(playersLeft, n)
end

--[[
Making sure all new teams are defined correctly.
]]
for team, data in pairs(teams) do
if not data.color then
teams[team] = nil
end
end

while (#playersLeft > 0) do
local smallestTeam = {playerList = {"Onkei", "Random Guy", "Another Guy", "More Guys", "Johnny Cash"}}
for team, data in pairs(teams) do
if #data.playerList < #smallestTeam.playerList then
smallestTeam = teams[team]
end
end

local randomIndex = random(#playersLeft)
local randomPlayer = playersLeft[randomIndex]
table.insert(smallestTeam.playerList, randomPlayer)
table.remove(playersLeft, randomIndex)
end
end

function table.copy(t1)
--[[
Returning a copy of the table given.
]]
local t2 = {}

for k, v in pairs(t1) do
t2[k] = v
end
return t2
end

function teamToString(team)
--[[
Getting the team members of a team and formatting it into a string.
]]
if not teams[team] then
return
end

team = teams[team]

local members, checked, numMembers = "", 0, #team.playerList

for i, n in pairs(team.playerList) do
members = members .. n
checked = checked + 1

if checked + 1 == numMembers then
members = members .. " and "
elseif checked + 1 < numMembers then
members = members .. ", "
end
end

return members
end

function ui.addBotText(text, n)
ui.addTextArea(100, "<v>[~Soupbot]<n> " .. text, n, 6, 380, nil, 30, 0x324650, 0x89A7F5, 0.7, true)
end

function updateMapBar()
if ffa then
local highest = highestScorer()

setShamanName(highest[1] .. " " .. highest[2])
else
local teamStr, teamsChecked = " ", {}
local numTeams = numOfTeams()

for team, data in pairs(teams) do
table.insert(teamsChecked, team)
teamStr = teamStr .. team .. " " .. data.score

if #teamsChecked + 1 <= numTeams then
teamStr = teamStr .. " - "
end
end

setShamanName(teamStr)
end
end

function eventNewGame()
gameLoaded = true

if not ffa then
manageTeams()
end

updateMapBar()
end

function eventKeyboard(n, key, down, x, y)
if settings.leftKeys[key] then
players[n]:changeDirection(-1)
elseif settings.rightKeys[key] then
players[n]:changeDirection(1)
elseif settings.fireKeys[key] and allowShooting then
players[n].cannons:shoot(x, y)
end
end

function eventLoop(passed, left)
if not gameLoaded then
return
end

local now = os.time()
for i, task in pairs(table.copy(tasks)) do
if task:canHappen(now) then
task:happen()
table.remove(tasks, i)
end
end

if not allowShooting and passed >= 5000 and passed <= settings.TILLALLOWSHOOTING * 1000 then
local tillAllow = floor(settings.TILLALLOWSHOOTING - passed / 1000)

ui.addBotText("You can shoot in " .. tillAllow .. "s..", nil)

if tillAllow <= 0 then
allowShooting = true

ui.addBotText("You can now shoot.", nil)
end
elseif left <= 0 then
local winners = ""

for n, data in pairs(tfm.get.room.playerList) do
if not data.isDead then
winners = winners .. "| " .. n .. " "

players[n]:won(1)
end
end

if ffa and winners ~= "" then
winners = winners .. "|"

ui.addBotText(winners .. " won the last round!", nil)
end

newGame()
end
end

function eventPlayerDied(n)
bindKeys(n, false)

if not gameLoaded then
--[[
To prevent rounds from changing when teams are being selected manually.
]]
return
end

if ffa then
local alive = {}

for n, data in pairs(tfm.get.room.playerList) do
if not data.isDead and not players[n].spectating then
table.insert(alive, n)
end
end

if #alive == 1 then
changeTime(5)
elseif #alive == 0 then
newGame()
end
else
local aliveTeams = {}

for team, data in pairs(teams) do
for i, n in pairs(data.playerList) do
local data = tfm.get.room.playerList[n]
if data and not data.isDead then
table.insert(aliveTeams, team)

break
end
end
end

if #aliveTeams == 1 then
local aliveTeam = teams[aliveTeams[1]]
aliveTeam.score = aliveTeam.score + 1
ui.addBotText("Team | " .. aliveTeams[1] .. " | earned a point from being the last ones surviving!", nil)

changeTime(5)
elseif #aliveTeams == 0 then
newGame()
end
end
end

function eventNewPlayer(n)
if not players[n] then
players[n] = Player.new(n)
eventChatCommand(n, "help")
end

players[n]:updateScore()

if admin[n] then
ui.addBotText("If you want to host a session, please do !host. View commands with !commands.", n)
end
end

function eventColorPicked(id, n, color)
--[[
Finalising the process of making a new team.
Since there's only one host, we do not need to worry about multiple undefined teams.
]]
local newteam = ""

for team, data in pairs(teams) do
if not data.color then
newteam = team
data.color = color

break
end
end
ui.addBotText(newteam .. " team is now available.", nil)
end

function eventTextAreaCallback(id, n, cb)
if cb:sub(1, 4) == "join" then
local team = cb:sub(6)

eventChatCommand(host, team .. " " .. n)
manualTeams()
elseif cb == "teamsSelected" then
--[[
Start a new round with the custom teams.
]]
local startId = 0
local endId = startId + 1 + numOfTeams()

for id = startId, endId do
ui.removeTextArea(id, nil)
end
newGame()
end
end

function eventChatCommand(n, cmd)
local arg = {}
for args in cmd:gmatch("[^%s]+") do
table.insert(arg, args:lower())
end

if admin[n] then
if n == host then
if arg[1] == "teams" and arg[2] then
if arg[2] == "random" then
--[[
Setting random teams.
]]
ffa = false
randTeams()
newGame()
elseif arg[2] == "manual" then
--[[
Setting manual-chosen teams.
]]
gameLoaded = false
ffa = false
manualTeams()
elseif arg[2] == "nil" then
ffa = true
newGame()
end
elseif cmd == "reset" then
resetScores()
elseif (arg[1] == "setscore" or arg[1] == "score") and arg[2] and arg[3] then
--[[
Sets a team or a player's score.
]]
local n = capitalize(arg[2])

if teams[n] then
teams[n].score = tonumber(arg[3])
ui.addBotText("Team " .. n .. "'s score has been set to " .. arg[3], n)
end
if players[n] then
players[n].score = tonumber(arg[3])
players[n]:updateScore()
elseif n == "All" then
resetScores(tonumber(arg[3]))
ui.addBotText("Everyone's score has been set to " .. arg[3], n)
end
updateMapBar()
elseif cmd == "challenge" then
--[[
Readies to the next round for a challenge.
]]
eventChatCommand(n, "reset")
eventChatCommand(n, "map")
elseif arg[1] == "newteam" and arg[2] then
local team = capitalize(arg[2])

if not teams[team] then
teams[team] = {
playerList = {},
score = 0,
}

ui.showColorPicker(0, n, 0, team .. "'s Team Color")
end
elseif teams[capitalize(arg[1])] and arg[2] then
--[[
Allowing a player to join another team.
]]
local team = teams[capitalize(arg[1])]
local n = capitalize(arg[2])

if players[n] then
for oldteam, data in pairs(teams) do
for i, n2 in pairs(data.playerList) do
if n2 == n then
table.remove(data.playerList, i)

break
end
end
end

table.insert(team.playerList, n)
setNameColor(n, team.color)
ui.addBotText(n .. " has joined the " .. capitalize(arg[1]) .. " team.", nil)
end
elseif arg[1] == "noteam" and arg[2] then
--[[
Forcing a player to leave a team.
]]
local n = capitalize(arg[2])

if players[n] then
for team, data in pairs(teams) do
for i, n2 in pairs(data.playerList) do
if n2 == n then
table.remove(data.playerList, i)

break
end
end
end

setNameColor(n, settings.NOTEAMCOLOR)
ui.addBotText(n .. " no longer belongs in any team.", nil)
end
elseif cmd == "unhost" then
host = ""
ui.addBotText(n .. " is no longer the host.", n)
end
end

if cmd == "host" and host == "" then
host = n
ui.addBotText(n .. " is now the host.", n)
elseif cmd == "map" then
newGame()
elseif arg[1] == "time" and arg[2] then
changeTime(tonumber(arg[2]))
elseif arg[1] == "spec" and arg[2] then
--[[
Puts someone on or off to spectator mode.
]]
local n = capitalize(arg[2])

if players[n] then
players[n].spectating = not players[n].spectating
ui.addBotText(n .. "'s spectating mode is now set to " .. tostring(players[n].spectating) .. ".", n)
end
end
end

--[[
Non-admin commands here.
]]
if cmd == "help" or cmd == "info" or cmd == "guide" then
local str =
"Welcome to Souper Deathmatch. This is a rebuilt version of #deathmatch with adjustable teaming options for hosting challenges. Your aim in this game is to be the last person or team standing. You achieve this by killing others by pressing down or spacebar to shoot cannons.<br><br>" ..
"Please do !commands to view a list of commands you can use. They're quite important.<br><br>" ..
"---<br><br>" ..
"<u>Recommended offsetting options;</u><br>" ..
"!off -2 8 | <i>Default offset. To cnj, simply moving forward before spawning is required.</i><br><br>" ..
"!off -25 25 | <i>Offset used by campers. Cannons will spawn just below your arse, so cnjing is assisted heavily. To not cnj, jumping before you spawn is required.</i><br><br>" ..
"!off -15 20 | <i>Onkei's usual offset. Simillar to the -25 25, but cannons will be spawned closer to the mouse, hitting the mouse earlier. This is slightly harder to not cnj with.</i>"

ui.addPopup(1, 0, str, n, 270, 30, 520, true)
elseif arg[1]:sub(1, 3) == "off" and arg[2] and arg[3] then
players[n]:changeOffset(tonumber(arg[2]), tonumber(arg[3]))

local off = players[n].cannons.off
ui.addBotText("Your new offset is now X" .. off.x .. " Y" .. off.y .. ".", n)
elseif cmd == "allteams" then
--[[
Shows all the teams in the game.
]]
local allTeams = ""

for team, data in pairs(teams) do
allTeams = allTeams .. "| " .. team .. " (" .. data.score .. ") "
end
allTeams = allTeams .. "|"

ui.addBotText("Teams available: " .. allTeams, n)
elseif arg[1] == "members" and teams[capitalize(arg[2])] then
--[[
Shows the team members of a team.
]]
local team = capitalize(arg[2])
local members = teamToString(team)

ui.addBotText("Team " .. team .. ": " .. members, n)
elseif capitalize(cmd) == "Mvp" then
local MVP = highestScorer()

ui.addBotText("MVP: " .. MVP[1] .. " (Leading with " .. MVP[2] .. " points)", n)
elseif cmd:sub(1, 7) == "command" or cmd:sub(1, 3) == "cmd" then
local str =
"All commands are listed here.<br><br>" ..
"<u>Host-only commands</u><br>" ..
"!teams random/manual/nil - Enables a team mode e.g. !teams manual<br>" ..
"!reset - Reset everyone's scores<br>" ..
"!setscore [team]/[name]/all [num] - Sets someone's score e.g. !setscore Onkei 9001<br>" ..
"!challenge - Resets everyone's scores and loads a new round<br>" ..
"![team] [name] - Assigns someone to a team e.g. !Blue Onkei<br>" ..
"!noteam [name] - Force someone to leave their team !noteam Onkei<br>" ..
"!unhost - Stops hosting so other admins can host<br><br>" ..
"<u>Admin-only commands</u><br>" ..
"!host - Starts hosting, which grants usage of more commands<br>" ..
"!map - Changes the map<br>" ..
"!time [num] - Changes the time e.g. !time 120<br>" ..
"!spec [name] - Gives a player spectator mode e.g. !spec Onkei<br><br>" ..
"<u>Normal commands</u><br>" ..
"!off [x] [y] - Sets personal cannon coordinates e.g. !off -25 25<br>" ..
"!allteams - Shows all the teams and their scores<br>" ..
"!members [team] - Shows the members of a team e.g. !members Blue<br>" ..
"!MVP - Gets the MVP of the game so far"
ui.addPopup(1, 0, str, n, 270, 30, 520, true)
end
end

main()

He said "France" and Mathieu is French. Maybe wants Athes' code?
Minerva
« Citoyen »
1500919020000
    • Minerva#3185
    • Profil
    • Derniers messages
    • Tribu
#5
  0
I have the legit france deathmatch lua , Lemme see if i can find it


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
admin="Elt1abl0" --put your own username
blueready=false
redready=false
redteamname="Red Team"
blueteamname="Blue Team"


tfm.exec.disableAutoNewGame(true)
tfm.exec.disableAutoShaman(true)
tfm.exec.disableAfkDeath(true)
tfm.exec.disableAutoTimeLeft(true)
colors = { 0xff0000, 0x0000ff }
players={}
toDespawn={}
maps={6714009,6881707,4741240,1349878,3237641,5014291,3899992,1825269,3479878,4469762,1288489,4734088,3219038,1276664,1408028,2173893,1951332,589708,3192515,4734196,3237641,1888080,4741135,1985670,559634,2040205,5017354,1879154,1705433,3387205,2050554,1675316,1659906,4383258,3210915,3577308,2262150,1312845,1533678,2054347,1904053,1737915,3326933,1643446,1531279,4734142,2124484,2147778,6761737}
disco={1612690,3920302,3333999,3926952,3334000,2121577}
selection=true
ffa=false
tfm.exec.newGame("@6396471")
cheese="nothing"
redpoints=0
bluepoints=0
long="nothing"
win=false
discobool=false
ui.addPopup(0, 0, "<p align = 'center'><b><font size='30' face='arial' color='#FFFFFF'>Welcome to LegitFrance Deathmatch!</font></b></p>Created by Circling, credits to Circling<p align = 'left'><font size='15' face='arial' color='#E231E8'>\nRules:\nThe Captains of both teams choose when their team is ready. He/she can click on 'Blue Team' if he/she is blue team captain, or 'Red Team' if he/she is red team captain, to change the Team Name. The *Captain* will have '*' on both sides of their name. When both captains are ready, the game will begin. Spectators will die every round and are unable to participate. Each time a team wins i.e.survive the round, they will win 1 point. The first team to score 10 points wins the game!</font></p>\n<p align='center'><b><i><font size='30' face='arial' color='#FF0000'>Commands(admin only)</p></b></i></font>!skip - skips a map to start a new map.\n!start - start/restart FFA with 0 points for both teams.\n!new - goes back to selection menu to reselect teams.\nCurrent Admin is <font size='25' color='#0000FF'>"..admin.."</font>.\n<p align='left'><b><i><font size='20'>Type !help to see this popup again.</p></b><i></font>", nil, 100, 30, 600, true)

function eventNewPlayer(name)
for i,key in ipairs({32,0,1,2,3}) do
tfm.exec.bindKeyboard(name,key,true,true)
end
players[name]={
timestamp=os.time(),
offsets={x=-20, y=20},
team="white",
idplayer=0
}
end

function eventKeyboard(name,key,down,x,y)
local id=0
if (key==32 or key==3 ) and not tfm.get.room.playerList[name].isDead and started and ffa==true and win==false then
if players[name].timestamp < os.time()-1100 then
if players[name].isFacingRight then
id=tfm.exec.addShamanObject(17, x+players[name].offsets.x , y+players[name].offsets.y, 90 )
else
id=tfm.exec.addShamanObject(17, x-players[name].offsets.x , y+players[name].offsets.y, 270)
end
players[name].timestamp=os.time()
table.insert(toDespawn,{os.time(),id})
end
end
if key==0 then
players[name].isFacingRight = false
elseif key==2 then
players[name].isFacingRight=true
end
end

function eventChatCommand(name,command)
local arg={}
for argument in string.gmatch(command,"[^%s]+") do
table.insert(arg,argument)
end
if arg[1]=="off" then
if tonumber(arg[2]) and tonumber(arg[3]) then
players[name].offsets.x=tonumber(arg[2])
players[name].offsets.y=tonumber(arg[3])
else
players[name].offsets.x=2
players[name].offsets.y=10
end
ui.addTextArea(6996, "Offsets changed to X:"..players[name].offsets.x.." Y:"..players[name].offsets.y, name, 250, 370, 300, 20, 0x324650, 0x0, 0.3, true)
end
if name==admin and command=="new" then
selection=true
ffa=false
discobool=false
starterino=false
tfm.exec.newGame("@6396471")
redpoints=0
bluepoints=0
blueready=false
redready=false
redteamname="Red Team"
blueteamname="Blue Team"
local i=1
while i<10 do
ui.removeTextArea(i,nil)
i=i+1
end
win=false
for name,player in pairs(tfm.get.room.playerList) do
eventNewPlayer(name)
end
end
if name==admin and command=="start" then
ffa=true
selection=false
redpoints=0
bluepoints=0
tfm.exec.newGame(maps[math.random(#maps)])
end
if name==admin and command=="skip" then
tfm.exec.newGame(maps[math.random(#maps)])
end
if command=="help" then
ui.addPopup(0, 0, "<p align = 'center'><b><font size='30' face='arial' color='#FFFFFF'>Welcome to Tribe War: Deathmatch!</font></b></p><p align = 'left'><font size='15' face='arial' color='#FFFF00'>Rules:\nThe Captains of both teams choose when their team is ready. The Captain will have '*' on both sides of their name. When both captains are ready, the game will begin. Each time a team wins i.e.survive the round, they will win 1 point. The first team to score 10 points wins the game!</font></p>\n\n<p align='center'><b><i><font size='30' face='arial' color='#FF0000'>Commands(admin only)</p></b></i></font>!skip - skips a map to start a new map.\n!start - start/restart FFA with 0 points for both teams.\n!new - goes back to selection menu to reselect teams.\nCurrent Admin is <font size='25' color='#0000FF'>"..admin.."</font>.\n<p align='left'><b><i><font size='20'>Type !help to see this popup again.</p></b><i></font>", name, 100, 50, 600, true)
end
end

function eventNewGame()
if selection==true then
tfm.exec.setGameTime(30, false)
local i=10
local y=30
while i<19 do
ui.addTextArea(i,"<a href='event:join'><b><p align='center'><font face='arial' size='20' color='#0000FF'>Join</font></p></b></a>" ,nil,5,y,200,30,0x0000ff,0x212F36,0.2,false)
i=i+1
y=y+40
end
ui.addTextArea(19,"<a href='event:captain'><b><p align='center'><font face='arial' size='20' color='#0000FF'>Become Captain</font></p></b></a>" ,nil,5,y,200,30,0x0000ff,0x212F36,0.2,false)
y=30
i=20
while i<29 do
ui.addTextArea(i,"<a href='event:join'><b><p align='center'><font face='arial' size='20' color='#FF0000'>Join</font></p></b></a>" ,nil,605,y,200,30,0xff0000,0x212F36,0.2,false)
i=i+1
y=y+40
end
ui.addTextArea(29,"<a href='event:captain'><b><p align='center'><font face='arial' size='20' color='#FF0000'>Become Captain</font></p></b></a>" ,nil,605,y,200,30,0xff0000,0x212F36,0.2,false)
ui.addTextArea(0,"<a href='event:spectate'><b><p align='center'><font face='arial' size='20' color='#FFFFFF'>Spectate</font></p></b></a>" ,nil,300,205,200,30,0xffffff,0x212F36,0.2,false)
ui.addTextArea(50,"<a href='event:blueready'><b><p align='center'><font face='arial' size='20' color='#0000FF'>Not Ready</font></p></b></a>" ,nil,260,385,120,30,0x0000ff,0x212F36,0.2,false)
ui.addTextArea(51,"<a href='event:redready'><b><p align='center'><font face='arial' size='20' color='#FF0000'>Not Ready</font></p></b></a>" ,nil,420,385,120,30,0xff0000,0x212F36,0.2,false)
ui.addTextArea(53,"<a href='event:bluename'><b><p align='center'><font face='arial' size='20' color='#0000FF'>Blue Team</font></p></b></a>" ,nil,260,65,280,30,0x0000ff,0x212F36,0.2,false)
ui.addTextArea(55,"<b><p align='center'><font face='arial' size='20' color='#000000'>VS</font></p></b>" ,nil,375,105,50,30,0xffffff,0x212F36,0.2,false)
ui.addTextArea(54,"<a href='event:redname'><b><p align='center'><font face='arial' size='20' color='#FF0000'>Red Team</font></p></b></a>" ,nil,260,145,280,30,0xff0000,0x212F36,0.2,false)
end
if ffa==true then
if bluepoints==10 then
tfm.exec.setGameTime(30)
win=true
ui.addTextArea(8,"<p align='center'><b><font face='arial' size='40' color='#0000FF'>"..blueteamname.." WON!!</font></b></p>" ,nil,0,120,800,60,0x0000ff,0x212F36,0.2,true)
cheese="blue"
elseif redpoints==10 then
tfm.exec.setGameTime(30)
win=true
ui.addTextArea(8,"<p align='center'><b><font face='arial' size='40' color='#FF0000'>"..redteamname.." WON!!</font></b></p>" ,nil,0,120,800,60,0xff0000,0x212F36,0.2,true)
cheese="red"
end
local i=10
while i<60 do
ui.removeTextArea(i,nil)
i=i+1
end
ui.removeTextArea(0,nil)
for name, player in pairs(tfm.get.room.playerList) do
if players[name].team=="blue" or players[name].team=="bluecaptain" then
tfm.exec.setNameColor(name, 0x0000ff)
elseif players[name].team=="red" or players[name].team=="redcaptain" then
tfm.exec.setNameColor(name, 0xff0000)
elseif players[name].team=="white" then
tfm.exec.killPlayer(name)
end
end
bluestring="<p align='center'><b><font face='arial' size='20' color='#0000FF'>"..blueteamname.."</font></b></p>".."<p align='center'><b><font face='arial' size='30' color='#0000FF'>"..tostring(bluepoints).."</font></b></p>"
redstring="<p align='center'><b><font face='arial' size='20' color='#FF0000'>"..redteamname.."</font></b></p>".."<p align='center'><b><font face='arial' size='30' color='#FF0000'>"..tostring(redpoints).."</font></b></p>"
ui.addTextArea(7,bluestring,nil,95,25,300,70,0x0000ff,0x0000ff,0.2,true)
ui.addTextArea(9,redstring,nil,405,25,300,70,0xff0000,0xff0000,0.2,true)
started=false
end
end

function eventTextAreaCallback(i, name, callback)
if callback=="join" or callback=="captain" then
if players[name].idplayer>0 then
if players[name].idplayer<19 then
ui.updateTextArea(players[name].idplayer,"<a href='event:join'><b><p align='center'><font face='arial' size='20' color='#0000FF'>Join</font></p></b></a>",nil)
elseif players[name].idplayer==19 then
ui.updateTextArea(players[name].idplayer,"<a href='event:captain'><b><p align='center'><font face='arial' size='20' color='#0000FF'>Become Captain</font></p></b></a>",nil)
elseif players[name].idplayer<29 then
ui.updateTextArea(players[name].idplayer,"<a href='event:join'><b><p align='center'><font face='arial' size='20' color='#FF0000'>Join</font></p></b></a>",nil)
elseif players[name].idplayer==29 then
ui.updateTextArea(players[name].idplayer,"<a href='event:captain'><b><p align='center'><font face='arial' size='20' color='#FF0000'>Become Captain</font></p></b></a>",nil)
end
end
if i<20 then
tfm.exec.movePlayer(name,100,45+(i-10)*40,false,0,0,false)
tfm.exec.setNameColor(name, 0x0000ff)
ui.updateTextArea(i,"<b><p align='center'><font face='arial' size='20' color='#0000FF'>"..name.."</font></p></b>",nil)
players[name].team="blue"
players[name].idplayer=i
if callback=="captain" then
ui.updateTextArea(i,"<b><p align='center'><font face='arial' size='20' color='#0000FF'>*"..name.."*</font></p></b>",nil)
players[name].team="bluecaptain"
end
elseif i<30 and i>=20 then
tfm.exec.movePlayer(name,700,45+(i-20)*40,false,0,0,false)
tfm.exec.setNameColor(name, 0xff0000)
ui.updateTextArea(i,"<b><p align='center'><font face='arial' size='20' color='#FF0000'>"..name.."</font></p></b>",nil)
players[name].team="red"
players[name].idplayer=i
if callback=="captain" then
ui.updateTextArea(i,"<b><p align='center'><font face='arial' size='20' color='#FF0000'>*"..name.."*</font></p></b>",nil)
players[name].team="redcaptain"
end
end
elseif callback=="spectate"then
if players[name].idplayer>0 then
if players[name].idplayer<19 then
ui.updateTextArea(players[name].idplayer,"<a href='event:join'><b><p align='center'><font face='arial' size='20' color='#0000FF'>Join</font></p></b></a>",nil)
elseif players[name].idplayer==19 then
ui.updateTextArea(players[name].idplayer,"<a href='event:captain'><b><p align='center'><font face='arial' size='20' color='#0000FF'>Become Captain</font></p></b></a>",nil)
elseif players[name].idplayer<29 then
ui.updateTextArea(players[name].idplayer,"<a href='event:join'><b><p align='center'><font face='arial' size='20' color='#FF0000'>Join</font></p></b></a>",nil)
elseif players[name].idplayer==29 then
ui.updateTextArea(players[name].idplayer,"<a href='event:captain'><b><p align='center'><font face='arial' size='20' color='#FF0000'>Become Captain</font></p></b></a>",nil)
end
end
players[name].team="white"
players[name].idplayer=0
tfm.exec.movePlayer(name,400,405,false,0,0,false)
tfm.exec.setNameColor(name, 0)
elseif callback=="blueready" and players[name].team=="bluecaptain" then
ui.updateTextArea(50,"<a href='event:bluenotready'><b><p align='center'><font face='arial' size='20' color='#0000FF'>Ready</font></p></b></a>" ,nil)
blueready=true
elseif callback=="redready" and players[name].team=="redcaptain" then
ui.updateTextArea(51,"<a href='event:rednotready'><b><p align='center'><font face='arial' size='20' color='#FF0000'>Ready</font></p></b></a>" ,nil)
redready=true
elseif callback=="bluenotready" and players[name].team=="bluecaptain" then
ui.updateTextArea(50,"<a href='event:blueready'><b><p align='center'><font face='arial' size='20' color='#0000FF'>Not Ready</font></p></b></a>" ,nil)
blueready=false
elseif callback=="rednotready" and players[name].team=="redcaptain" then
ui.updateTextArea(51,"<a href='event:redready'><b><p align='center'><font face='arial' size='20' color='#FF0000'>Not Ready</font></p></b></a>" ,nil)
redready=false
elseif callback=="bluename" and players[name].team=="bluecaptain" then
ui.addPopup(1, 2,"What do you want your team name to be?", name, 200, 100, 400, true)
elseif callback=="redname" and players[name].team=="redcaptain" then
ui.addPopup(2, 2,"What do you want your team name to be?", name, 200, 100, 400, true)
end
end
starterino=false

function eventPopupAnswer(id, name, answer)
if id==1 then
blueteamname=string.sub(answer, 1, 25)
ui.updateTextArea(53,"<a href='event:bluename'><b><p align='center'><font face='arial' size='20' color='#0000FF'>"..blueteamname.."</font></p></b></a>",nil)
elseif id==2 then
redteamname=string.sub(answer, 1, 25)
ui.updateTextArea(54,"<a href='event:redname'><b><p align='center'><font face='arial' size='20' color='#FF0000'>"..redteamname.."</font></p></b></a>",nil)
end
end

function eventLoop(time,remaining)
if selection==true then
if blueready==true and redready==true and starterino==false then
starterino=true
tfm.exec.setGameTime(3)
elseif blueready==false or redready==false then
ui.removeTextArea(52)
starterino=false
end
if remaining>=3000 and blueready==true and redready==true and starterino==true then
ui.addTextArea(52,"<b><p align='center'><font face='arial' size='20' color='#FFFFFF'>Starting Game in 3</font></p></b>" ,nil,300,300,200,30,0xffffff,0x212F36,0.2,false)
elseif remaining>=2000 and blueready==true and redready==true and starterino==true then
ui.updateTextArea(52,"<b><p align='center'><font face='arial' size='20' color='#FFFFFF'>Starting Game in 2</font></p></b>" ,nil)
elseif remaining>=1000 and blueready==true and redready==true and starterino==true then
ui.updateTextArea(52,"<b><p align='center'><font face='arial' size='20' color='#FFFFFF'>Starting Game in 1</font></p></b>" ,nil)
elseif remaining<=0 and blueready==true and redready==true and starterino==true then
ffa=true
selection=false
tfm.exec.newGame(maps[math.random(#maps)])
end
end
if ffa==true and win==false then
if time>=8000 then
ui.removeTextArea(4)
elseif time >=7000 then
ui.removeTextArea(2)
ui.addTextArea(4,"<b><font face='arial' size='50' color='#00FF00'>GO</font></b>" ,nil,355,330,100,60,0x324650,0x212F36,0,true)
if not started then
started=true
end
elseif time>=6000 then
ui.removeTextArea(3)
ui.addTextArea(2,"<b><font face='arial' size='50' color='#FF0000'>1</font></b>" ,nil,385,330,35,60,0x324650,0x212F36,0,true)
elseif time>=5000 then
ui.removeTextArea(1)
ui.addTextArea(3,"<b><font face='arial' size='50' color='#FF0000'>2</font></b>" ,nil,385,330,35,60,0x324650,0x212F36,0,true)
elseif time>=4000 then
ui.removeTextArea(9999)
ui.addTextArea(1,"<b><font face='arial' size='50' color='#FF0000'>3</font></b>" ,nil,385,330,35,60,0x324650,0x212F36,0,true)
elseif time>=0 then
ui.addTextArea(9999,"<b><font face='Impact' size='50' color='#FFFF00'>Get Ready</font></b>" ,nil,295,330,350,60,0x324650,0x212F36,0,true)
end
if remaining<=0 then
if bluepoints==10 or redpoints==10 then
tfm.exec.newGame(disco[math.random(#disco)])
else
tfm.exec.newGame(maps[math.random(#maps)])
end
end
for i,cannon in ipairs(toDespawn) do
if cannon[1] <= os.time()-1000 then
tfm.exec.removeObject(cannon[2])
table.remove(toDespawn,i)
end
end
end
if win==true then
if time>=3000 then
if cheese=="red" then
for name,player in pairs(tfm.get.room.playerList) do
if players[name].team=="red" or players[name].team=="redcaptain" then
tfm.exec.playEmote(name, 0)
else
tfm.exec.playEmote(name, 2)
end
end
elseif cheese=="blue" then
for name,player in pairs(tfm.get.room.playerList) do
if players[name].team=="blue" or players[name].team=="bluecaptain"then
tfm.exec.playEmote(name, 0)
else
tfm.exec.playEmote(name, 2)
end
end
end
end
if remaining<=0 then
selection=true
ffa=false
discobool=false
starterino=false
tfm.exec.newGame("@6396471")
tfm.exec.newGame("@6396471")
redpoints=0
bluepoints=0
blueready=false
redready=false
redteamname="Red Team"
blueteamname="Blue Team"
local i=1
while i<10 do
ui.removeTextArea(i,nil)
i=i+1
end
win=false
end
end
end


function eventPlayerDied(name)
if ffa==true and win==false then
local i=0
local n
for pname,player in pairs(tfm.get.room.playerList) do
if not player.isDead then
i=i+1
n=pname
end
end
if i==0 and win==false then
tfm.exec.newGame(maps[math.random(#maps)])
end
local redalive=0
local bluealive=0
for name, player in pairs(tfm.get.room.playerList) do
if players[name].team=="red" or players[name].team=="redcaptain" then
if not player.isDead then
redalive=redalive+1
end
elseif players[name].team=="blue" or players[name].team=="bluecaptain" then
if not player.isDead then
bluealive=bluealive+1
end
end
end
if redalive==0 then
bluepoints=bluepoints+1
for name, player in pairs(tfm.get.room.playerList) do
if players[name].team=="blue" or players[name].team=="bluecaptain" then
if not player.isDead then
tfm.exec.giveCheese(name)
tfm.exec.playerVictory(name)
end
end
end
tfm.exec.setGameTime(5)
elseif bluealive==0 then
redpoints=redpoints+1
for name, player in pairs(tfm.get.room.playerList) do
if players[name].team=="red" or players[name].team=="redcaptain" then
if not player.isDead then
tfm.exec.giveCheese(name)
tfm.exec.playerVictory(name)
end
end
end
tfm.exec.setGameTime(5)
end
end
end

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

Dernière modification le 1500934560000
Minerva
1500919800000
    • Minerva#3185
    • Profil
    • Derniers messages
    • Tribu
#6
[Modéré par Batt_mellamy, raison : Double post. Please edit your original post next time by clicking on your avatar/ username and pressing "Edit".]

Dernière modification le 1500934500000
Batt_mellamy
« Consul »
1500934620000
    • Batt_mellamy#0015
    • Profil
    • Derniers messages
    • Tribu
#7
  0
Answered!

If you are looking for scripts in the future, you can request it in the Script Requests thread.
  • Forums
  • /
  • Transformice
  • /
  • Archives
  • /
  • DOES ANYONE KNOW THE LEGIT FRANCE DEATHMATCH LUA CODE?
© Atelier801 2018

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

Version 1.27