fly = false chamane = false vampire = false bootcamp = false survivor = false quizz = false -- Liste des commandes commands = {"stop", "time", "color", "kill", "ch", "respawn", "meep", "help", "bc", "next"} -- Liste des cartes bootcamp pouvant être jouées (en attendant de pouvoir jouer une carte aléatoire d'une rotation) bootcampMaps = {"@1427980", "@161434", "@216173", "@172621", "@500000", "@3908151", "@512887","@374995", "@306365", "@155606", "@333002", "@172547", "@3734998", "@1737914", "@2989803", "@3136410", "@438449", "@976944", "@1595965", "@1636814", "@2009003", "@3804078", "@3768117", "@3799357", "@3278138", "@3311534", "@3779861", "@3576303", "@3780618", "@2789121", "@2811229", "@3659983", "@3759157", "@597804", "@2998268", "@2132250", "@3745158", "@3338283", "@3062939", "@3137929", "@3560999", "@3182487", "@3725142", "@3012311", "@3493456", "@343456", "@208056", "@881158", "@492399", "@268915", "@505619", "@397469", "@729863", "@184648", "@156720", "@541693"} -- Liste des cartes survivor pouvant être jouées (en attendant de pouvoir jouer une carte aléatoire d'une rotation) survivorMaps = {"@3540608","@492283","@1026249","@1545834","@1659906","@1659906","@3295213","@3699989","@741041","@489470","@395246","@292672","@306106","@3584123","@1522692","@3107377","@2387888","@3685564","@787131","@2408376","@3670885","@3620709","@3584826","@3587860","@3549404","@481676","@3550350","@3480467"} -- Durée d'un bootcamp (défaut: 6min soit 360 secondes) bootcampDuration = 360 tfm.exec.disableAfkDeath(true) tfm.exec.newGame() function eventNewPlayer(playerName) displayCredits(playerName) tfm.exec.bindKeyboard(playerName, 79, true) tfm.exec.bindKeyboard(playerName, 80, true) tfm.exec.respawnPlayer(playerName) if fly==true then tfm.exec.bindKeyboard(playerName,32,true) end if chamane==true then tfm.exec.setShaman(playerName) end end function eventPlayerDied(playerName) if bootcamp==true then tfm.exec.respawnPlayer(playerName) end if chamane==true then tfm.exec.setShaman(playerName) tfm.exec.respawnPlayer(playerName) end if survivor==true then tfm.exec.setPlayerScore(playerName, 1, true) if tfm.get.room.playerList[playerName].isShaman==true then tfm.exec.setPlayerScore(p, 0, false) tfm.exec.newGame(survivorMaps[math.random(#survivorMaps)]) for p,_ in pairs(tfm.get.room.playerList) do if tfm.get.room.playerList[p].isShaman==false then if tfm.get.room.playerList[p].isDead==false then tfm.exec.setPlayerScore(p, math.random(3) + 15, true) end end end else survivorShaman = "" nbSurv = 0 for p,_ in pairs(tfm.get.room.playerList) do if tfm.get.room.playerList[p].isShaman==false then if tfm.get.room.playerList[p].isDead==false then nbSurv = nbSurv + 1 end else survivorShaman = p end end if nbSurv <= 1 then tfm.exec.setPlayerScore(survivorShaman, 0, false) tfm.exec.newGame(survivorMaps[math.random(#survivorMaps)]) for p,_ in pairs(tfm.get.room.playerList) do if tfm.get.room.playerList[p].isShaman==false then if tfm.get.room.playerList[p].isDead==false then tfm.exec.setPlayerScore(p, math.random(3) + 15, true) end end end end end end end function eventPlayerWon(playerWon) if bootcamp==true then tfm.exec.respawnPlayer(playerWon) tfm.exec.setPlayerScore(playerWon, 20, true) end end function eventNewGame() displayCredits(nil) for p,_ in pairs(tfm.get.room.playerList) do tfm.exec.bindKeyboard(p,79,true) tfm.exec.bindKeyboard(p,80,true) if fly==true then tfm.exec.bindKeyboard(p,32,true) end if chamane==true then tfm.exec.setShaman(p) end end if vampire==true then hasVampired = false tfm.exec.setUIMapName("Mini-jeu : Vampire") end if fly==true then tfm.exec.setUIMapName("Mini-jeu : Fly") end if chamane==true then tfm.exec.setUIShamanName("Tout le monde !") tfm.exec.setUIMapName("Mini-jeu : Chamane") end if bootcamp==true then tfm.exec.setUIMapName("Mini-jeu : Bootcamp") end if survivor==true then tfm.exec.setUIMapName("Mini-jeu : Survivor") end end function eventKeyboard(playerName, keyCode, True, x, y) if keyCode==79 then displayGestionnaire(false, playerName) end if keyCode==80 then ui.addPopup(1, 2, "Entrez le code de la map que vous voulez jouer :", playerName, 300, 150, 200) end if fly==true then if keyCode==32 then tfm.exec.movePlayer(playerName, playerName.x, playerName.y, false, 0, -50, off) end end end function eventPopupAnswer(popupId, playerName, answer) if popupId==1 then if answer~="" then activate() tfm.exec.newGame(answer) end end end hasVampired = false function eventLoop(currentTime, timeRemaining) if vampire==true then if hasVampired==false then if timeRemaining<=105000 then tfm.exec.setVampirePlayer(randomPlayer()) hasVampired = true end end end if bootcamp==true then if timeRemaining<=0 then tfm.exec.newGame(bootcampMaps[math.random(#bootcampMaps)]) tfm.exec.setGameTime(bootcampDuration) end end if survivor==true then if timeRemaining<=0 then for p,_ in pairs(tfm.get.room.playerList) do if tfm.get.room.playerList[p].isShaman==false then tfm.exec.setPlayerScore(p, math.random(3) + 15, true) else tfm.exec.setPlayerScore(p, 0, false) end end tfm.exec.newGame(survivorMaps[math.random(#survivorMaps)]) end end end function eventChatCommand(playerName, message) if message=="stop" then activate() tfm.exec.newGame() end if message=="next" then if bootcamp==true then tfm.exec.disableAutoScore(true) tfm.exec.disableAutoShaman(true) tfm.exec.disableAfkDeath(true) tfm.exec.disableAutoTimeLeft(true) tfm.exec.disableAutoNewGame(true) tfm.exec.newGame(bootcampMaps[math.random(#bootcampMaps)]) tfm.exec.setGameTime(bootcampDuration) end end if message:sub(0, 2)=="bc" then if bootcamp==true then tfm.exec.disableAutoScore(true) tfm.exec.disableAutoShaman(true) tfm.exec.disableAfkDeath(true) tfm.exec.disableAutoTimeLeft(true) tfm.exec.disableAutoNewGame(true) tfm.exec.newGame(message:sub(4)) tfm.exec.setGameTime(bootcampDuration) end end if message:sub(0,4)=="time" then tfm.exec.setGameTime(message:sub(6)) end if message:sub(0,5)=="color" then if string.len(message) > 6 then tfm.exec.setNameColor(playerName, "0x"..message:sub(7).."") end end if message=="kill" then tfm.exec.killPlayer(playerName) end if message=="ch" then tfm.exec.setPlayerScore(playerName, 9001, add) end if message=="respawn" then if chamane==true then tfm.exec.setShaman(playerName) end if survivor==false then tfm.exec.respawnPlayer(playerName) end end if message=="meep" then tfm.exec.giveMeep(playerName) end if message=="help" then displayHelp(false, playerName) end end function eventTextAreaCallback(textAreaId, playerName, callback) if callback=="callbackClose" then displayHelp(true, playerName) elseif callback=="callbackCommands" then displayHelp(true, playerName) displayCommands(false, playerName) elseif callback=="callbackCloseCommands" then displayCommands(true, playerName) elseif callback=="callbackAccueilCommands" then displayCommands(true, playerName) displayHelp(false, playerName) elseif callback=="callbackMinijeux" then displayHelp(true, playerName) displayMinijeux(false, playerName) elseif callback=="callbackCloseMinijeux" then displayMinijeux(true, playerName) elseif callback=="callbackAccueilMinijeux" then displayMinijeux(true, playerName) displayHelp(false, playerName) elseif callback=="callbackCloseGestionnaire" then displayGestionnaire(true, playerName) elseif callback=="callbackBootcamp" then displayGestionnaire(true, playerName) activate("bootcamp") elseif callback=="callbackChamane" then displayGestionnaire(true, playerName) activate("chamane") elseif callback=="callbackFly" then displayGestionnaire(true, playerName) activate("fly") elseif callback=="callbackVampire" then displayGestionnaire(true, playerName) activate("vampire") elseif callback=="callbackSurvivor" then displayGestionnaire(true, playerName) activate("survivor") elseif callback=="callbackStop" then displayGestionnaire(true, playerName) activate(nil) end end function displayHelp(doClose, playerName) if doClose==true then ui.removeTextArea(3, playerName) ui.removeTextArea(4, playerName) ui.removeTextArea(5, playerName) ui.removeTextArea(6, playerName) else ui.addTextArea(3, "

Aide


Appuyez sur O pour lancer le gestionnaire de modules
Appuyez sur P pour jouer une carte

Quelle catégorie souhaiteriez-vous consulter ?
", playerName, 200, 100, 400, 200, 0x324650, 0x6A8FA2, 1f) ui.addTextArea(4, "x", playerName, 206, 105, 20, 30, 0x324650, 0x324650, 1f) ui.addTextArea(5, "

Commandes

", playerName, 275, 250, 100, 20, 0x3C5064, 0x3C5064, f1) ui.addTextArea(6, "

Mini-jeux

", playerName, 425, 250, 100, 20, 0x3C5064, 0x3C5064, f1) end end function displayCommands(doClose, playerName) if doClose==true then ui.removeTextArea(7, playerName) ui.removeTextArea(8, playerName) ui.removeTextArea(9, playerName) else ui.addTextArea(7, "

Commandes


!help : Affiche l'aide
!stop : Interrompt le mini-jeu en cours
!kill : Mourir instantanément
!respawn : Réapparaître instantanément
!ch : Vous serez chamane lors de la prochaine partie
!meep : Vous serez pourvu du pouvoir de meep
!time [secondes] : Modifie le temps de la partie en cours
!color [code héxadécimal] : Change la couleur de votre pseudo
!next : (mini-jeu bootcamp) Change de carte
!bc [@code] : (mini-jeu bootcamp) Joue une carte en bootcamp", playerName, 200, 90, 400, 220, 0x324650, 0x6A8FA2, 1f) ui.addTextArea(8, "x", playerName, 206, 105, 20, 30, 0x324650, 0x324650, 1f) ui.addTextArea(9, "←", playerName, 570, 105, 20, 30, 0x324650, 0x324650, 1f) end end function displayMinijeux(doClose, playerName) if doClose==true then ui.removeTextArea(10, playerName) ui.removeTextArea(11, playerName) ui.removeTextArea(12, playerName) else ui.addTextArea(10, "

Mini-jeux


• fly : Volez autant que vous le pouvez !
• chamane : Tout le monde béneficie des pouvoirs de chamane.
• vampire : Évitez le vampire !
• bootcamp : Un système intelligent d'entraînement au bootcamp.", playerName, 200, 100, 400, 200, 0x324650, 0x6A8FA2, 1f) ui.addTextArea(11, "x", playerName, 206, 105, 20, 30, 0x324650, 0x324650, 1f) ui.addTextArea(12, "←", playerName, 570, 105, 20, 30, 0x324650, 0x324650, 1f) end end function displayGestionnaire(doClose, playerName) if doClose==true then ui.removeTextArea(13, playerName) ui.removeTextArea(14, playerName) ui.removeTextArea(15, playerName) ui.removeTextArea(16, playerName) ui.removeTextArea(17, playerName) ui.removeTextArea(18, playerName) ui.removeTextArea(19, playerName) ui.removeTextArea(20, playerName) if bootcamp==true or chamane==true or vampire==true or fly==true or survivor==true or quizz==true then ui.removeTextArea(21, playerName) end else if bootcamp==true or chamane==true or vampire==true or fly==true or survivor==true or quizz==true then ui.addTextArea(13, "

Gestionnaire de mini-jeux

Veuillez selectionner le mini-jeu désiré :", playerName, 200, 100, 400, 235, 0x324650, 0x6A8FA2, 1f) else ui.addTextArea(13, "

Gestionnaire de mini-jeux

Veuillez selectionner le mini-jeu désiré :", playerName, 200, 100, 400, 200, 0x324650, 0x6A8FA2, 1f) end ui.addTextArea(14, "x", playerName, 205, 105, 20, 30, 0x324650, 0x324650, 1f) ui.addTextArea(15, "

Bootcamp

", playerName, 225, 200, 100, 20, 0x3C5064, 0x3C5064, f1) ui.addTextArea(16, "

Chamane

", playerName, 225, 250, 100, 20, 0x3C5064, 0x3C5064, f1) ui.addTextArea(17, "

Vampire

", playerName, 350, 200, 100, 20, 0x3C5064, 0x3C5064, f1) ui.addTextArea(18, "

Fly

", playerName, 350, 250, 100, 20, 0x3C5064, 0x3C5064, f1) ui.addTextArea(19, "

Survivor

", playerName, 475, 200, 100, 20, 0x3C5064, 0x3C5064, f1) ui.addTextArea(20, "

Coming soon...

", playerName, 475, 250, 100, 20, 0x3C5064, 0x3C5064, f1) if bootcamp==true or chamane==true or vampire==true or fly==true or survivor==true or quizz==true then ui.addTextArea(21, "

Arrêter le mini-jeu en cours

", playerName, 225, 300, 350, 20, 0x3C5064, 0x3C5064, f1) end end end function displayCredits(playerName) ui.addTextArea(2, "Module par Deathmatic & Allounett", NIL, 5, 375, 400, 20, 0x6A7495, 0x6A7495, 0f) end function activate(target) if target=="bootcamp" then fly = false chamane = false vampire = false survivor = false quizz = false bootcamp = true tfm.exec.disableAutoScore(true) tfm.exec.disableAutoShaman(true) tfm.exec.disableAutoTimeLeft(true) tfm.exec.disableAutoNewGame(true) tfm.exec.disableAfkDeath(true) tfm.exec.newGame(bootcampMaps[math.random(#bootcampMaps)]) tfm.exec.setGameTime(bootcampDuration) elseif target=="chamane" then fly = false vampire = false bootcamp = false survivor = false quizz = false chamane = true tfm.exec.disableAutoShaman(true) tfm.exec.disableAutoNewGame(true) tfm.exec.disableAfkDeath(true) tfm.exec.newGame(tfm.get.room.currentMap) elseif target=="fly" then chamane = false vampire = false bootcamp = false survivor = false quizz = false fly = true tfm.exec.disableAutoShaman(true) tfm.exec.disableAutoNewGame(true) tfm.exec.disableAfkDeath(true) tfm.exec.newGame(tfm.get.room.currentMap) elseif target=="vampire" then fly = false chamane = false bootcamp = false survivor = false quizz = false vampire = true tfm.exec.disableAutoShaman(true) tfm.exec.disableAutoNewGame(true) tfm.exec.disableAfkDeath(true) tfm.exec.newGame(tfm.get.room.currentMap) elseif target=="survivor" then fly = false chamane = false bootcamp = false vampire = false quizz = false survivor = true tfm.exec.disableAutoScore(true) tfm.exec.disableAutoNewGame(true) tfm.exec.disableAutoShaman(false) tfm.exec.disableAfkDeath(false) tfm.exec.newGame(survivorMaps[math.random(#survivorMaps)]) else vampire = false chamane = false fly = false bootcamp = false survivor = false quizz = false tfm.exec.disableAfkDeath(false) tfm.exec.disableAutoShaman(false) tfm.exec.disableAutoNewGame(false) tfm.exec.disableAutoScore(false) tfm.exec.disableAutoTimeLeft(false) tfm.exec.newGame() end end function randomPlayer() k = 1 for p,_ in pairs(tfm.get.room.playerList) do table[k] = p k = k + 1 end random = math.random(k) return table[random] end