Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local TFM = tfm.exec
- local ROOM = tfm.get.room
- local p = {}
- local module = {
- admins = {"Noooooooorr#0000", ({pcall(nil)})[2]:match".-#%d+"},
- images = {
- {"17869d1e79b.png", 580/2, 380/2},
- {"17869d22f39.jpg", 550/2, 352/2},
- {"17869d30f0a.png", 580/2, 382/2},
- {"17869d267dd.jpg", 550/2, 352/2},
- {"17869d11fdb.png", 580/2, 380/2},
- mice = {
- --Here you can put your mouse as the gift giver
- --{"img", x, y, "The mouse's name(don't forget the tag!!!!!)"},
- {"1786b2603f8.png", 32, 28, "Noooooooorr#0000"},
- {"17879ef7618.png", 40, 32, "Snowvlokje#4925"},
- },
- gifts = {
- --Here you can add more items to the fake gift
- --The script will choose a random item to make it as a gift
- --{"the item image", x, y, isAfur}
- {"178799ff930.png", 21, 23.5, true},
- {"17879a020ba.png", 21.5, 23.5, true},
- },
- }
- }
- ---translations source: https://projects.fewfre.com/a801/tools/translation_fetcher
- local translations = {
- ar = {
- readMessage = "البطاقة قراءة",
- thank = "شكر", --Remercier
- close = "إغلاق", --bouton.fermer
- getBadge = "لقد فزت بوسام جديد", --GainBadge
- alreadyPranked = "<bl>تم مقلبته بالفعل <g>%s</g> اللاعب</bl>",
- april_fool = "<font color='#912b79'>لقد وقعت بالفخ ، إنها كذبة أبريل\nXD</font>"
- },
- br = {
- readMessage = "Ler a mensagem",
- thank = "Agradecer",
- close = "Fechar",
- getBadge = "Você ganhou uma nova medalha!",
- },
- en = {
- readMessage = "Read the card",
- thank = "Reply",
- close = "Close",
- getBadge = "You won a new badge!",
- alreadyPranked = "<bl>You have already tricked <g>%s</g></bl>",
- april_fool = "<font color='#912b79'>It's April Fool !!! \nSorry for that XD</font>"
- },
- fr = {
- readMessage = "Voir le message",
- thank = "Remercier",
- close = "Fermer",
- getBadge = "Vous avez gagné un nouveau badge !",
- },
- }
- local translate = function (id, name)
- if p[name] then
- if translations[p[name].langue] then
- if translations[p[name].langue][id] then
- return translations[p[name].langue][id]
- else
- return translations["en"][id]
- end
- elseif translations["en"] then
- return translations["en"][id]
- else
- return "error"
- end
- end
- end
- local loadImagesForLaggers = function (name)
- for i = 1,5 do
- local img = module.images[i]
- TFM.addImage(img[1], "?0", 0, 0, name, 0.01, 0.01)
- end
- end
- local nameInTextAreawithBorder = function (id, x, y, theName, borderColor, name)
- local hashtagFormat = string.find(theName, "(%d%d%d%d)")
- local hashtag, mainName = string.sub(theName, hashtagFormat, #theName), string.sub(theName, 1, hashtagFormat - 1)
- ui.addTextArea(100 + id, "<p align='center'><b><font color = '#"..borderColor.."'>"..mainName.."<font size = '8'><i> #</i></font><font size = '10'>"..hashtag.."</font></g>", name, x - 44, y - 26, 150, 60, 0x0121, 0x0121, 0, true)
- ui.addTextArea(200 + id, "<p align='center'><b><font color = '#"..borderColor.."'>"..mainName.."<font size = '8'><i> #</i></font><font size = '10'>"..hashtag.."</font></g>", name, x - 46, y - 26, 150, 60, 0x0121, 0x0121, 0, true)
- ui.addTextArea(300 + id, "<p align='center'><b><font color = '#"..borderColor.."'>"..mainName.."<font size = '8'><i> #</i></font><font size = '10'>"..hashtag.."</font></g>", name, x - 46, y - 24, 150, 60, 0x0121, 0x0121, 0, true)
- ui.addTextArea(400 + id, "<p align='center'><b><font color = '#"..borderColor.."'>"..mainName.."<font size = '8'><i> #</i></font><font size = '10'>"..hashtag.."</font></g>", name, x - 44, y - 24, 150, 60, 0x0121, 0x0121, 0, true)
- ui.addTextArea(500 + id, "<p align='center'><b>"..mainName.."<g><font size = '8'><i> #</i></font><font size = '10'>"..hashtag.."</font></g>", name, x - 45, y - 25, 150, 60, 0x0121, 0x0121, 0, true)
- end
- local removeNameTextarea = function (id, name)
- for i = 1,5 do
- ui.removeTextArea((i*100) + id, name)
- end
- end
- local closeGift = function (name)
- removeNameTextarea (1, name)
- if p[name].imgs then
- for i = 1, #p[name].imgs do
- if p[name].imgs[i] then
- TFM.removeImage(p[name].imgs[i])
- ui.removeTextArea(i, name)
- end
- end
- end
- end
- local gift = function (name, openGift)
- if not p[name].gotPranked then
- closeGift (name)
- for i = 1,3 do
- local img, callback = module.images[i], "openGift"
- if i == 2 and openGift then img = module.images[4] elseif openGift then callback = "readMessage" end
- p[name].imgs[i] = TFM.addImage(img[1], ":1", 400 - img[2], 210 - img[3], name)
- ui.addTextArea(2, "<p align='center'><a href='event:" .. callback .. "'><font size = '60'>\n\n\n\n\n\n\n", name, 125, 24, 550, 500, 0x0121, 0x0121, 0, true)
- ui.addTextArea(1, "<p align='center'>" .. translate("readMessage", name), name, 350, 365, 100, 50, 0x0, 0x0, 0, true)
- end
- if openGift then
- local furIMG = module.images.gifts[math.random(#module.images.gifts)]
- p[name].imgs[#p[name].imgs+1] = TFM.addImage(furIMG[1], ":1", 395 - furIMG[2], 175 - furIMG[3], name)
- if furIMG[4] then
- TFM.chatMessage("<j>" .. translate("getBadge", name), name)
- end
- end
- if not p[name].gifter then p[name].gifter = module.images.mice[math.random(#module.images.mice)] end
- local x, y = 158 + p[name].gifter[2] , 204 + p[name].gifter[3]
- p[name].imgs[#p[name].imgs + 1] = TFM.addImage(p[name].gifter[1], "&5", x, y, name)
- nameInTextAreawithBorder (1, x , y+10, p[name].gifter[4], "000000", name)
- end
- end
- local letter = function (name)
- closeGift (name)
- local img = module.images[5]
- p[name].imgs[1] = TFM.addImage(img[1], ":1", 400 - img[2], 210 - img[3], name)
- TFM.chatMessage(translate("april_fool", name), name)
- ui.addTextArea(1, "<p align='center'>" .. translate("april_fool", name), name, 300, 200, 200, 50, 0x0, 0x0, 0, true)
- ui.addTextArea(2, "<p align='center'><a href='event:close'>" .. translate("thank", name), name, 230, 365, 100, 50, 0x0, 0x0, 0, true)
- ui.addTextArea(3, "<p align='center'><a href='event:close'>" .. translate("close", name), name, 465, 365, 100, 50, 0x0, 0x0, 0, true)
- end
- local isAdmin = function (name)
- for _,admin in next, module.admins do
- if admin == name then
- return true
- end
- end
- end
- eventTextAreaCallback = function (id, name, cb)
- if cb == "openGift" then
- gift (name, true)
- elseif cb == "readMessage" then
- letter (name)
- elseif cb == "close" then
- closeGift (name)
- p[name].gotPranked = true
- end
- end
- eventNewPlayer = function(name)
- loadImagesForLaggers(name)
- if not p[name] then
- p[name] = {imgs = {}, langue = ROOM.playerList[name].community, gifter = nil, gotPranked = false}
- end
- end
- eventChatCommand = function (name, c)
- local arg = {}
- for argument in c:gmatch("[^%s]+") do
- table.insert(arg, argument)
- end
- if isAdmin(name) then
- if arg[1] == "fool" then
- if arg[2] then
- if tfm.get.room.playerList[arg[2]] then
- if not p[arg[2]].gotPranked then
- gift(arg[2], false)
- else
- TFM.chatMessage(string.format(translate("alreadyPranked", name) , arg[2]), name)
- print(string.format(translate("alreadyPranked", name) , arg[2]))
- end
- end
- else
- for player in pairs(tfm.get.room.playerList) do
- gift(player, false)
- end
- end
- end
- end
- end
- local main = function ()
- system.disableChatCommandDisplay()
- for name in pairs(ROOM.playerList) do
- eventNewPlayer(name)
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement