Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- admins = {abdeltif=true, winjid=true,uditya=true}
- help_window_id = 1
- help_page_id = 2
- help_remove_id = 3
- help_previous_id= 4
- help_next_id = 5
- click_id = 6
- help_next_cb = "next"
- help_remove_cb = "remove"
- help_previous_cb= "previous"
- players = {}
- trolling = {}
- pages = {
- [1] = [[<p align="justify"><font size="16"><p align="center"><font size="24" color="#EB4538"><u>Fans Of Dumbledore</u></font></p>
- Welcome mice to the FOD tribe, In this tribe your ruler is <i>Adolf Hitler</i>.I know, it sounds random, but Hitler utterly owns this tribe , even Voldemort obeys him.
- Do not <a href='event:click'><u>disobey</u></a> him. You have been warned.
- </p></font>]],
- }
- delays = {
- teleport = 5000,
- sparkle = 5000
- }
- trolls = {
- "teleport",
- "sparkle",
- }
- ui.addTextArea(0, "<p align='center'><font size='38' color='#EB4846' face='Gabriola'>The <a href='event:info'>FOD</a> Tribe</font></p>", nil, 300, 23, 200, nil, nil, nil, 0, true)
- function eventNewPlayer(name) players[name] = {open = false, page = 1} end
- for k,v in pairs(tfm.get.room.playerList) do eventNewPlayer(k) end
- function show_help(name)
- local addx= 0
- local addy= 50
- local ww = 480
- local wh = 230
- local tw = 220
- local th = 43
- local Pw = 40 -- Number of page , called l for x and y
- local Ph = 20
- local dw = 20 -- For Next (>) and Previous (<)
- local dh = 20
- local rw = 20
- local rh = 20
- local wx = 400 - ww/2 + addx
- local wy = 200 - wh/2 + addy
- local tx = wx + ww/2 - tw/2
- local ty = wy - th - 8
- local px = wx
- local py = wy + wh + 8
- local nx = wx + ww - dw
- local ny = py
- local lx = wx + ww/2 - Pw/2
- local ly = py
- local rx = wx + ww - rw
- local ry = wy - rh - 8
- ui.addTextArea(help_window_id, pages[1], name, wx, wy, ww, wh, 0x55555E, 0x55555E, 0.97, true)
- ui.addTextArea(help_next_id, "<a href='event:"..help_next_cb.."'>></a>", name, nx, ny, dw, dh, 0x55555E, 0x55555E, 0.97, true)
- ui.addTextArea(help_previous_id, "<a href='event:"..help_previous_cb.."'><</a>", name, px, py, dw, dh, 0x55555E, 0x55555E, 0.97, true)
- ui.addTextArea(help_page_id, players[name].page.."/"..#pages, name, lx, ly, Pw, Ph, 0x55555E, 0x55555E, 0.97, true)
- ui.addTextArea(help_remove_id, "<a href='event:"..help_remove_cb.."'><font color='#ff2442'>X</font></a>", name, rx, ry, rw, rh, 0x55555E, 0x55555E, 0.97, true)
- players[name].open = true
- end
- function next_page(name, page)
- players[name].page = (players[name].page<#pages) and (players[name].page+1) or players[name].page
- ui.updateTextArea(help_window_id, pages[players[name].page], name)
- ui.updateTextArea(help_page_id, players[name].page.."/"..#pages, name)
- end
- function previous_page(name, page)
- players[name].page = (players[name].page>1) and (players[name].page-1) or players[name].page
- ui.updateTextArea(help_window_id, pages[players[name].page], name)
- ui.updateTextArea(help_page_id, players[name].page.."/"..#pages, name)
- end
- function hide_help(name)
- ui.removeTextArea(help_window_id, name)
- ui.removeTextArea(help_next_id, name)
- ui.removeTextArea(help_previous_id, name)
- ui.removeTextArea(help_page_id, name)
- ui.removeTextArea(help_remove_id, name)
- players[name].open = false
- players[name].page = 1
- end
- function clicked(name)
- if players[name].trolled == true then return end
- hide_help(name)
- local x = tfm.get.room.playerList[name].x
- local y = tfm.get.room.playerList[name].y
- ui.addTextArea(click_id, "You got trolled !", nil, x-50, y-30, 100, 0, 0x55555E, 0x55555E, 0.97, false)
- trolling[name] = {type=trolls[math.random(1,#trolls)], start=os.time()}
- players[name].trolled = true
- end
- function troll(name, typ, start)
- if typ == "teleport" then
- tfm.exec.movePlayer(name, math.random(100,700), math.random(50,350))
- elseif typ == "sparkle" then
- local x = tfm.get.room.playerList[name].x
- local y = tfm.get.room.playerList[name].y
- for xl = 1,20 do
- tfm.exec.displayParticle (math.random(1,2), x, y, 1*math.random(-12,12,0.1)/5, 1*math.random(-12,12,0.1)/5, 0, 0, nil)
- end
- end
- if os.time()>= start+delays[typ] then
- ui.removeTextArea(click_id)
- players[name].trolled = false
- return true
- else
- return false
- end
- end
- function eventTextAreaCallback(id, name, cb)
- if cb == "info" then
- if not players[name].open then
- show_help(name)
- else
- hide_help(name)
- end
- elseif cb == help_next_cb then
- next_page(name)
- elseif cb == help_previous_cb then
- previous_page(name)
- elseif cb == help_remove_cb then
- hide_help(name)
- elseif cb == "click" then
- clicked(name)
- end
- end
- function eventLoop(tr,rt)
- local to_remove = {}
- for k,v in pairs(trolling) do
- local b = troll(k, v.type, v.start)
- if b==true then
- to_remove[k] = true
- end
- end
- for k,v in pairs(to_remove) do
- trolling[k] = nil
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement