Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- powersData = {
- "<font color='#1300FF' ><a href='event:snow'>snow",
- "<font color='#1300FF' ><a href='event:double'>double",
- "<font color='#1300FF' ><a href='event:strong'>strong",
- "<font color='#1300FF' ><a href='event:arrow'>arrow",
- "<font color='#1300FF' ><a href='event:speed'>speed",
- "<font color='#1300FF' ><a href='event:delay'>delay",
- "<font color='#1300FF' ><a href='event:box'>box",
- "<font color='#1300FF' ><a href='event:table'>table",
- "<font color='#1300FF' ><a href='event:back'>back"
- }
- text = {
- welcome = "<font color='#F00500'>welcome</font><font color='#FFFFFF'> to <font color='#1300FF'>Mice.io",
- help ={
- "<br><br><br><b><font color='#FFFFFF'>MiniGame developed<br> by :</font> <J>Miiiclaroo</J>",
- "<br><b>Objective:</b><br><font color='#FFFFFF'>Collect the points around the map to get powers",
- "<br><br><b>Controls: </b><br><font color='#FFFFFF'>space : shot!<br>E or S (Down key): collect points",
- "<br><b>Powers:</b><br>Speed : Give your mouse a boost<br>Delay : Your shots are more faster<br>Double : Give you an extra shot(forward)<br>back : give you an backward shot",
- "<br><b>Guns:</b><br>Snow : (my favorite) A snowball<br>Cupid arrow : The name says it <br>Table : mini-table killer<br>Box : The name says it (x2) "
- }
- }
- --points data
- local pointId = 10000000
- local pointTime = 0
- local pointT = false
- local points = {}
- local pointsOnMap = 0
- local maxPoints = 30
- --mice data
- local miceId = 0
- local mice = {}
- local isFacingLeft={}
- local fireTS={}
- local admin="Miiiclaroo#0000"
- --others
- toDespawn={}
- function main()
- tfm.exec.disableAutoShaman()
- tfm.exec.disableAutoScore ()
- tfm.exec.disableAutoNewGame()
- tfm.exec.disableAfkDeath()
- tfm.exec.snow(2,50)
- system.disableChatCommandDisplay ("help")
- end
- function eventNewGame()
- for n in pairs(tfm.get.room.playerList)do
- tfm.exec.setPlayerScore (n,0,false)
- mice[n].points=0
- close(n)
- restartData(n)
- end
- end
- function eventNewPlayer(name)
- system.bindKeyboard(name,113,true,true)
- system.bindKeyboard(name,69,true,true)
- system.bindKeyboard(name,32,true,true)
- system.bindKeyboard(name,2,true,true)
- system.bindKeyboard(name,0,true,true)
- system.bindKeyboard(name,3,true,true)
- miceId = miceId +1
- if not mice[name] then
- mice[name] = {
- id = miceId,
- points = 1,
- force = 1,
- angle = 0,
- f = 20,
- gun = 0,
- x=0,
- shots=1,
- speed = 0,
- FDelay= 3,
- delay=2,
- reload = false,
- back = false,
- respawn = 9,
- dead = false,
- welcome = true,
- page = 1
- }
- end
- fireTS[name] = 0
- tfm.exec.respawnPlayer(name)
- ui.addTextArea(mice[name].id+1500,"<p align='center'><font size = '37'>"..text.welcome,name,200,150,400,50,0x61A277,0xF00500,0.5,true)
- ui.addTextArea(mice[name].id+500,"<p align= 'center'><a href='event:close'>X",name,580,120,20,20,0xF00500,0x61A277,0.5,true)
- end
- function eventKeyboard(name,key,down,px,py)
- if mice[name] then
- local mouse = mice[name]
- local x,f
- if key == 0 and not isFacingLeft[name] then
- mouse.x,mouse.force = -30,-mice[name].f
- isFacingLeft[name] = true
- mice[name].angle = 180
- elseif key == 0 then
- tfm.exec.movePlayer(name,0,0,false,-mice[name].speed,0,true)
- elseif key == 2 and isFacingLeft[name]then
- mouse.x,mouse.force = 30,mice[name].f
- isFacingLeft[name] = false
- mice[name].angle = 0
- elseif key == 2 then
- tfm.exec.movePlayer(name,0,0,false,mice[name].speed,0,true)
- end
- if key == 69 or key == 3 then
- for i in pairs (points) do
- if px > points[i][2]-20 and px < points[i][2]+20 then
- if py > points[i][3]-20 and py < points[i][3]+20 then
- ui.removeTextArea(points[i][1])
- points[i]={0,-100,-100}
- tfm.exec.setPlayerScore (name,1,true)
- mice[name].points = mice[name].points +1
- pointsOnMap = pointsOnMap - 1
- level(name)
- break
- end
- end
- end
- end
- if key == 32 and not mice[name].reload and not mice[name].back then
- fireTS[name] = os.time()
- for i = 1,mouse.shots do
- id = tfm.exec.addShamanObject(mouse.gun,px+mouse.x,py,mouse.angle,mouse.force)
- table.insert(toDespawn,{id,os.time()})
- end
- mice[name].reload=true
- end
- if key == 32 and not mice[name].reload and mice[name].back then
- fireTS[name] = os.time()
- for i = 1,mouse.shots do
- id = tfm.exec.addShamanObject(mouse.gun,px+mouse.x,py,mouse.angle,mouse.force)
- table.insert(toDespawn,{id,os.time()})
- end
- ad = tfm.exec.addShamanObject(mouse.gun,px+(-mouse.x),py,-mouse.angle,-mouse.force)
- mice[name].reload=true
- table.insert(toDespawn,{ad,os.time()})
- end
- if key == 113 and name==admin then
- tfm.exec.newGame('<C><P aie="" L="1600" H="800" /><Z><S><S L="1600" X="800" H="20" Y="790" T="0" P="0,0,0.3,0.2,0,0,0,0" /><S L="50" H="715" X="1575" Y="399" T="9" P="0,0,,,,0,0,0" /><S L="50" X="800" H="156" Y="702" T="9" P="0,0,,,,0,0,0" /><S L="600" X="400" H="25" Y="180" T="0" P="0,0,0.3,0.2,0,0,0,0" /><S L="600" H="25" X="1200" Y="180" T="0" P="0,0,0.3,0.2,0,0,0,0" /><S L="50" X="1201" H="156" Y="90" T="9" P="0,0,,,,0,0,0" /><S L="50" H="156" X="400" Y="90" T="9" P="0,0,,,,0,0,0" /><S L="600" X="1200" H="25" Y="156" T="9" P="0,0,,,,0,0,0" /><S L="600" H="25" X="400" Y="156" T="9" P="0,0,,,,0,0,0" /><S L="1600" H="30" X="800" Y="765" T="9" P="0,0,,,,0,0,0" /><S L="50" H="156" X="1200" Y="702" T="9" P="0,0,,,,0,0,0" /><S L="50" H="156" X="400" Y="702" T="9" P="0,0,,,,0,0,0" /><S L="50" X="25" H="715" Y="399" T="9" P="0,0,,,,0,0,0" /><S L="90" H="25" X="800" Y="425" T="0" P="0,0,0.3,0.2,0,0,0,0" /><S L="139" H="51" X="550" Y="360" T="0" P="0,0,0.3,0.2,0,0,0,0" /><S L="139" X="250" H="51" Y="360" T="0" P="0,0,0.3,0.2,0,0,0,0" /><S L="139" X="1050" H="51" Y="361" T="0" P="0,0,0.3,0.2,0,0,0,0" /><S L="139" H="51" X="1350" Y="361" T="0" P="0,0,0.3,0.2,0,0,0,0" /><S L="48" H="122" X="1200" Y="416" T="9" P="0,0,,,,0,0,0" /><S L="48" X="690" H="122" Y="416" T="9" P="0,0,,,,0,0,0" /><S L="48" X="910" H="122" Y="416" T="9" P="0,0,,,,0,0,0" /><S L="48" X="400" H="122" Y="416" T="9" P="0,0,,,,0,0,0" /></S><D><DS Y="400" X="800" /></D><O /></Z></C>')
- end
- end
- end
- for n in pairs (tfm.get.room.playerList) do
- eventNewPlayer(n)
- end
- function eventLoop(t,tr)
- if pointsOnMap < maxPoints then
- pointTime = pointTime+1
- if pointTime == 8 then
- pointTime=0
- makePoint()
- makePoint()
- end
- end
- for i,o in ipairs(toDespawn) do
- if os.time()> o[2]+2000 then
- tfm.exec.removeObject (o[1])
- table.remove (toDespawn, i)
- end
- end
- for name in pairs(tfm.get.room.playerList)do
- if mice[name]then
- if mice[name].dead then
- mice[name].respawn = mice[name].respawn-1
- if mice[name].respawn == 0 then
- tfm.exec.respawnPlayer(name)
- mice[name].respawn = 9
- mice[name].dead = false
- end
- end
- if mice[name].reload then
- mice[name].FDelay = mice[name].FDelay -1
- if mice[name].FDelay == 0 then
- mice[name].FDelay = mice[name].delay
- mice[name].reload=false
- end
- end
- end
- end
- end
- function makePoint()
- local psx = math.random(1600)
- local psy = math.random(50,770)
- local id
- ui.addTextArea(pointId,"<font color='#FFFFFF'><font size ='11'>+1",nil,psx,psy,20,20,0x6A7495,0xFFFFF,0.5)
- id = {pointId,psx,psy}
- table.insert(points,id)
- pointId = pointId+1
- pointsOnMap = pointsOnMap+1
- end
- function restartData(name)
- tfm.exec.setPlayerScore (name,0,false)
- mice[name].points = 0
- mice[name].force = 0
- mice[name].angle = 0
- mice[name].f = 20
- mice[name].gun = 0
- mice[name].x=0
- mice[name].shots=1
- mice[name].speed = 0
- mice[name].delay = 3
- mice[name].back = false
- close(name)
- end
- function eventPlayerDied(name)
- if mice[name] then
- mice[name].dead = true
- restartData(name)
- end
- end
- function level(name)
- if mice[name].points == 2 then
- showPowers(name)
- elseif mice[name].points == 4 then
- showPowers(name)
- elseif mice[name].points == 6 then
- showPowers(name)
- elseif mice[name].points == 8 then
- showPowers(name)
- elseif mice[name].points == 12 then
- showPowers(name)
- elseif mice[name].points == 16 then
- showPowers(name)
- elseif mice[name].points == 20 then
- showPowers(name)
- elseif mice[name].points == 24 then
- showPowers(name)
- elseif mice[name].points == 28 then
- showPowers(name)
- elseif mice[name].points == 34 then
- showPowers(name)
- elseif mice[name].points == 40 then
- showPowers(name)
- elseif mice[name].points == 45 then
- showPowers(name)
- elseif mice[name].points == 50 then
- showPowers(name)
- elseif mice[name].points == 56 then
- showPowers(name)
- elseif mice[name].points == 62 then
- showPowers(name)
- elseif mice[name].points == 69 then
- showPowers(name)
- elseif mice[name].points == 78 then
- showPowers(name)
- elseif mice[name].points == 89 then
- showPowers(name)
- end
- end
- function showPowers(name)
- ui.addTextArea(mice[name].id,""..powersData[math.random(#powersData)].."",name,275,350,50,25,0xFFFFFF,0,0.5,true)
- ui.addTextArea(mice[name].id+100,""..powersData[math.random(#powersData)].."",name,375,350,50,25,0xFFFFFF,0,0.5,true)
- ui.addTextArea(mice[name].id+200,""..powersData[math.random(#powersData)].."",name,475,350,50,25,0xFFFFFF,0,0.5,true)
- end
- function close(name)
- ui.removeTextArea(mice[name].id)
- ui.removeTextArea(mice[name].id+100)
- ui.removeTextArea(mice[name].id+200)
- end
- function eventTextAreaCallback(id,name,cb)
- if cb == "strong" then
- mice[name].f = mice[name].f +2
- close(name)
- elseif cb == "arrow" then
- mice[name].gun = 35
- close(name)
- elseif cb == "snow" then
- mice[name].gun = 34
- close(name)
- elseif cb == "double" then
- if mice[name].shots>= 4 then return end
- mice[name].shots=mice[name].shots+1
- close(name)
- elseif cb == "speed" then
- if mice[name].speed >= 20 then return end
- mice[name].speed = mice[name].speed+5
- mice[name].x = mice[name].x +10
- close(name)
- elseif cb == "delay" then
- if mice[name].delay <= 1 then return end
- mice[name].delay = mice[name].delay-1
- close(name)
- elseif cb == "box" then
- mice[name].gun = 1
- close(name)
- elseif cb == "table" then
- mice[name].gun = 60
- close(name)
- elseif cb == "back" then
- if mice[name].back then return end
- mice[name].back=true
- close(name)
- end
- if cb == "close" then
- ui.removeTextArea(mice[name].id+500)
- ui.removeTextArea(mice[name].id+1000)
- ui.removeTextArea(mice[name].id+1500)
- ui.removeTextArea(mice[name].id+2000)
- mice[name].page =1
- elseif cb == "next" then
- if mice[name].page < 5 then
- mice[name].page = mice[name].page+1
- end
- ui.updateTextArea (mice[name].id+1500,"<p align='center'><font size = '12'>"..text.help[mice[name].page],name)
- end
- end
- function eventPlayerRespawn(name)
- showPowers(name)
- end
- function eventChatCommand(name,command)
- print(name)
- if command == "help" then
- ui.addTextArea(mice[name].id+1500,"<p align='center'><font size = '12'>"..text.help[1],name,300,90,150,200,0x61A277,0xF00500,0.5,true)
- ui.addTextArea(mice[name].id+500,"<p align= 'center'><a href='event:close'>X",name,460,90,20,20,0x61A277,0xF00500,0.5,true)
- ui.addTextArea(mice[name].id+2000,"<a href='event:next'><font color='#FFFFFF'>next",name,370,297,0,0,0x61A277,0xF00500,0.5,true)
- end
- end
- function eventPlayerLeft (name)
- mice[name]= nil
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment