LawyerMorty

Untitled

May 24th, 2014
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.96 KB | None | 0 0
  1. function rpChat( source, message, mType)
  2. if (isPlayerMuted(source)) then
  3. outputChatBox("You can not use interactions while being muted!", source, 255, 0, 0)
  4. return
  5. end
  6. if (not message) then return end
  7. message = message:gsub("#%x%x%x%x%x%x", "")
  8. if (message == "") then return end
  9. if exports.GTIres:isPlayerBannedSQL(source) then
  10. outputChatBox("You can not chat while being banned", source, 255, 0, 0)
  11. return
  12. end
  13. local r, g, b = getPlayerNametagColor(source)
  14. local hex = getHexFromRGB(r, g, b)
  15. local posX, posY, posZ = getElementPosition(source)
  16. local recipients = {}
  17. for index, player2 in pairs(getElementsByType("player")) do
  18. local posX2, posY2, posZ2 = getElementPosition(player2)
  19. if (--[[player ~= player2 and--]] getDistanceBetweenPoints3D(posX, posY, posZ, posX2, posY2, posZ2)) <= 30 then
  20. table.insert(recipients, player2)
  21. end
  22. end
  23. for index, player2 in pairs(recipients) do
  24. if mType == "me" then
  25. outputChatBox("[ME]["..#recipients.."] *"..getPlayerName(source).." "..message, player2, 255, 0, 255, false)
  26. logSocialMessage( "", "[ME]["..#recipients.."] *"..getPlayerName(source).." "..message, "action", 1, "Interactions", "RP Chat", "player")
  27. elseif mType == "do" then
  28. outputChatBox("[DO]["..#recipients.."] *"..getPlayerName(source)..": "..message, player2, 255, 0, 255, false)
  29. logSocialMessage( "", "[DO]["..#recipients.."] *"..getPlayerName(source)..": "..message, "action", 1, "Interactions", "RP Chat", "player")
  30. end
  31. end
  32. end
  33.  
  34. function localChat(player, _, ...)
  35. if (isPlayerMuted(player)) then
  36. outputChatBox("You can not chat while being muted!", player, 255, 0, 0)
  37. return
  38. end
  39. local message = table.concat({...}, " ")
  40. if (not message) then return end
  41. message = message:gsub("#%x%x%x%x%x%x", "")
  42. if (message == "") then return end
  43. local r, g, b = getPlayerNametagColor(player)
  44. local hex = getHexFromRGB(r, g, b)
  45. local posX, posY, posZ = getElementPosition(player)
  46. local recipients = {}
  47. for index, player2 in pairs(getElementsByType("player")) do
  48. local posX2, posY2, posZ2 = getElementPosition(player2)
  49. if (--[[player ~= player2 and--]] getDistanceBetweenPoints3D(posX, posY, posZ, posX2, posY2, posZ2)) <= 30 then
  50. table.insert(recipients, player2)
  51. end
  52. end
  53. if exports.GTIres:isPlayerBannedSQL(player) then
  54. outputChatBox("You can not chat while being banned", player, 255, 0, 0)
  55. return
  56. end
  57. --local detection = string.gsub( message, "/")
  58. if string.find( message, "/me", 1, true) then
  59. --outputChatBox( "You tried entering a command in localchat.", player, 255, 0, 0)
  60. local message1 = string.gsub( message, "/me ", "")
  61. if message1 ~= "" then
  62. rpChat( player, message1, "me")
  63. return
  64. end
  65. elseif string.find( message, "/do", 1, true) then
  66. --outputChatBox( "You tried entering a command in localchat.", player, 255, 0, 0)
  67. local message1 = string.gsub( message, "/do ", "")
  68. if message1 ~= "" then
  69. rpChat( player, message1, "do")
  70. return
  71. end
  72. end
  73. end
Advertisement
Add Comment
Please, Sign In to add comment