Garry's Mod

Expression 2 Code: Party Chat Advanced

Submitted by that1nub, , Thread ID: 59392

Thread Closed
08-11-2017, 09:40 AM
#1
I have made this code, and would like to share it. I don't know who all is interested. Just comment if you would like for me to make you a code, or publish one. This is a chat you can use for your friends, it should work on any server.

Code:
@name Advanced Party Chat
@persist [Group Prefix Tag ChatPrefix]:string [PrefixColor TagColor ChatColor NameColor]:vector
if(first()|duped()|dupefinished()){
##############################################
#[]## OPTIONS              ##[]#
#[]# Group = "Defualt123"         #[]#
#[]## ^ This is the group you will be  ##[]#
#[]##  joining             ##[]#
#[]# Prefix = "[P]"            #[]#
#[]## ^ This is what appears before   ##[]#
#[]##  message so you know it's from  ##[]#
#[]##  the party            ##[]#
#[]# PrefixColor = vec(127,255,127)    #[]#
#[]## ^ This is the color of your prefix ##[]#
#[]# Tag = "Defualt"           #[]#
#[]## ^ This is the color of your prefix ##[]#
#[]##  which is similar looking to a  ##[]#
#[]##  team tag             ##[]#
#[]# TagColor = vec(255,255,0)      #[]#
#[]## ^ This is the color of your tag  ##[]#
#[]# ChatPrefix = "~"           #[]#
#[]## ^ This is what you put before your ##[]#
#[]##  message, similar to using '@'  ##[]#
#[]##  with ulx, BEST LEFT 1 CHARACTER! ##[]#
#[]# ChatColor = vec(255,255,255)     #[]#
#[]## ^ This is what your chat will   ##[]#
#[]##  as                ##[]#
#[]# NameColor = vec(255,0,255)      #[]#
#[]## ^ This is the color of your name  ##[]#
##############################################

# TOUCH NOTHING PAST THIS!!!!!!!!!!!!!!!!!!!!!
}

if(first()|duped()|dupefinished()){
  dsJoinGroup(Group)
  runOnSignal("join",2,1)
  runOnSignal("msg",2,1)
  runOnSignal("leave",2,1)
  dsSetScope(2)
  runOnLast(1)
  runOnChat(1)
  dsSend("join",Group,2,array(Tag,TagColor,ChatColor,NameColor))
  printColor(PrefixColor,Prefix+" ",ChatColor,"(",TagColor,Tag,ChatColor,") ",NameColor,owner():name(),ChatColor," has joined chat!")  
}
if(last()){
  dsSend("leave",Group,2,array(Tag,TagColor,ChatColor,NameColor))
  printColor(PrefixColor,Prefix+" ",ChatColor,"(",TagColor,Tag,ChatColor,") ",NameColor,owner():name(),ChatColor," has left chat!")  
}

if(chatClk(owner())){
  if(lastSaid()[1] == ChatPrefix){
    hideChat(1)
    dsSend("msg",Group,2,array(Tag,TagColor,ChatColor,NameColor))
    printColor(PrefixColor,Prefix+" ",ChatColor,"(",TagColor,Tag,ChatColor,") ",NameColor,owner():name(),ChatColor,": "+lastSaid():sub(2))  
  }
}

if(dsClk("join")){
  local A = dsGetArray()
  local T = A[1,string]
  local TC = A[2,vector]
  local CC = A[3,vector]
  local NC = A[4,vector]
  printColor(PrefixColor,Prefix+" ",CC,"(",TC,T,CC,") ",NC,dsGetSender():owner():name(),CC," has joined chat!")  
}
if(dsClk("msg")){
  local A = dsGetArray()
  local T = A[1,string]
  local TC = A[2,vector]
  local CC = A[3,vector]
  local NC = A[4,vector]
  printColor(PrefixColor,Prefix+" ",CC,"(",TC,T,CC,") ",NC,dsGetSender():owner():name(),CC,": "+dsGetSender():owner():lastSaid():sub(2))  
}
if(dsClk("leave")){
  local A = dsGetArray()
  local T = A[1,string]
  local TC = A[2,vector]
  local CC = A[3,vector]
  local NC = A[4,vector]
  printColor(PrefixColor,Prefix+" ",CC,"(",TC,T,CC,") ",NC,dsGetSender():owner():name(),CC," has left chat!")  
}
I mainly play Garry's Mod. I specializein creating expression 2s. If you would like a code, please comment on my thread or PM me!

Users browsing this thread: 1 Guest(s)