Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- By Nicolasledu
- alive = {}
- admin = {"Nicolasledu"}
- -- Le premier admin choisira la question
- -- admin = {"pseud 1", "pseudo2"}
- -- Ajouter autant d'admin que vous voulez.
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAfkDeath(true)
- tfm.exec.newGame("@5382897")
- tfm.exec.setUIMapName("Le jeu de la bombe ! | <r>@5382897")
- function eventNewPlayer(name)
- alive[name] = false
- ui.addTextArea(10, "En attente de la nouvelle partie", name, 10, 26, 780, 18)
- tfm.exec.respawnPlayer(name)
- tfm.exec.movePlayer(name,194,286)
- system.bindMouse("Nicolasledu",true)
- end
- function eventPlayerLeft(name)
- alive[name] = false
- end
- function eventMouse(playerName,x,y)
- tfm.exec.movePlayer(playerName,x,y)
- end
- for i,k in pairs(tfm.get.room.playerList) do
- eventNewPlayer(i)
- end
- function isAdmin(p)
- -- test "Si il est admin"
- for i,k in pairs(admin) do
- if k == p then return true end
- end
- return false
- end
- function start()
- for i,k in pairs(tfm.get.room.playerList) do
- if isAdmin(i) then
- alive[i] = "admin"
- tfm.exec.movePlayer(i,402,81)
- -- Téléportation des joueurs
- else
- alive[i] = true
- tfm.exec.movePlayer(i,603,286)
- end
- end
- ui.addPopup(1,2, "<p align='center'><b>Rentre la question ici :</b></p>", admin[1], 292, 150, 212)
- end
- function eventNewGame()
- start()
- end
- function eventPopupAnswer(idpopup, playerName, answer)
- if idpopup==1 then -- Set Question
- question = answer
- ui.addPopup(2,2, "<p align='center'><b>Rentre la réponse</b></p>", admin[1], 292, 150, 212)
- elseif idpopup==2 then -- Set Reponse
- reponse = string.lower(answer)
- for i,k in pairs(tfm.get.room.playerList) do
- if alive[i] == true then -- Si il est en vie, affiche la question, et fenêtre de réponse
- ui.addTextArea(10, "La question est : <BL>"..question.."", i, 10, 26, 780, 18)
- ui.addPopup(3,2, "<p align='center'><b>Rentrez votre réponse ici</b></p>", i, 292, 150, 212)
- elseif alive[i] == "admin" then
- ui.addTextArea(10, "<j>La question est : <BL>"..question.."<j> Et la réponse :<bl> "..reponse.."", i, 10, 26, 780, 18)
- else
- ui.addTextArea(10, "Tu es éliminé, mais la question est : <BL>"..question..".", i, 10, 26, 780, 18)
- end
- end
- elseif idpopup==3 then -- Joueurs donnent réponse
- if string.lower(answer)==tostring(reponse) and alive[playerName] then -- Si la réponse est juste
- ui.addPopup(3,2, " ", all, 50000, 1400000, 212,true)
- gagnant = playerName
- -- Affichage des pseudos au gagnant
- a = ""
- for i,k in pairs(tfm.get.room.playerList) do
- if alive[i] == true then
- a = a.."<a href='event:"..i.."'>"..i.."</a>\n"
- end
- end
- ui.addTextArea(100,a,gagnant,805,15)
- a = nil
- canvote = true
- ui.addTextArea(10, "<r><b>"..gagnant.."</b> <j>a trouvé la réponse ! La réponse était <r>"..reponse.."<j>, il peut maintenant choisir quelqu'un à éliminer", i, 10, 26, 780, 18)
- reponse = nil
- else -- Si elle l'est pas
- ui.addPopup(3,2, "<p align='center'><b>Rentrez votre réponse ici</b></p>", playerName, 292, 150, 212)
- end
- end
- end
- function eventTextAreaCallback(id,name,callback) -- Détection des liens cliquables
- if id == 100 and canvote then
- canvote = false
- alive[callback] = false
- tfm.exec.movePlayer(callback,194,286)
- b = 0
- ui.removeTextArea(100)
- for i,k in pairs(tfm.get.room.playerList) do
- if alive[i] == true then
- b = b + 1
- end
- end
- if b == 1 then
- ui.addTextArea(10, "<r>"..gagnant.."<j> a décidé d'éliminé <r>"..callback.."<j> ! Dommage pour elle/lui !<VP> Et "..gagnant.." a gagné la partie !!", i, 10, 26, 780, 18)
- local xp=tfm.get.room.playerList[gagnant].x
- local yp=tfm.get.room.playerList[gagnant].y
- drawCircle({{x=xp,y=yp},{x=xp+20,y=yp+20},5})
- drawCircle({{x=xp,y=yp},{x=xp+20,y=yp+20},29})
- drawCircle({{x=xp,y=yp},{x=xp+20,y=yp+20},29})
- else
- ui.addTextArea(10, "<r>"..gagnant.."<j> a décidé d'éliminé <r>"..callback.."<j> ! Dommage pour elle/lui ! <VP> Prochaine question dans pas longtemps", i, 10, 26, 780, 18)
- gagnant = nil
- ui.addPopup(1,2, "<p align='center'><b>Rentre la question ici :</b></p>", admin[1], 292, 150, 212)
- end
- gagnant = nil
- end
- end
- function drawCircle(arg)
- local point1,point2,particle=arg[1],arg[2],arg[3]
- r = math.sqrt(math.pow((point1.x-point2.x),2)+math.pow((point1.y-point2.y),2))
- res = 1-r*math.pow(10,-2)
- if res<0.1 then
- res =0.04
- end
- for i=0,2*math.pi,res do
- tfm.exec.displayParticle(particle,point1.x+r*math.cos(i),point1.y+r*math.sin(i),math.random(-1,1),math.random(-1,1),0,0)
- end
- end
- function eventChatCommand(joueur,commande)
- if joueur==admin[1] then
- if commande:sub(0,4)=="kill" then
- alive[commande:sub(6)] = false
- tfm.exec.movePlayer(commande:sub(6),194,286)
- elseif commande:sub(0,5) == "alive" then
- alive[commande:sub(7)] = true
- tfm.exec.movePlayer(commande:sub(7),603,286)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement