-- Ping Pong By WIZ -- -- (for Tribe) <-- -- room admin -- admin = "Wizardamani0#6277" -- room admin -- -- Max goals to win -- G = 3 -- Max goals to win -- tfm.exec.disableAutoShaman(true) tfm.exec.disableAfkDeath(true) tfm.exec.disableAutoNewGame(true) tfm.exec.disablePhysicalConsumables(true) tfm.exec.disableDebugCommand(true) tfm.exec.disableMortCommand(true) tfm.exec.disableAutoScore(true) tfm.exec.newGame([[

]]) tfm.exec.setUIMapName("PING PONG! by Wizardmani0#6277") a = 0 b = 0 c = 1 noob = 5 yMousePosition = 200 box1 = 200 box2 = 200 roundon = 0 roundrun = 0 roundOrun = 0 P1GOAL = 0 P2GOAL = 0 local P1 = "Amani#1206" local P2 = "Amani#1206" ui.addTextArea(6,"

After joining the admin will press *Start* and you'll be playing , click in the screen with the mouse to place your paddle , don't let the ball enter your side.",nil,205,180,390,80, 0xffffff, 0x000000,1) ui.addTextArea(0," ",nil,200,95,400,80, 0xffffff, 0x000000,1) ui.addTextArea(1,"VS",nil,380,115,200,320, 0xffffff, 0x000000,0) ui.addTextArea(2," Join",nil,220,120,100,30, 0xffffff, 0x000000,1) ui.addTextArea(3," Join",nil,480,120,100,30, 0xffffff, 0x000000,1) ui.addTextArea(7," Start!",admin,360,268,80,30, 0xffffff, 0x000000,1) function eventLoop(currentTime, timeRemaining) a = a + 1 if a >= 10 then a = 4 end if roundOrun == 1 then b = b + 1 end if b >= 5 then roundrun = 1 roundOrun = 0 b = 0 end if roundon == 1 then tfm.exec.disableAutoShaman(true) tfm.exec.disableAfkDeath(true) tfm.exec.disableAutoNewGame(true) tfm.exec.disablePhysicalConsumables(true) tfm.exec.disableDebugCommand(true) tfm.exec.disableMortCommand(true) tfm.exec.disableAutoScore(true) tfm.exec.newGame([[

]]) tfm.exec.setUIMapName("PING PONG! | 1 VS 1") ball1 = tfm.exec.addShamanObject(630,400,200,0,noob,math.random(-15,15)) ui.removeTextArea(4) ui.removeTextArea(10) roundOrun = 1 P1J = 0 P2J = 0 system.bindMouse(P1, true) system.bindMouse(P2, true) roundon = 0 end if c == 1 then ui.removeTextArea(10) ui.addTextArea(10," ",P1,240,95,320,80, 0xffffff, 0x000000,0) ui.addTextArea(10," ",P2,240,95,320,80, 0xffffff, 0x000000,0) end if P2GOAL == G then ui.addTextArea(99,"

\n\nThe winner is\n"..P2,nil,-10,-10,820,420, 0xffffff, 0x000000,0.5,true,false) roundrun = 0 end if P1GOAL == G then ui.addTextArea(99,"

\n\nThe winner is\n"..P1,nil,-10,-10,820,420, 0xffffff, 0x000000,0.5,true,false) roundrun = 0 end if roundrun == 1 then ui.addTextArea(1,":",nil,399,360,100,320, 0xffffff, 0x000000,0) ui.addTextArea(2,""..P1GOAL,nil,377,363,100,100, 0xffffff, 0x000000,0) ui.addTextArea(3,""..P2GOAL,nil,420,363,100,100, 0xffffff, 0x000000,0) ui.addTextArea(4,"

"..P2,nil,600,380,140,40, 0xffffff, 0x000000,1,false,false) ui.addTextArea(5,"

"..P1,nil,60,380,140,40, 0xffffff, 0x000000,1,false,false) tfm.exec.addPhysicObject(1,8,box1-23,{ type=12, restitution=1.2, friction=0, angle=-2, width=20, height=50, color = 0xFF0000, groundCollision=true }) tfm.exec.addPhysicObject(2,8,box1+23,{ type=12, restitution=1.2, friction=0, angle=2, width=20, height=50, color = 0xFF0000, groundCollision=true }) tfm.exec.addPhysicObject(3,792,box2-23,{ type=12, restitution=1.2, friction=0, angle=2, width=20, height=50, color = 0x0000ff, groundCollision=true }) tfm.exec.addPhysicObject(4,792,box2+23,{ type=12, restitution=1.2, friction=0, angle=-2, width=20, height=50, color = 0x0000ff, groundCollision=true }) end if roundrun == 1 and (tfm.get.room.objectList[ball1].x) >= 800 then P1GOAL = P1GOAL + 1 ui.addTextArea(2,""..P1GOAL,nil,377,363,100,100, 0xffffff, 0x000000,0) roundon = 1 noob = -5 roundrun = 0 end if roundrun == 1 and (tfm.get.room.objectList[ball1].x) <= 0 then P2GOAL = P2GOAL + 1 ui.addTextArea(3,""..P2GOAL,nil,420,363,100,100, 0xffffff, 0x000000,0) roundon = 1 noob = 5 roundrun = 0 end end function eventTextAreaCallback(id,name,event) if event == "P1join" and a >= 4 then P1 = name P1J = 1 ui.addTextArea(2,"

\n"..P1,nil,220,120,140,40, 0xffffff, 0x000000,1,false,false) ui.addTextArea(10," ",name,240,95,320,80, 0xffffff, 0x000000,0) ui.addTextArea(91,"✘",admin,215,125,30,30, 0xffffff, 0x000000,0) ui.addTextArea(91,"✘",name,215,125,30,30, 0xffffff, 0x000000,0) a = 2 end if event == "P2join" and a >= 4 then P2 = name P2J = 1 ui.addTextArea(3,"

\n"..P2,nil,440,120,140,40, 0xffffff, 0x000000,1,false,false) ui.addTextArea(10," ",name,200,95,400,80, 0xffffff, 0x000000,0) ui.addTextArea(92,"✘",admin,560,125,30,30, 0xffffff, 0x000000,0) ui.addTextArea(92,"✘",name,560,125,30,30, 0xffffff, 0x000000,0) a = 2 end if event == "P1X" and a >= 4 then ui.removeTextArea(91) ui.addTextArea(2," Join",nil,220,120,100,30, 0xffffff, 0x000000,1) P1 = "Amani#1206" a = 2 end if event == "P2X" and a >= 4 then ui.removeTextArea(92) ui.addTextArea(3," Join",nil,480,120,100,30, 0xffffff, 0x000000,1) P2 = "Amani#1206" a = 2 end if event == "GO" then ui.removeTextArea(0) ui.removeTextArea(1) ui.removeTextArea(2) ui.removeTextArea(3) ui.removeTextArea(4) ui.removeTextArea(5) ui.removeTextArea(6) ui.removeTextArea(7) ui.removeTextArea(10) ui.removeTextArea(91) ui.removeTextArea(92) ui.addTextArea(0,":",nil,399,360,100,320, 0xffffff, 0x000000,0) roundon = 1 end end function eventMouse(name, xMousePosition, yMousePosition) if P1 == name then box1 = yMousePosition tfm.exec.addPhysicObject(1,8,box1-23,{ type=12, restitution=1.2, friction=0, angle=-2, width=20, height=50, color = 0xFF0000, groundCollision=true }) tfm.exec.addPhysicObject(2,8,box1+23,{ type=12, restitution=1.2, friction=0, angle=2, width=20, height=50, color = 0xFF0000, groundCollision=true }) end if P2 == name then box2 = yMousePosition tfm.exec.addPhysicObject(3,792,box2-23,{ type=12, restitution=1.2, friction=0, angle=2, width=20, height=50, color = 0x0000ff, groundCollision=true }) tfm.exec.addPhysicObject(4,792,box2+23,{ type=12, restitution=1.2, friction=0, angle=-2, width=20, height=50, color = 0x0000ff, groundCollision=true }) end end