Advertisement
Eliaseeg

Dibuja

Jun 8th, 2014
454
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.58 KB | None | 0 0
  1. data={}
  2.  
  3. system.bindMouse("Eliaseeg",true)
  4.  
  5. data["Eliaseeg"]={
  6.         primerCheck=nil
  7. };
  8. id=1
  9. color="0x2E9AFE"
  10. drawMode=circle
  11.  
  12.  
  13. function eventMouse(name,xCursor,yCursor)
  14.         if(not data[name].primerCheck)then
  15.                 data[name].primerCheck={x=xCursor,y=yCursor}
  16.         else
  17.                 drawMode(data[name].primerCheck,{x=xCursor,y=yCursor},1)    
  18.                 data[name].primerCheck = nil
  19.         end
  20. end
  21.  
  22. function line(punto1,punto2,res)
  23.         a=(punto1.y-punto2.y)/(punto1.x-punto2.x)
  24.         b=punto1.y-a*punto1.x
  25.         if(punto1.x>punto2.x) then punto1,punto2=punto2,punto1 end
  26.         for i=punto1.x,punto2.x,res do
  27.                 ui.addTextArea(id,"",nil,i,a*i+b, 1, 1, color, color)
  28.                 id=id+1
  29.         end
  30. end
  31.  
  32. function circle(point1,point2)
  33.         r=math.sqrt(math.pow((point1.x-point2.x),2)+math.pow((point1.y-point2.y),2))
  34.         res=1-r*math.pow(10,-2)
  35.         if(res<0.1)then res =0.1 end
  36.         for i=0,2*math.pi,res do
  37.                 ui.addTextArea(id,"",nil,point1.x+r*math.cos(i),point1.y+r*math.sin(i), 1, 1, color, color)
  38.                 id=id+1
  39.         end
  40. end
  41.  
  42. function eventChatCommand(name,command)
  43.      local args={}
  44.      for argument in command:gmatch("[^%s]+") do
  45.          table.insert(args, argument)
  46.      end
  47.      if args[1]=="clear" then
  48.          for i=1,id do
  49.              ui.removeTextArea(i)
  50.          end
  51.      elseif args[1]=="color" then
  52.          color="0x"..args[2]
  53.     elseif args[1]=="linea" then
  54.     drawMode=line
  55.     elseif args[1]=="circulo" then
  56.     drawMode=circle
  57.      end
  58. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement