Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- system.disableChatCommandDisplay("w",true)
- system.disableChatCommandDisplay("a",true)
- system.disableChatCommandDisplay("llclear",true)
- system.disableChatCommandDisplay("np",true)
- system.disableChatCommandDisplay("map",true)
- system.disableChatCommandDisplay("mdmin",true)
- system.disableChatCommandDisplay("unadmin",true)
- system.disableChatCommandDisplay("color",true)
- system.disableChatCommandDisplay("help",true)
- system.disableChatCommandDisplay("clear",true)
- admin="Tat#0020"
- admins={"Ykr#0000", "Trapin#0000"}
- p={}
- i=0
- a=1
- function eventNewPlayer(name)
- tfm.exec.addPhysicObject(1,400,-600,{type=0,width=10,height=10,foreground=true,friction=0.3,restitution=0,dynamic=false,miceCollision=true,groundCollision=true})
- ui.addTextArea(69,"</b><font color='#ED67EA' size='20'>Welcome to DRAW! Type !help for more information.</font>",nil, 40,370,720,nil,0x324650,0x212F36,0.8,true)
- tfm.exec.bindKeyboard(name,17,true,true)
- tfm.exec.bindKeyboard(name,17,false,true)
- tfm.exec.bindKeyboard(name,90,true,true)
- system.bindMouse(name, true)
- tfm.exec.respawnPlayer(name)
- p[name]={ctrl=false, x1=0, y1=0, click1=false, x2=0, y2=0, color=0x000000, pickerid=0, width=5, apa=1,lineid={}, admin==false}
- for k=#admins,0,-1 do
- if name==admins[k] then
- p[name].admin=true
- tfm.exec.chatMessage("<font color='#ED67EA'>Admin commands: !llclear and !np/!map @code</font>",name)
- end
- end
- end
- for name,player in pairs(tfm.get.room.playerList) do
- eventNewPlayer(name)
- end
- function eventNewGame()
- for name,player in pairs(tfm.get.room.playerList) do
- tfm.exec.addPhysicObject(1,400,-600,{type=0,width=10,height=10,foreground=true,friction=0.3,restitution=0,dynamic=false,miceCollision=true,groundCollision=true})
- tfm.exec.bindKeyboard(name,17,true,true)
- tfm.exec.bindKeyboard(name,17,false,true)
- tfm.exec.bindKeyboard(name,90,true,true)
- system.bindMouse(name, true)
- tfm.exec.respawnPlayer(name)
- p[name]={ctrl=false, x1=0, y1=0, click1=false, x2=0, y2=0, color=0x000000, pickerid=0, width=5, apa=1,lineid={}, admin==false}
- for k=#admins,0,-1 do
- if name==admins[k] then
- p[name].admin=true
- end
- end
- end
- end
- function eventChatCommand(name,message)
- if message:sub(0,3)=="map" then
- if p[name].admin==true then
- tfm.exec.newGame(message:sub(5))
- end
- elseif message:sub(0,2)=="np" then
- if p[name].admin==true then
- tfm.exec.newGame(message:sub(4))
- end
- elseif message:sub(0,3)=="pta" then
- for index, param in pairs(p[name].lineid) do
- print(index..": "..tostring(param))
- end
- elseif message=="color" then
- ui.showColorPicker (i, name,0, "Color Picker" )
- p[name].pickerid=i
- i=i+1
- elseif message:sub(0,1)=="w" then
- p[name].width=tonumber(message:sub(3))
- elseif message:sub(0,1)=="a" then
- p[name].apa=tonumber(message:sub(3))
- elseif message:sub(0,4)=="help" then
- ui.addPopup(1,0,"</b><font color='#ffff00'>Ctrl+click on 2 points to draw a line across\nCtrl+z to undo.\n<b>Commands:</b>\n!w (number) to change width(thickness) of line to that number\n!a (number) to change alpha(invisibility) of your line,1 being opaque and 0 being totally invisible\n!color to choose the color you want\n!clear to clear all your drawings</font>",name,100,50,600,true)
- elseif message=="clear" then
- for z=#p[name].lineid,0,-1 do
- tfm.exec.removeJoint(p[name].lineid[z])
- end
- elseif message=="llclear" and p[name].admin==true then
- tfm.exec.chatMessage("<font color='#ED67EA'>Lines cleared.",nil)
- for k, player in pairs(tfm.get.room.playerList) do
- for z=#p[k].lineid,0,-1 do
- tfm.exec.removeJoint(p[k].lineid[z])
- end
- end
- elseif message:sub(0,5)=="mdmin" and name==admin then
- for k,player in pairs(tfm.get.room.playerList) do
- if k==message:sub(7) then
- p[k].admin=true
- tfm.exec.chatMessage("<font color='#ED67EA'>"..k.." is now a #draw admin!",nil)
- tfm.exec.chatMessage("<font color='#ED67EA'>You are promoted! Congrats!",k)
- end
- end
- elseif message:sub(0,7)=="unadmin" and name==admin then
- for k,player in pairs(tfm.get.room.playerList) do
- if k==message:sub(9) then
- p[k].admin=false
- tfm.exec.chatMessage("<font color='#ED67EA'>"..k.." is demodded",nil)
- tfm.exec.chatMessage("<font color='#ED67EA'>You are demoted.",k)
- end
- end
- end
- end
- function eventKeyboard(name,code,down,x,y)
- if code==17 and down==true then
- p[name].ctrl=true
- elseif code==17 and down==false then
- p[name].ctrl=false
- end
- if p[name].ctrl==true and code==90 then
- tfm.exec.removeJoint(p[name].lineid[#p[name].lineid])
- table.remove(p[name].lineid)
- end
- end
- function eventMouse(name,xp,yp)
- if p[name].ctrl==true then
- if p[name].click1==false then
- p[name].x1=xp
- p[name].y1=yp
- print(p[name].click1)
- print(p[name].x1)
- print(p[name].y1)
- p[name].click1=true
- elseif p[name].click1==true then
- p[name].x2=xp
- p[name].y2=yp
- print(p[name].click1)
- print(p[name].x2)
- print(p[name].y2)
- tfm.exec.addJoint(a,1,1,{type=0,point1=p[name].x1..","..p[name].y1, point2=p[name].x2..","..p[name].y2, frequency=10, damping=0.2, line=p[name].width,color=p[name].color, alpha=p[name].apa, foreground=true})
- table.insert(p[name].lineid,a)
- a=a+1
- p[name].click1=false
- end
- end
- end
- function eventColorPicked(id,name,colour)
- p[name].color=colour
- end
- function eventPlayerLeft(name)
- for z=#p[name].lineid,0,-1 do
- tfm.exec.removeJoint(p[name].lineid[z])
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment