Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @name Chat
- @inputs [Egp Keyboard]:wirelink
- @outputs
- @persist [E2 Me]:entity [Typing Name DsName DsText]:string Color:vector Chat:array TotalText
- @trigger
- @model models/props_lab/harddrive02.mdl
- if(first())
- {
- runOnTick(1)
- E2 = entity()
- Me = owner()
- dsJoinGroup("Chat")
- dsSetScope(2)
- TotalText = 5
- Name = Me:name()
- function wirelink:chatPrint(Text:string, RGB:vector)
- {
- TotalText += 1
- This:egpText(TotalText, Text, vec2(10, 450))
- This:egpColor(TotalText, RGB)
- This:egpSize(TotalText, 20)
- for(I = 1, TotalText)
- {
- N = I+5
- This:egpPos(N, vec2(10, This:egpPos(N):y()-20))
- }
- }
- Egp:egpClear()
- Egp:egpRoundedBox(1, vec2(256, 256), vec2(512, 512))
- Egp:egpColor(1, vec(100, 100, 100))
- Egp:egpRoundedBox(2, vec2(256, 256), vec2(512, 512))
- Egp:egpMaterial(2, "vgui/zoom")
- Egp:egpRoundedBoxOutline(3, vec2(256, 256), vec2(512, 512))
- Egp:egpSize(3, 2)
- Egp:egpRoundedBoxOutline(4, vec2(256, 488), vec2(512, 50))
- Egp:egpSize(4, 2)
- Egp:egpText(5, "", vec2(10, 468))
- Egp:egpSize(5, 40)
- Egp:chatPrint("Type !commands to see all commands.", vec(0, 255, 255))
- }
- if(dsClk("Name"))
- {
- DsName = dsGetString()
- }
- elseif(dsClk("Text"))
- {
- DsText = dsGetString()
- }
- elseif(dsClk("Color"))
- {
- DsColor = dsGetVector()
- Egp:chatPrint(DsName+": "+DsText, DsColor)
- }
- if(Keyboard["InUse", number])
- {
- Key = Keyboard["Memory", number]
- if(changed(Key))
- {
- if(Key != 127 & Key != 154)
- {
- Typing += toChar(Key)
- Egp:egpSetText(5, Typing)
- }
- if(Key == 127)
- {
- Typing = Typing:sub(0, Typing:length()-1)
- }
- if(Key == 13)
- {
- Command = Typing:explode(" ")
- if(Command:string(1) == "!commands")
- {
- Egp:chatPrint("Commands:", vec(0, 255, 255))
- Egp:chatPrint("!setname <name> - sets your name", vec(0, 255, 255))
- Egp:chatPrint("!setcolor <red> <green> <blue> - sets your color", vec(0, 255, 255))
- Egp:chatPrint("!setbackgroundcolor <red> <green> <blue> - sets the background color", vec(0, 255, 255))
- Egp:chatPrint("!commands - shows all commands", vec(0, 255, 255))
- }
- elseif(Command:string(1) == "!setname")
- {
- Name = Typing:sub(10)
- }
- elseif(Command:string(1) == "!setcolor")
- {
- R = Command:string(2):toNumber()
- G = Command:string(3):toNumber()
- B = Command:string(4):toNumber()
- Color = vec(R, G, B)
- }
- elseif(Command:string(1) == "!setbackgroundcolor")
- {
- R = Command:string(2):toNumber()
- G = Command:string(3):toNumber()
- B = Command:string(4):toNumber()
- Egp:egpColor(1, vec(R, G, B))
- }
- else
- {
- Egp:chatPrint(Name+": "+Typing, Color)
- dsSend("Name", "Chat", dsGetScope(), Name)
- dsSend("Text", "Chat", dsGetScope(), Typing)
- dsSend("Color", "Chat", dsGetScope(), Color)
- }
- Typing = ""
- }
- }
- }
Add Comment
Please, Sign In to add comment