Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- player={}
- version="1.0"
- id=0
- function actbarra(p)
- ui.updateTextArea(1,string.format("<a href='event:dib'><b>%s</b></a>\t\t<a href='event:clear'><b><font color='#BABD2F'>Limpiar</font></b></a>\t\t<b>Color:</b> <a href='event:color'><font color='#%s'>#%s</font></a>\t\t<b>Grosor:</b> <a href='event:grosor'>%s</a>\t\t<b>Transparencia:</b> <a href='event:alpha'>%s%%</a>\t\t<b>En frente:</b> <a href='event:fore'>%s</a>",player[p].activacion[2],player[p].color,string.upper(player[p].color),player[p].line,tostring(player[p].alpha*100),player[p].frente[2]),p)
- end
- function eventNewGame()local object = {type = 12,height = 10,width = 10,color = 0xffffffff,dynamic = false,miceCollision=false,groundCollision = false,}
- tfm.exec.addPhysicObject(0,1,1, object)
- end
- function eventNewPlayer(p)
- system.bindMouse(p,true)
- player[p]={}
- player[p].mouse=false
- player[p].x=nil
- player[p].y=nil
- player[p].activacion={false,"Desactivado"}
- player[p].color="ffffff"
- player[p].line=2
- player[p].alpha=1
- player[p].frente={false,"no"}
- ui.addTextArea(1,"",p,5,25,w,20,1,1,0.5,true)
- ui.addTextArea(9999,"<font color='#BABD2F'>Version </font><font color='#2ECF73'>"..version.."</font>",a,715,365,nil,20,nil,nil,0,true)ui.addTextArea(9998,"<font color='#BABD2F'>By </font><font color='#2ECF73'>Alemoide</font>",a,715,375,nil,20,nil,nil,0,true)
- ui.updateTextArea(1,string.format("<a href='event:dib'><b>%s</b></a>",player[p].activacion[2]),p)
- end
- for n,i in pairs(tfm.get.room.playerList)do eventNewPlayer(n)end
- function eventMouse(p,x,y)
- if player[p].activacion[1] then
- if not player[p].mouse then
- player[p].x,player[p].y=x,y
- player[p].mouse=true
- else
- id=id+1
- tfm.exec.addJoint(id,0,0,{
- type=0,
- point1=string.format("%s,%s",tostring(player[p].x),tostring(player[p].y)),
- point2=string.format("%s,%s",tostring(x),tostring(y)),
- line=player[p].line,
- color="0x"..player[p].color,
- alpha=player[p].alpha,
- foreground=player[p].frente[1]
- })
- player[p].mouse=false
- end
- end
- end
- function eventTextAreaCallback(i,p,c)
- if c=="color" then
- ui.addPopup(1,2,"Inserte el color",p,300,175,200,true)
- elseif c=="grosor" then
- ui.addPopup(2,2,"Inserte el grosor",p,300,175,200,true)
- elseif c=="alpha" then
- ui.addPopup(3,2,"Inserte la transparencia (Numero del 1 al 100)",p,300,175,200,true)
- elseif c=="fore" then
- ui.addPopup(4,1,"¿Las lineas seran en frente?",p,300,175,200,true)
- elseif c=="clear" then
- for i=1,id do
- tfm.exec.removeJoint(i)
- end
- id=0
- tfm.exec.addJoint(0,0,0,{type=0})
- elseif c=="dib" then
- if player[p].activacion[1] then
- player[p].activacion={false,"Desactivado"}
- player[p].mouse=false
- else
- player[p].activacion={true,"Activado"}
- end
- if player[p].activacion[1] then actbarra(p) else ui.updateTextArea(1,string.format("<a href='event:dib'><b>%s</b></a>",player[p].activacion[2]),p)end
- end
- end
- function eventPopupAnswer(i,p,a)
- if i==1 and a:len()<=6 then
- local color=a:match("%x+") or "000000"
- player[p].color=string.rep("0",6-color:len())..color
- elseif i==2 and tonumber(a) then
- if tonumber(a)>250 or tonumber(a)<1 then player[p].line=1; else
- player[p].line=tonumber(a)end
- elseif i==3 and tostring(a):match("%d") then
- local num=tonumber(tostring(a):match("%d+"))
- if num>100 or num<0 then
- player[p].alpha=1
- else
- player[p].alpha=num/100
- end
- elseif i==4 then
- if a=="no" then
- player[p].frente={false,"no"}
- else
- player[p].frente={true,"sí"}
- end
- end
- actbarra(p)
- end
Advertisement
Add Comment
Please, Sign In to add comment