Advertisement
Guest User

Groupchat

a guest
Dec 1st, 2012
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. function GM:ChatTextChanged(text)
  2. if PlayerColorsOn:GetInt() == 0 then return end
  3. if not Messagemode or HearMode == "speak" then return end
  4. local old = HearMode
  5. HearMode = "talk"
  6. if not GAMEMODE.Config.alltalk then
  7. if string.sub(text, 1, 2) == "//" or string.sub(string.lower(text), 1, 4) == "/ooc" or string.sub(string.lower(text), 1, 4) == "/a" then
  8. HearMode = "talk through OOC"
  9. elseif string.sub(string.lower(text), 1, 7) == "/advert" then
  10. HearMode = "advert"
  11. end
  12. end
  13.  
  14. if string.sub(string.lower(text), 1, 3) == "/pm" then
  15. local plyname = string.sub(text, 5)
  16. if string.find(plyname, " ") then
  17. plyname = string.sub(plyname, 1, string.find(plyname, " ") - 1)
  18. end
  19. HearMode = "pm"
  20. playercolors = {}
  21. if plyname ~= "" and self:FindPlayer(plyname) then
  22. playercolors = {self:FindPlayer(plyname)}
  23. end
  24. elseif string.sub(string.lower(text), 1, 5) == "/call" then
  25. local plyname = string.sub(text, 7)
  26. if string.find(plyname, " ") then
  27. plyname = string.sub(plyname, 1, string.find(plyname, " ") - 1)
  28. end
  29. HearMode = "call"
  30. playercolors = {}
  31. if plyname ~= "" and self:FindPlayer(plyname) then
  32. playercolors = {self:FindPlayer(plyname)}
  33. end
  34. elseif string.sub(string.lower(text), 1, 3) == "/g " or GroupChat then
  35. HearMode = "group chat"
  36. local t = LocalPlayer():Team()
  37. playercolors = {}
  38. if t == TEAM_POLICE or t == TEAM_CHIEF or t == TEAM_MAYOR or t == TEAM_CPSUPPLIER or t == TEAM_SWAT or t == TEAM_CPSNIPER then
  39. for k, v in pairs(player.GetAll()) do
  40. if v ~= LocalPlayer() then
  41. local vt = v:Team()
  42. if vt == TEAM_POLICE or vt == TEAM_CHIEF or vt == TEAM_MAYOR or vt == TEAM_CPSUPPLIER or vt == TEAM_SWAT or vt == TEAM_CPSNIPER then table.insert(playercolors, v) end
  43. end
  44. end
  45. elseif t == TEAM_MOB or t == TEAM_GANG then
  46. for k, v in pairs(player.GetAll()) do
  47. if v ~= LocalPlayer() then
  48. local vt = v:Team()
  49. if vt == TEAM_MOB or vt == TEAM_GANG then table.insert(playercolors, v) end
  50. end
  51. end
  52. end
  53. elseif string.sub(string.lower(text), 1, 3) == "/w " then
  54. HearMode = "whisper"
  55. elseif string.sub(string.lower(text), 1, 2) == "/y" then
  56. HearMode = "yell"
  57. elseif string.sub(string.lower(text), 1, 3) == "/me" then
  58. HearMode = "me"
  59. end
  60. if old ~= HearMode then
  61. playercolors = {}
  62. end
  63. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement