Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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("<font color='#BABD2F'>Mini-jeu :</font> <font color='#C2C2DA'>Vampire</font>")
- end
- if fly==true then
- tfm.exec.setUIMapName("<font color='#BABD2F'>Mini-jeu :</font> <font color='#C2C2DA'>Fly</font>")
- end
- if chamane==true then
- tfm.exec.setUIShamanName("Tout le monde !")
- tfm.exec.setUIMapName("<font color='#BABD2F'>Mini-jeu :</font> <font color='#C2C2DA'>Chamane</font>")
- end
- if bootcamp==true then
- tfm.exec.setUIMapName("<font color='#BABD2F'>Mini-jeu :</font> <font color='#C2C2DA'>Bootcamp</font>")
- end
- if survivor==true then
- tfm.exec.setUIMapName("<font color='#BABD2F'>Mini-jeu :</font> <font color='#C2C2DA'>Survivor</font>")
- 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, "<p align='center'><font color='#C2C2DA' size='35' >Aide</font></p><br /><b> Appuyez sur O pour lancer le gestionnaire de modules<br /> Appuyez sur P pour jouer une carte<br /></b> <font size='13'><br /> Quelle catégorie souhaiteriez-vous consulter ?</font>", playerName, 200, 100, 400, 200, 0x324650, 0x6A8FA2, 1f)
- ui.addTextArea(4, "<font size='15'><a href='event:callbackClose'>x</a></font>", playerName, 206, 105, 20, 30, 0x324650, 0x324650, 1f)
- ui.addTextArea(5, "<p align='center'><a href='event:callbackCommands'>Commandes</a></p>", playerName, 275, 250, 100, 20, 0x3C5064, 0x3C5064, f1)
- ui.addTextArea(6, "<p align='center'><a href='event:callbackMinijeux'>Mini-jeux</a></p>", 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, "<p align='center'><font color='C2C2DA' size='35' >Commandes</font></p><br /><b> !help :</b> Affiche l'aide<br /><b> !stop :</b> Interrompt le mini-jeu en cours<br /><b> !kill :</b> Mourir instantanément<br /><b> !respawn :</b> Réapparaître instantanément<br /><b> !ch :</b> Vous serez chamane lors de la prochaine partie<br /><b> !meep :</b> Vous serez pourvu du pouvoir de meep<br /><b> !time [secondes] :</b> Modifie le temps de la partie en cours<br /><b> !color [code héxadécimal] :</b> Change la couleur de votre pseudo<br /><b> !next :</b> (mini-jeu bootcamp) Change de carte<br /><b> !bc [@code] :</b> (mini-jeu bootcamp) Joue une carte en bootcamp", playerName, 200, 90, 400, 220, 0x324650, 0x6A8FA2, 1f)
- ui.addTextArea(8, "<font size='15'><a href='event:callbackCloseCommands'>x</a></font>", playerName, 206, 105, 20, 30, 0x324650, 0x324650, 1f)
- ui.addTextArea(9, "<font size='15'><a href='event:callbackAccueilCommands'>←</a></font>", 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, "<p align='center'><font color='C2C2DA' size='35' >Mini-jeux</font></p><br /><font color='#BABD2F'> • fly :</font> Volez autant que vous le pouvez !<br /><font color='#BABD2F'> • chamane :</font> Tout le monde béneficie des pouvoirs de chamane.<br /><font color='#BABD2F'> • vampire :</font> Évitez le vampire !<br /><font color='#BABD2F'> • bootcamp :</font> Un système intelligent d'entraînement au bootcamp.", playerName, 200, 100, 400, 200, 0x324650, 0x6A8FA2, 1f)
- ui.addTextArea(11, "<font size='15'><a href='event:callbackCloseMinijeux'>x</a></font>", playerName, 206, 105, 20, 30, 0x324650, 0x324650, 1f)
- ui.addTextArea(12, "<font size='15'><a href='event:callbackAccueilMinijeux'>←</a></font>", 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, "<p align='center'><font color='#C2C2DA' size='25' >Gestionnaire de mini-jeux</font><br><br>Veuillez selectionner le mini-jeu désiré :", playerName, 200, 100, 400, 235, 0x324650, 0x6A8FA2, 1f)
- else
- ui.addTextArea(13, "<p align='center'><font color='#C2C2DA' size='25' >Gestionnaire de mini-jeux</font><br><br>Veuillez selectionner le mini-jeu désiré :", playerName, 200, 100, 400, 200, 0x324650, 0x6A8FA2, 1f)
- end
- ui.addTextArea(14, "<font size='15'><a href='event:callbackCloseGestionnaire'>x</a></font>", playerName, 205, 105, 20, 30, 0x324650, 0x324650, 1f)
- ui.addTextArea(15, "<p align='center'><a href='event:callbackBootcamp'>Bootcamp</a></p>", playerName, 225, 200, 100, 20, 0x3C5064, 0x3C5064, f1)
- ui.addTextArea(16, "<p align='center'><a href='event:callbackChamane'>Chamane</a></p>", playerName, 225, 250, 100, 20, 0x3C5064, 0x3C5064, f1)
- ui.addTextArea(17, "<p align='center'><a href='event:callbackVampire'>Vampire</a></p>", playerName, 350, 200, 100, 20, 0x3C5064, 0x3C5064, f1)
- ui.addTextArea(18, "<p align='center'><a href='event:callbackFly'>Fly</a></p>", playerName, 350, 250, 100, 20, 0x3C5064, 0x3C5064, f1)
- ui.addTextArea(19, "<p align='center'><a href='event:callbackSurvivor'>Survivor</a></p>", playerName, 475, 200, 100, 20, 0x3C5064, 0x3C5064, f1)
- ui.addTextArea(20, "<p align='center'><a href='event:callbackCommingsoon'>Coming soon...</a></p>", 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, "<p align='center'><a href='event:callbackStop'>Arrêter le mini-jeu en cours</a></p>", 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement