Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tagger=nil
- math.randomseed(os.time())
- despawn = 0
- function main()
- tfm.exec.disableAutoShaman(true)
- end
- function checkTagger()
- local players={}
- for name,_ in pairs(tfm.get.room.playerList) do
- table.insert(players, name)
- end
- for player in pairs(players) do
- if player==tagger then
- return true
- elseif tagger==nil or name~=tagger then
- return players[math.random(#players)]
- end
- end
- end
- function eventKeyboard(name, key, down, x, y)
- if key == 32 and name == tagger then
- for name, player in pairs(tfm.get.room.playerList) do
- if tagger ~= name then
- if pythag(x, y, player.x, player.y, 30) == true then
- tfm.exec.killPlayer(name)
- end
- end
- end
- end
- end
- function eventLoop()
- if text then
- despawn = despawn + 0.5
- if despawn == 4 then
- ui.removeTextArea(1)
- ui.removeTextArea(2)
- despawn = 0
- text = not text
- end
- end
- end
- function eventNewGame()
- text=true
- tagger=nil
- tagger=checkTagger()
- ui.addTextArea(1, "<b><R>You are the tagger!", tagger, 335, 23, 130)
- for name in pairs(tfm.get.room.playerList) do
- if name~=tagger then
- ui.addTextArea(2, "<V><b><p align = 'center'>"..tagger.." <N>is the tagger, run away!", name, 275, 23, 250)
- end
- end
- end
- function pythag(x1,y1,x2,y2,r)
- local x=x2-x1
- local y=y2-y1
- local r=r+r
- return x*x+y*y<r*r
- end
- function eventNewPlayer(name)
- tfm.exec.bindKeyboard(name, 32, true, true)
- end
- for i,p in pairs(tfm.get.room.playerList) do
- eventNewPlayer(i)
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement