Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[RIDDLE;
- The shaman has to make a riddle of the word they were given, while players must guess that word.
- Commands:
- !word to guess the word
- !help to see the help
- !respawn for respawning your mouse (if dead)
- !staff to see the current room staff
- As a shaman:
- !new to get a new word (you can only !new once.)
- !next to skip your turn
- Admin commands:
- !cheat to skip the turn if the shaman was caught cheating
- !word to view the current word
- !mod to chat as mod (pink text)]]
- tfm.exec.disableAutoScore(true)
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAfkDeath(true)
- tfm.exec.disableAllShamanSkills(true)
- cmds={"mod","word","cheat","respawn","staff"}
- for _,cmd in pairs(cmds) do
- system.disableChatCommandDisplay(cmd)
- end
- admins={"Safwanrockz","Shamousey"}
- words={"cheese","ice","fire","llama","pony","hot","ditch","monkey","shaman","mouse","feather","cookie","music","donut","conscience","explosion","ear","eagle","dubstep","heat","pit","DNA","football","eyepatch","poor","record","recycle","hat","pen","pumpkin","rice","noodles","song","soccer","sonic","sparkle","unicycle","bicycle","tricycle","wedding","virus","emo","goat","sheep","lamb","buffalo","basketball","egg","frog","elevator","oasis","nightingale","leather","jail","lyrics","MacBook","scarf","summer","rainbow","tattoo","seafood","soda","Pepsi","Nemo","America","FireFox"}
- maps={"@4411282"}
- texts= {
- welcome = "<p align='center'>Welcome to <font color='#ff0000'><B>Riddle</B></font> minigame! Type <font color='#ff0000'><B>!help</B></font> for help.</p>",
- shamriddle = "<BV>You have to make a riddle of the word.. \n<J><B>%s</B></J>\nYou have 2 minutes!",
- winner = "<J>%s<BV> has solved the riddle! The word was <J>%s",
- help = "<p align='center'><font color='#ff0000' size='13' face='Soopafresh'>Welcome to Riddle minigame!</font></p><br><br>Your goal as a shaman is to make a riddle out of the word you get.<br>Your goal as a mouse is to guess the riddle the shaman is making.<br><br><p align='center'><font color='#ff0000' size='13' face='Soopafresh'>Additional Commands</font></p><br><font color='#ff0000'><B>!next</B></font> as a shaman to skip your turn.<br><font color='#ff0000'><B>!new</B></font> as a shaman to get a new word.<br><font color='#ff0000'><B>!respawn</B></font> to respawn your mouse.<br><font color='#ff0000'><B>!staff</B></font> to view the list of room staff.<br><br><br><br><p align='right'><a href='event:close'><font color='#ff0000' face='Soopafresh'>Close</p></a></font>",
- staff = "<p align='center'><font color='#ff0000' size='13' face='Soopafresh'>Room Staff</font> </p><br><br>"..table.concat(admins, "\n").."<br><br><br><br><p align='right'><a href='event:close'><font color='#ff0000' size='13' face='Soopafresh'>Close</p></a></font></B>",
- skip = "<BV>The shaman has decided to skip their turn! The word was <J>%s",
- newword = "<BV>The shaman has chosen a new word!",
- cheat = "<R>The shaman has cheated! Beginning a new round..",
- nocheat = "<BV>No cheating allowed!",
- nowinner = "<BV>Nobody solved the riddle! The word was <J><B>%s"
- }
- --Lua functions
- function table.delete(table, element)
- for k,v in pairs(table) do
- if v==element then
- table.remove(table, k)
- end
- end
- end
- function table.random(t, associative)
- associative = associative or false
- if associative then
- local t2 = {}
- for k in pairs(t) do
- t2[#t2 + 1] = k
- end
- return t[table.random(t2)]
- else
- return t[math.random(1,#t)]
- end
- end
- function table.contains(t,element)
- if element==nil then
- return false
- end
- for key,value in pairs(t) do
- if value==element then
- return true
- end
- end
- return false
- end
- for player in pairs(tfm.get.room.playerList) do
- tfm.exec.setPlayerScore (player, 0)
- end
- tfm.exec.newGame(table.random(maps))
- --Events
- function eventNewGame()
- ui.addTextArea(0, texts.welcome, name, 255, 19, nil, nil, "0x262626", "0x000000", 0.7, nil)
- shaman=nil
- for name,player in pairs(tfm.get.room.playerList) do
- if(tfm.get.room.playerList[name].isShaman) then
- shaman=name
- end
- end
- answered=false
- lastnew=false
- word=table.random(words)
- tfm.exec.setUIMapName("<VP>~Made by Safwanrockz")
- tfm.exec.setGameTime(120,true)
- ui.addTextArea(1, texts.shamriddle:format(word), shaman, 5, 20, nil, nil, "0x262626", "0x000000", 0.7, nil)
- end
- function evenNewPlayer(name)
- ui.updateTextArea(0, texts.welcome, name, 275, 19, nil, nil, "0x262626", "0x000000", 0.7, nil)
- tfm.exec.respawnPlayer(name)
- end
- function eventChatCommand(name,command)
- local split=string.find(command," ") or #command+1
- local cmd=string.sub(command,1,split-1)
- local args=string.sub(command,split+1)
- if cmd:lower()==word:lower() and name~=shaman and not answered then
- ui.removeTextArea(5)
- ui.addTextArea(0, texts.winner:format(name, word), nil, 255, 19, nil, nil, "0x262626", "0x000000", 0.7, nil)
- tfm.exec.giveCheese(name)
- tfm.exec.playerVictory(name)
- answered=true
- tfm.exec.setPlayerScore(name,5)
- tfm.exec.setGameTime(5,true)
- tfm.exec.setPlayerScore(shaman,0)
- elseif cmd=="help" then
- ui.removeTextArea(4)
- ui.addTextArea(3, texts.help, name, 289, 76, 230, 250, "0x262626", "0x000000", 0.7)
- elseif cmd=="respawn" then
- tfm.exec.respawnPlayer(name)
- elseif cmd=="staff" then
- ui.removeTextArea(3)
- ui.addTextArea(4, texts.staff, name, 329, 156, 130, 130, "0x262626", "0x000000", 0.7)
- end
- if tfm.get.room.playerList[name].isShaman then
- if cmd=="next" then
- answered=true
- tfm.exec.setGameTime(1,true)
- tfm.exec.setPlayerScore(shaman,0)
- ui.updateTextArea(0, texts.skip:format(word), nil)
- elseif cmd=="new" and not answered and not lastnew then
- word=table.random(words)
- ui.removeTextArea(0)
- ui.addTextArea(5, texts.newword, nil, 295, 19, nil, nil, "0x262626", "0x000000", 0.7, nil)
- ui.updateTextArea(1, texts.shamriddle:format(word), shaman)
- lastnew=true
- elseif cmd==word and not answered then
- ui.removeTextArea(5)
- tfm.exec.setPlayerScore(name,0)
- ui.updateTextArea(0, texts.cheat, nil)
- answered=true
- tfm.exec.setGameTime(5,true)
- end
- end
- if table.contains(admins, name) then
- if cmd=="cheat" then
- ui.removeTextArea(0)
- ui.removeTextArea(5)
- ui.addTextArea(6, texts.nocheat, nil, 335, 19, nil, nil, "0x262626", "0x000000", 0.7, nil)
- tfm.exec.setGameTime(5,true)
- answered=true
- elseif cmd=="mod" then
- ui.addTextArea(2, "<ROSE>• [~Riddle Mod] "..args, nil, 5, 377, nil, nil, "0x262626", "0x000000", 0.7, nil)
- elseif cmd=="map" then
- tfm.exec.newGame(args:match("%d+"))
- elseif cmd=="word" then
- ui.addTextArea(0, "The word is "..word, name, 255, 19, nil, nil, "0x262626", "0x000000", 0.7, nil)
- elseif cmd=="shaman" then
- tfm.exec.setGameTime(0,true)
- tfm.exec.setPlayerScore(args,1337)
- elseif cmd=="admin" then
- table.insert(admins, args)
- elseif cmd=="unadmin" then
- table.delete(admins, args)
- end
- end
- end
- function eventTextAreaCallback(textid,name,cb)
- if cb=='close' then
- ui.removeTextArea(3, name)
- ui.removeTextArea(4, name)
- end
- end
- function eventLoop(time,remaining)
- if remaining <= 5000 and not answered then
- ui.removeTextArea(5)
- ui.removeTextArea(6)
- ui.removeTextArea(0)
- ui.addTextArea(7, texts.nowinner:format(word), nil, 263, 19, nil, nil, "0x262626", "0x000000", 0.7, nil)
- answered=true
- end
- if remaining <= 0 then
- tfm.exec.newGame(table.random(maps))
- answered=false
- for i=0,7 do
- ui.removeTextArea(i)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment