Guest User

Untitled

a guest
May 27th, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.65 KB | None | 0 0
  1. @name Chat
  2. @inputs [Egp Keyboard]:wirelink
  3. @outputs
  4. @persist [E2 Me]:entity [Typing Name DsName DsText]:string Color:vector Chat:array TotalText
  5. @trigger
  6. @model models/props_lab/harddrive02.mdl
  7.  
  8. if(first())
  9. {
  10. runOnTick(1)
  11.  
  12. E2 = entity()
  13. Me = owner()
  14.  
  15. dsJoinGroup("Chat")
  16. dsSetScope(2)
  17.  
  18. TotalText = 5
  19. Name = Me:name()
  20.  
  21. function wirelink:chatPrint(Text:string, RGB:vector)
  22. {
  23.  
  24. TotalText += 1
  25.  
  26. This:egpText(TotalText, Text, vec2(10, 450))
  27. This:egpColor(TotalText, RGB)
  28. This:egpSize(TotalText, 20)
  29.  
  30. for(I = 1, TotalText)
  31. {
  32. N = I+5
  33.  
  34. This:egpPos(N, vec2(10, This:egpPos(N):y()-20))
  35. }
  36.  
  37. }
  38.  
  39.  
  40. Egp:egpClear()
  41.  
  42. Egp:egpRoundedBox(1, vec2(256, 256), vec2(512, 512))
  43. Egp:egpColor(1, vec(100, 100, 100))
  44.  
  45. Egp:egpRoundedBox(2, vec2(256, 256), vec2(512, 512))
  46. Egp:egpMaterial(2, "vgui/zoom")
  47.  
  48. Egp:egpRoundedBoxOutline(3, vec2(256, 256), vec2(512, 512))
  49. Egp:egpSize(3, 2)
  50.  
  51. Egp:egpRoundedBoxOutline(4, vec2(256, 488), vec2(512, 50))
  52. Egp:egpSize(4, 2)
  53.  
  54. Egp:egpText(5, "", vec2(10, 468))
  55. Egp:egpSize(5, 40)
  56.  
  57. Egp:chatPrint("Type !commands to see all commands.", vec(0, 255, 255))
  58. }
  59.  
  60. if(dsClk("Name"))
  61. {
  62. DsName = dsGetString()
  63. }
  64. elseif(dsClk("Text"))
  65. {
  66. DsText = dsGetString()
  67. }
  68. elseif(dsClk("Color"))
  69. {
  70. DsColor = dsGetVector()
  71.  
  72. Egp:chatPrint(DsName+": "+DsText, DsColor)
  73. }
  74.  
  75. if(Keyboard["InUse", number])
  76. {
  77. Key = Keyboard["Memory", number]
  78.  
  79. if(changed(Key))
  80. {
  81.  
  82. if(Key != 127 & Key != 154)
  83. {
  84. Typing += toChar(Key)
  85.  
  86. Egp:egpSetText(5, Typing)
  87. }
  88.  
  89. if(Key == 127)
  90. {
  91.  
  92. Typing = Typing:sub(0, Typing:length()-1)
  93.  
  94. }
  95.  
  96. if(Key == 13)
  97. {
  98.  
  99. Command = Typing:explode(" ")
  100.  
  101. if(Command:string(1) == "!commands")
  102. {
  103. Egp:chatPrint("Commands:", vec(0, 255, 255))
  104. Egp:chatPrint("!setname <name> - sets your name", vec(0, 255, 255))
  105. Egp:chatPrint("!setcolor <red> <green> <blue> - sets your color", vec(0, 255, 255))
  106. Egp:chatPrint("!setbackgroundcolor <red> <green> <blue> - sets the background color", vec(0, 255, 255))
  107. Egp:chatPrint("!commands - shows all commands", vec(0, 255, 255))
  108. }
  109. elseif(Command:string(1) == "!setname")
  110. {
  111. Name = Typing:sub(10)
  112. }
  113. elseif(Command:string(1) == "!setcolor")
  114. {
  115. R = Command:string(2):toNumber()
  116. G = Command:string(3):toNumber()
  117. B = Command:string(4):toNumber()
  118.  
  119. Color = vec(R, G, B)
  120. }
  121. elseif(Command:string(1) == "!setbackgroundcolor")
  122. {
  123. R = Command:string(2):toNumber()
  124. G = Command:string(3):toNumber()
  125. B = Command:string(4):toNumber()
  126.  
  127. Egp:egpColor(1, vec(R, G, B))
  128. }
  129. else
  130. {
  131. Egp:chatPrint(Name+": "+Typing, Color)
  132.  
  133. dsSend("Name", "Chat", dsGetScope(), Name)
  134. dsSend("Text", "Chat", dsGetScope(), Typing)
  135. dsSend("Color", "Chat", dsGetScope(), Color)
  136. }
  137.  
  138. Typing = ""
  139. }
  140. }
  141. }
Add Comment
Please, Sign In to add comment