Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- admin="Tat#0020"
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAfkDeath(true)
- p={}
- sobj={33,39,40,63,65,80,85,89,95,601,603,604}
- keys={0,1,2,3,32,74,75,76,69,72,17}
- keynames={"LEFT","UP","RIGHT","DOWN","SPACE","J","K","L","E","H","CTRL"}
- winners={}
- t={}
- events={"clickin", "clickout", "onekey"}--, "twokey", "wj", "leftright", ""}
- images={"red button", "Palkia", "Dialgia", "Pikachu", "Charizard", "Arceus"}
- imagepng={{img="156eece9479.png",x=-45,y=-45}, {img="1507bd184d2.png",x=-45,y=-43}, {img="1507bd14e17.png",x=-43,y=-45}, {img="156ef032d70.png",x=-38,y=-38}, {img="153dba45227.jpg",x=-33,y=-35}, {img="1507bd3749f.png",x=-43,y=-50}}
- players={}
- banned={""}
- start,event=false,false
- ends,eventon=false,false
- rounds,randomtime=999,0
- randomevent=0
- imgids={}
- keyids={}
- initialrounds=0
- tfm.exec.newGame('@6845392')
- function eventNewPlayer(name)
- p[name]={id=0, shamanobj=false, score=0, x=0, y=0, lastscore=0}
- system.bindMouse(name,true)
- for i=1,#keys do
- system.bindKeyboard(name,keys[i],true,true)
- end
- tfm.exec.respawnPlayer(name)
- table.insert(players,name)
- tfm.exec.movePlayer(name,t[#players].x,t[#players].y,false,0,0,false)
- ui.addTextArea(1,"",name,0,30,800,50,0x324650,0x212F36,0.8,true)
- end
- for name,player in pairs(tfm.get.room.playerList) do
- p[name]={id=0, shamanobj=false, score=0, x=0, y=0, lastscore=0}
- system.bindMouse(name,true)
- for i=1,#keys do
- system.bindKeyboard(name,keys[i],true,true)
- end
- end
- function eventNewGame()
- for i=1,10 do
- for j=1,3 do
- table.insert(t,{x=(i-1)*80+40, y=(j-1)*60+245})
- end
- end
- for i=1,#t do
- local change=math.random(i,#t)
- t[i],t[change]=t[change],t[i]
- end
- for name,player in pairs(tfm.get.room.playerList) do
- tfm.exec.setPlayerScore(name,0,false)
- local ban=false
- for i=1,#banned do
- if banned[i]==name then
- ban=true
- end
- end
- if ban==false then
- table.insert(players,name)
- end
- end
- for n=1,#players do
- p[players[n]]={id=0, shamanobj=false, score=0, x=0, y=0, lastscore=0}
- p[players[n]].x, p[players[n]].y=t[n].x,t[n].y
- tfm.exec.movePlayer(players[n],p[players[n]].x,p[players[n]].y,false,0,0,false)
- end
- ui.addTextArea(1,"Taptap: Hi, my name is Taptap and I will be your gamemaster for this minigame. You have to have fast hands and do what I say to get points!\nWaiting for <b>"..admin.."</b> to choose the number of rounds...",nil,0,30,800,50,0x324650,0x212F36,0.8,true)
- ui.addPopup(1,2,"Your are the admin. Type the number of rounds for this game:",admin,300,200,200,true)
- end
- function eventPopupAnswer(id,name,answer)
- if tonumber(answer)%1==0 and name==admin and id==1 then
- rounds=tonumber(answer)
- initialrounds=rounds
- start=true
- ui.updateTextArea(1,"Taptap: "..admin.." has chosen "..tostring(rounds).." rounds! Starting new game...",nil)
- timestamp=os.time()
- end
- end
- function eventsPlay()
- randomevent=math.random(1,#events)
- if events[randomevent]=="clickin" then
- shamorparticle()
- local random=math.random(1,#images)
- imgids[1]=tfm.exec.addImage(imagepng[random].img,"?1",imagepng[random].x+400,imagepng[random].y+150,nil)
- ui.updateTextArea(1,"<font size='20'>Taptap: Click on the "..images[random].." as many times as possible!</font>",nil)
- elseif events[randomevent]=="clickout" then
- shamorparticle()
- local random=math.random(1,#images)
- imgids[1]=tfm.exec.addImage(imagepng[random].img,"?1",imagepng[random].x+400,imagepng[random].y+150,nil)
- ui.updateTextArea(1,"<font size='20'>Taptap: Click anywhere other than the "..images[random].." as many times as possible!</font>",nil)
- elseif events[randomevent]=="onekey" then
- shamorparticle()
- local random=math.random(1,#keynames)
- keyids[1]=keys[random]
- ui.updateTextArea(1,"<font size='20'>Taptap: Press the "..keynames[random].." key as many times as possible!</font>",nil)
- end
- end
- function shamorparticle()
- for name,player in pairs(tfm.get.room.playerList) do
- local shamorparticles=math.random(0,2)
- if shamorparticle==1 then
- p[name].shamanobj=true
- p[name].id=sobj[math.random(1,#sobj)]
- else
- p[name].shamanobj=false
- p[name].id=math.random(0,42)
- end
- end
- end
- function eventLoop(time,remaining)
- if start==true and timestamp<=os.time()-3000 and rounds>0 then
- for i=1,#imgids do
- tfm.exec.removeImage(imgids[i])
- end
- ui.updateTextArea(1,"Taptap says...",nil)
- timestamp=os.time()
- randomtime=math.random(1000,10000)
- start,event=false,true
- elseif event==true and timestamp<=os.time()-randomtime then
- for name,player in pairs(tfm.get.room.playerList) do
- p[name].lastscore=player.score
- end
- eventsPlay()
- eventon=true
- timestamp=os.time()
- event,ends=false,true
- elseif ends==true and timestamp<=os.time()-10000 then
- ui.updateTextArea(1,"Time's up! Starting new game...",nil)
- ends,eventon=false,false
- rounds=rounds-1
- timestamp=os.time()
- start=true
- randomevent=0
- elseif rounds<=0 then
- ui.updateTextArea(1,"The rounds are over!",nil)
- for i=1,#imgids do
- tfm.exec.removeImage(imgids[i])
- end
- end
- end
- function eventMouse(name,x,y)
- if randomevent==1 then
- if eventon==true and math.sqrt((x-400)^2+(y-150)^2)<=50 then
- p[name].score=p[name].score+1
- tfm.exec.setPlayerScore(name,1,true)
- if p[name].shamanobj==false then
- tfm.exec.displayParticle (p[name].id,x,y,math.random(-5,5),math.random(-5,5),0,0,nil)
- else
- tfm.exec.addShamanObject(p[name].id,x,y,math.random(0,360), math.random(-5,5), math.random(-5,5), false)
- end
- elseif eventon==true and math.sqrt((x-400)^2+(y-150)^2)>50 then
- tfm.exec.chatMessage("You are not clicking on the image!",name)
- end
- elseif randomevent==2 then
- if eventon==true and math.sqrt((x-400)^2+(y-150)^2)<=50 then
- tfm.exec.chatMessage("You are clicking on the image! Read my instructions!",name)
- elseif eventon==true and math.sqrt((x-400)^2+(y-150)^2)>50 then
- p[name].score=p[name].score+1
- tfm.exec.setPlayerScore(name,1,true)
- if p[name].shamanobj==false then
- tfm.exec.displayParticle (p[name].id,x,y,math.random(-5,5),math.random(-5,5),0,0,nil)
- else
- tfm.exec.addShamanObject(p[name].id,x,y,math.random(0,360), math.random(-5,5), math.random(-5,5), false)
- end
- end
- end
- end
- function eventKeyboard(name,key,down,x,y)
- if randomevent==3 then
- if key==keyids[1] then
- p[name].score=p[name].score+1
- tfm.exec.setPlayerScore(name,1,true)
- if p[name].shamanobj==false then
- tfm.exec.displayParticle (p[name].id,x,y,math.random(-5,5),math.random(-5,5),0,0,nil)
- else
- tfm.exec.addShamanObject(p[name].id,x,y,math.random(0,360), math.random(-5,5), math.random(-5,5), false)
- end
- else
- tfm.exec.chatMessage("That's not the correct key! Try again!",name)
- end
- end
- end
- function eventChatCommand(name,message)
- if message=="speed" then
- local score=0
- for k,v in pairs(tfm.get.room.playerList) do
- if k==name then
- score=v.score
- end
- end
- tfm.exec.chatMessage(name.."-Average speed: "..tostring(p[name].score/((initialrounds-rounds)*10)).." taps per second, Speed last round: "..tostring((score-p[name].lastscore)/10).." taps per second.")
- end
- end
- function eventPlayerLeft(name)
- for i=1,#players do
- if name==players[i] then
- table.remove(players,i)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment