Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tfm.exec.disableAutoShaman(true)
- errors=0
- timer=false
- time=20
- vote={}
- function getHighestVote()
- local cand={name="hi",votes=0}
- for n,p in pairs(tfm.get.room.playerList) do
- if vote[n].votes>=cand.votes then
- cand={name=n,votes=votes[n].votes}
- end
- end
- return cand.name
- end
- function eventNewPlayer(name)
- table.insert(vote,name)
- vote[name]={votes=0}
- end
- for i,v in ipairs(tfm.get.room.playerList) do eventNewPlayer(i) end
- function eventNewGame()
- tfm.exec.disableAutoTimeLeft(true)
- for i,v in ipairs(tfm.get.room.playerList) do tfm.exec.killPlayer(i)
- ui.addPopup(0,2,'Vote for your next shaman:',i,v.x,v.y,100)
- end
- timer=true
- end
- function eventLoop()
- if timer then
- time=time-1
- for i,v in ipairs(tfm.get.room.playerList) do
- ui.addTextArea(0,'<font color="#AA0000" size="20">'..(time/2)..'</font>',i,v.x+50,v.y-30,30,30)
- end
- if time<=0 then
- timer=false
- for i,v in ipairs(tfm.get.room.playerList) do
- tfm.exec.respawnPlayer(i)
- tfm.exec.setShaman(getHighestVote())
- tfm.exec.disableAutoTimeLeft(false)
- end
- end
- end
- end
- function eventPopupAnswer(id,name,answer)
- if id==0 then
- if vote[answer]==nil then errors=errors+1
- else vote[answer].votes=vote[answer].votes+1
- end
- end
- end
- tfm.exec.newGame('#0')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement