Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- admin = { "Podoko", "Pseudo", "Pseudo" } -- Remplacez "Pseudo" par "Votre pseudo"
- mapList = { "1", "2", "@3014000", "@3471523", "@4087743",
- "@3998852", "@3997006", "@423670", "@4672806", "@3758121",
- "@4160083", "@4057776", "@825035", "@469280", "@1081762",
- "@1933292", "@2734103", "@204059", "@251430", "@3464359",
- "@2746128", "@523865", "@3296031", "@3630912", "@1474189",
- } -- Pour ajouter vos maps : ,"@code1", "@code2"
- --------------------------------------
- -- Évitez de toucher à ce qui suit --
- --------------------------------------
- mapHistory = { 0 }
- nbMapL = 0
- nbMapH = 0
- parametre = { ["Fromages pour tous"] = false, ["Respawn auto"] = false, ["Chamane auto"] = true,
- ["Nouvelle map auto"] = true, ["Temps automatique"] = true, ["Compte des points"] = true,
- ["Mort des afk"] = true,
- ["Tous vampires"] = false, ["Meep pour tous"] =false, ["Tous chamanes"] = false,
- ["Compétences"] = true , ["Temps par défaut"] = 120
- }
- parametreJ = { ch="Chamane", fromage="Fromage", vampire="Vampire",
- meep="Meep", tuer="Tuer", rez="Respawn", win="Victoire",
- fly="Voler", tp="Téléporter"
- }
- aff = { lJoueurs ={} , joueur = {} , param = {}
- }
- all = { fly = false , tp = false }
- joueur = {}
- dernierProfil = {}
- for k, v in pairs (tfm.get.room.playerList) do
- joueur[k] = {}
- joueur[k]["fly"] = false
- joueur[k]["tp"] = false
- end
- for k, pseudo in pairs(admin) do
- ui.addTextArea (1, "<p align='center'><b><a href='event:time'>time</a></b></p>", pseudo, 60, 30, 35, 20, 0x324650, 0x324650, 1, true)
- ui.addTextArea (2, "<p align='center'><b><a href='event:joueurs'>joueurs</a></b></p>", pseudo, 110, 30, 80, 20, 0x324650, 0x324650, 1, true)
- ui.addTextArea (3, "<p align='center'><b><a href='event:parametre'>paramètres</a></b></p>", pseudo, 205, 30, 80, 20, 0x324650, 0x324650, 1, true)
- ui.addTextArea (4, "<p align='center'><b><a href='event:map'>map</a></b></p>", pseudo, 10, 30, 35, 20, 0x324650, 0x324650, 1, true)
- ui.addTextArea (5, "<font size='15' color='#1'><b> <a href='event:-1'>< </a> <a href='event:repeat'>|| </a> <a href='event:+1'>></a> <a href='event:random'>R</a></b></font>", pseudo, 300, 30, 120, 20, 0,0,1, true)
- for l, m in pairs ( aff ) do
- aff[l][pseudo] = false
- end
- end
- function eventTextAreaCallback(id, source, callback)
- if callback == 'time' then
- ui.addPopup (0, 2, "time to set", source, 10, 70, 150, true)
- elseif callback == 'map' then
- ui.addPopup (1, 2, "map to play", source, 10, 70, 150, true)
- elseif callback == 'joueurs' then
- if aff["lJoueurs"][source] == false then
- affLJoueurs ( source )
- else
- effLJoueurs ( source )
- end
- elseif callback == 'parametre' then
- if aff["param"][source] == false then
- affParam( source )
- else
- effParam( source )
- end
- elseif parametre[callback] ~= nil then
- paraGestion(callback, source )
- ui.updateTextArea (id, callback .. ": <a href='event:" .. callback .. "'>" .. B(parametre[callback]) .. "</a>", source )
- elseif joueur[callback] ~= nil or callback == "all" then
- if aff["joueur"][source] then
- effJoueur ( source )
- if callback ~= dernierProfil[source] then
- eventTextAreaCallback(id, source, callback)
- end
- else
- affJoueur(source, callback)
- ui.updateTextArea (id, "<p align='center'><b><V><a href='event:" .. callback .. "'>" .. callback .. "</a></N></b></p>", source)
- end
- dernierProfil[source] = callback
- elseif parametreJ[callback] ~= nil then
- if dernierProfil[source] == "all" then
- for k, v in pairs ( joueur ) do
- if all[callback] ~= nil then
- joueur[k][callback] = all[callback]
- end
- paraJGestion ( k, callback )
- end
- all[callback] = not all[callback]
- else
- paraJGestion ( dernierProfil[source], callback )
- end
- elseif id == 5 then
- mapGestion(callback)
- end
- end
- function eventPopupAnswer (id, playerName, answer)
- if id == 0 then
- tfm.exec.setGameTime(answer, true)
- elseif id == 1 then
- tfm.exec.newGame(answer)
- elseif id == 3 then
- parametre["Temps par défaut"] = answer
- end
- end
- function eventChatCommand ( name, command )
- M = 1
- LM = {}
- for w in string.gmatch(command, "%a+") do
- LM[M] = w
- M = M+1
- end
- if command == "commande" then
- listeCommande = ""
- for k, v in pairs ( parametreJ ) do
- listeCommande = listeCommande.."\n!"..k.." [Pseudo] => "..v
- end
- ui.addPopup (0, 3, "Liste des commandes et de leur équivalent dans le menu : \n"..listeCommande, name, 10, 80, 200, true)
- else
- if isAdmin ( name ) then
- if parametreJ[LM[1]] ~= nil then
- if joueur[LM[2]] ~= nil then
- paraJGestion ( LM[2], LM[1] )
- else
- ui.addPopup (0, 3, "Je ne trouve pas "..LM[2].." dans le salon. \nNe me tapez pas :(", name, 515, 325, 280, true)
- end
- else
- ui.addPopup (0, 3, "Je ne connais pas cette commande. Tapez !commande pour voir la liste des commandes.", name, 515, 325, 280, true)
- end
- else
- ui.addPopup (0, 3, "Tu n'as pas le droit d'utiliser cette commande :/", name, 515, 340, 280, true)
- end
- end
- end
- function affLJoueurs(playerName)
- aff["lJoueurs"][playerName] = true
- if aff["param"][playerName] then
- effParam ( playerName )
- end
- ui.addTextArea(1000, "<p align='center'><a href='event:all'>all</a></p>", playerName, 110, 65, 80, 20, 0x324650, 0x324650, 1, true)
- a=1
- for k, v in pairs(joueur) do
- ui.addTextArea(1000+a, "<p align='center'><a href='event:" ..k.. "'>" .. k .. "</a></p>", playerName, 110-100*math.floor(a/10), 65+35*(a%10), 80, 20, 0x324650, 0x324650, 1, true)
- a=a+1
- end
- end
- function effLJoueurs(playerName)
- aff["lJoueurs"][playerName] = false
- if aff["joueur"][playerName] then
- effJoueur ( playerName )
- end
- for k=a+1000,1000,-1 do
- ui.removeTextArea(k, playerName)
- end
- end
- function affParam(playerName)
- aff["param"][playerName] = true
- if aff["lJoueurs"][playerName] then
- effLJoueurs ( playerName )
- end
- b=0
- for k, v in pairs(parametre) do
- ui.addTextArea (b+2000, k.." : <a href='event:"..k.."'>"..B(v).."</a>" , playerName, 10+185*math.floor(b/6), 65+35*(b % 6), 170, 20, 0x324650, 0x324650, 1, true)
- b=b+1
- end
- end
- function effParam(playerName)
- aff["param"][playerName] = false
- for k=b,0,-1 do
- ui.removeTextArea(k+2000, playerName)
- end
- end
- function affJoueur ( playerName, callback )
- aff["joueur"][playerName] = true
- c = 0
- for k, v in pairs ( parametreJ ) do
- c = c+1
- ui.addTextArea (c+3000, "<a href='event:"..k.."'>"..v.."</a>", playerName, 205, 30+35*c, 60, 20, 0x324650, 0x324650, 1, true)
- end
- end
- function effJoueur ( playerName )
- aff["joueur"][playerName] = false
- for k = c, 0, -1 do
- ui.removeTextArea( k+3000, playerName )
- end
- end
- function B(v)
- if type(v) == "boolean" then
- if v==true then
- return "<v><b>true</b></v>"
- else
- return "<r><b>false</b></r>"
- end
- else
- return "<b> "..v.." </b>"
- end
- end
- function paraGestion ( paraModif , playerName)
- if type(parametre[paraModif]) == "boolean" then
- parametre[paraModif] = not parametre[paraModif]
- end
- if paraModif == "Fromages pour tous" and parametre[paraModif] then
- for k, v in pairs (joueur) do
- tfm.exec.giveCheese ( k )
- end
- elseif paraModif == "Respawn auto" and parametre[paraModif] then
- for k, v in pairs (joueur) do
- tfm.exec.respawnPlayer ( k )
- end
- elseif paraModif == "Chamane auto" then
- tfm.exec.disableAutoShaman( not parametre[paraModif] )
- elseif paraModif == "Nouvelle map auto" then
- tfm.exec.disableAutoNewGame ( not parametre[paraModif] )
- elseif paraModif == "Temps automatique" then
- tfm.exec.disableAutoTimeLeft ( not parametre[paraModif] )
- elseif paraModif == "Compte des points" then
- tfm.exec.disableAutoScore ( not parametre[paraModif] )
- elseif paraModif == "Mort des afk" then
- tfm.exec.disableAfkDeath ( not parametre[paraModif] )
- elseif paraModif == "Temps par défaut" then
- ui.addPopup (3, 2, "enter default map time", playerName, 200, 200, 150, true)
- elseif paraModif == "Tous vampires" and parametre[paraModif] then
- for k, v in pairs ( joueur ) do
- tfm.exec.setVampirePlayer ( k )
- end
- elseif paraModif == "Meep pour tous" and parametre[paraModif] then
- for k, v in pairs ( joueur ) do
- tfm.exec.giveMeep ( k )
- end
- elseif paraModif == "Tous chamanes" and parametre[paraModif] then
- for k, v in pairs ( joueur ) do
- tfm.exec.setShaman ( k )
- end
- elseif paraModif == "Compétences" then
- tfm.exec.disableAllShamanSkills ( not parametre[paraModif] )
- end
- end
- function paraJGestion ( playerName, action )
- if action == "fromage" then
- tfm.exec.giveCheese ( playerName )
- elseif action == "ch" then
- tfm.exec.setShaman ( playerName )
- elseif action == "vampire" then
- tfm.exec.setVampirePlayer ( playerName )
- elseif action == "meep" then
- tfm.exec.giveMeep ( playerName )
- elseif action == "tuer" then
- tfm.exec.killPlayer ( playerName )
- elseif action == "rez" then
- tfm.exec.respawnPlayer ( playerName )
- elseif action == "win" then
- tfm.exec.giveCheese ( playerName )
- tfm.exec.playerVictory ( playerName )
- elseif action == "fly" then
- joueur[playerName]["fly"] = not joueur[playerName]["fly"]
- tfm.exec.bindKeyboard (playerName, 32, true, joueur[playerName]["fly"])
- if joueur[playerName]["fly"] then
- ui.addPopup (10, 3, "Tu peux voler, appuie sur espace :)", playerName, 400, 200, 220, true)
- else
- ui.addPopup (10, 3, "Tu ne peux plus voler :(", playerName, 400, 200, 220, true)
- end
- elseif action == "tp" then
- joueur[playerName]["tp"] = not joueur[playerName]["tp"]
- system.bindMouse ( playerName, joueur[playerName]["tp"] )
- if joueur[playerName]["tp"] then
- ui.addPopup (10, 3, "Tu peux te téléporter, cli clic :)", playerName, 400, 200, 200, true)
- else
- ui.addPopup (10, 3, "Tu ne peux plus te téléporter :(", playerName, 400, 200, 200, true)
- end
- end
- end
- function mapGestion (action)
- if action == 'random' then
- nbMapL = math.random(#mapList)
- tfm.exec.newGame(mapList[nbMapL])
- elseif action == 'repeat' then
- tfm.exec.newGame(tfm.get.room.currentMap)
- else
- if action == '-1' and (nbMapL + action) > 0 then
- nbMapL = nbMapL -1
- tfm.exec.newGame ( mapList[nbMapL] )
- elseif action == '+1' and (nbMapL + action) <= #mapList then
- nbMapL = nbMapL + 1
- tfm.exec.newGame ( mapList[nbMapL] )
- end
- end
- end
- function eventNewPlayer ( playerName )
- print ( playerName .. " vient d'entrer dans le salon \o/" )
- joueur[playerName] = {}
- joueur[playerName]["fly"] = all["fly"]
- joueur[playerName]["tp"] = all["tp"]
- if parametre["Respawn auto"] then
- tfm.exec.respawnPlayer ( playerName )
- end
- end
- function eventPlayerLeft ( playerName )
- print ( playerName.. " vient de quitter le salon :(" )
- joueur[playerName] = nil
- end
- function eventPlayerDied ( playerName )
- if parametre["Respawn auto"] then
- tfm.exec.respawnPlayer ( playerName )
- end
- end
- function eventPlayerWon ( playerName )
- if parametre["Respawn auto"] then
- tfm.exec.respawnPlayer ( playerName )
- end
- end
- function eventNewGame ()
- if tfm.get.room.currentMap ~= mapHistory[nbMap] then
- nbMapH = nbMapH
- mapHistory[nbMapH] = tfm.get.room.currentMap
- end
- tfm.exec.setGameTime ( parametre["Temps par défaut"] )
- for k, v in pairs ( joueur ) do
- eventPlayerRespawn ( k )
- end
- end
- function eventPlayerRespawn ( playerName )
- if parametre["Fromages pour tous"] then
- tfm.exec.giveCheese ( playerName )
- end
- if parametre["Tous chamanes"] then
- tfm.exec.setShaman ( playerName )
- end
- if parametre["Tous vampires"] then
- tfm.exec.setVampirePlayer ( playerName )
- end
- if parametre["Meep pour tous"] then
- tfm.exec.giveMeep ( playerName )
- end
- end
- function eventKeyboard (playerName, keyCode, down, xPlayerPosition, yPlayerPosition)
- if keyCode == 32 then
- tfm.exec.movePlayer(playerName,0,0,true,0,-50,false)
- end
- end
- function eventMouse (playerName, xMousePosition, yMousePosition)
- tfm.exec.movePlayer(playerName,xMousePosition,yMousePosition,false,0,0,true)
- end
- function isAdmin ( name )
- for k, v in pairs( admin ) do
- if name == v then
- return true
- end
- end
- return false
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement