Advertisement
DragonPirates

Untitled

Jun 27th, 2015
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.91 KB | None | 0 0
  1. @name rp_chat_log
  2. @inputs Egp:wirelink User:entity
  3. @outputs Scroll Con Draw Linebreaks
  4. @persist [Log Names Ents Times]:array
  5. @trigger User
  6.  
  7.  
  8.  
  9. if(first()|dupefinished()|duped()){
  10. runOnChat(1)
  11. function number egpClick(Ply:entity,ID){
  12. return inrange(Egp:egpCursor(Ply),Egp:egpPos(ID)-(Egp:egpSize(ID)/2),Egp:egpPos(ID)+(Egp:egpSize(ID)/2))
  13. }
  14. }
  15.  
  16. if(changed(Egp:entity())&Egp:entity()){
  17. Egp:egpClear()
  18. }
  19.  
  20. if(~User&User){
  21. if(egpClick(User,81)){
  22. Scroll++,Draw=1,Con=1
  23. }elseif(egpClick(User,83)){
  24. if(Scroll>=1){
  25. Scroll--,Draw=1,Con=1
  26. if(Scroll==0){
  27. Egp:egpRemove(82)
  28. Egp:egpRemove(83)
  29. }
  30. }
  31. }
  32. }
  33.  
  34. if(chatClk()){
  35. local Ply = lastSpoke()
  36. Log:insertString(1,Ply:lastSaid())
  37. Names:insertString(1,Ply:name())
  38. Times:insertNumber(1,curtime())
  39. Ents:insertEntity(1,Ply)
  40.  
  41. if(!Scroll){Draw=1,Con=1}
  42. }
  43.  
  44. if(Draw){
  45. for(A=Con,clamp(34,1,Log:count())){
  46. if( maxquota()-opcounter() < 50 ){
  47. Con=A
  48. interval(50)
  49. exit()
  50. }
  51. B = A+Scroll
  52. if(Names:exists(B)){
  53. local Sec=int(curtime()-Times[B,number])
  54. local Min=int(Sec/60)
  55. local TIME = Min+"m "+(Sec-Min*60)+"s ago "
  56. local Length = Names[B,string]:length()
  57. if(A>=29){
  58. Egp:egpBox(A+34,vec2(204,(Linebreaks+A)*15-3.75),vec2(408,15))
  59. Egp:egpTextLayout(A,TIME+Names[B,string]+": "+Log[B,string]:left(30)+"...",vec2(1,(Linebreaks+A)*15-15),vec2(512,40)),Egp:egpFont(A,"Times New Roman")
  60. }else{
  61. Egp:egpBox(A+34,vec2(256,(Linebreaks+A)*15-3.75),vec2(512,15))
  62. Egp:egpTextLayout(A,TIME+Names[B,string]+": "+Log[B,string],vec2(1,(Linebreaks+A)*15-15),vec2(512,40)),Egp:egpFont(A,"Times New Roman")
  63. }
  64. Egp:egpColor(A+34,teamColor(Ents[B,entity]:team())/2)
  65. Linebreaks+=int(Log[B,string]:length()/33)
  66. }else{
  67. Egp:egpRemove(A),Egp:egpRemove(A+34)
  68. }
  69. }
  70. if(Scroll){
  71. Egp:egpRoundedBox(82,vec2(490,450),vec2(50,50)),Egp:egpColor(82,vec(0,30,150))
  72. Egp:egpBox(83,vec2(490,452),vec2(50,50)),Egp:egpAngle(83,-90),Egp:egpMaterial(83,"gui/HTML/back")
  73. Egp:egpText(84,"Scroll",vec2(424,485)),Egp:egpColor(84,vec(0,200,0))
  74. Egp:egpRoundedBox(80,vec2(470,495),vec2(100,50)),Egp:egpColor(80,vec(0,30,150))
  75. Egp:egpBox(81,vec2(490,492),vec2(50,50)),Egp:egpAngle(81,90)
  76. Egp:egpMaterial(81,"gui/HTML/back")
  77. }else{
  78. Egp:egpRoundedBox(80,vec2(470,495),vec2(100,50)),Egp:egpColor(80,vec(0,30,150))
  79. Egp:egpBox(81,vec2(490,492),vec2(50,50)),Egp:egpAngle(81,90),Egp:egpMaterial(81,"gui/HTML/back")
  80. Egp:egpText(84,"Live",vec2(424,485)),Egp:egpColor(84,vec(255,0,0))
  81. }
  82. Linebreaks=0
  83. Draw=0,Con=0
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement