Advertisement
Guest User

Untitled

a guest
Nov 1st, 2018
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. print("Chat commands Script by Sam Cliffe")
  2.  
  3. function getIdentity(source)
  4. local identifier = GetPlayerIdentifiers(source)[1]
  5. local result = MySQL.Sync.fetchAll("SELECT * FROM users WHERE identifier = @identifier", {['@identifier'] = identifier})
  6. if result[1] ~= nil then
  7. local identity = result[1]
  8.  
  9. return {
  10. identifier = identity['identifier'],
  11. firstname = identity['firstname'],
  12. lastname = identity['lastname'],
  13. dateofbirth = identity['dateofbirth'],
  14. sex = identity['sex'],
  15. height = identity['height']
  16.  
  17. }
  18. else
  19. return nil
  20. end
  21. end
  22.  
  23. AddEventHandler('chatMessage', function(source, name, msg)
  24. sm = stringsplit(msg, " ");
  25. if sm[1] == "/ooc" then
  26. CancelEvent()
  27. TriggerClientEvent('chatMessage', -1, "OOC | " .. name, { 36, 36, 36 }, string.sub(msg,5))
  28. end
  29. end)
  30.  
  31. function stringsplit(inputstr, sep)
  32. if sep == nil then
  33. sep = "%s"
  34. end
  35. local t={} ; i=1
  36. for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
  37. t[i] = str
  38. i = i + 1
  39. end
  40. return t
  41. end
  42.  
  43. AddEventHandler('chatMessage', function(source, name, msg)
  44. sm = stringsplit(msg, " ");
  45.  
  46. if sm[1] == "/twt" then
  47. CancelEvent()
  48. local name = getIdentity(source)
  49. fal = name.firstname .. " " .. name.lastname
  50. TriggerClientEvent('chatMessage', -1, "[Twitter] " .. fal { 0, 102, 204 }, string.sub(msg,5))
  51. end
  52. end)
  53.  
  54. function stringsplit(inputstr, sep)
  55. if sep == nil then
  56. sep = "%s"
  57. end
  58. local t={} ; i=1
  59. for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
  60. t[i] = str
  61. i = i + 1
  62. end
  63. return t
  64. end
  65.  
  66.  
  67.  
  68. AddEventHandler('chatMessage', function(name, source, msg)
  69. sm = stringsplit(msg, " ");
  70. if sm[1] == "/anonym" then
  71. CancelEvent()
  72. TriggerClientEvent('chatMessage', -1, "Anonym | ".. name .." ", {22, 2, 22}, string.sub(msg,5))
  73. end
  74. end)
  75.  
  76.  
  77.  
  78. AddEventHandler('chatMessage', function(source, name, msg)
  79. sm = stringsplit(msg, " ");
  80. if sm[1] == "/ad" then
  81. CancelEvent()
  82. TriggerClientEvent('chatMessage', -1, "Advert | " .. name, { 255, 255, 0 }, string.sub(msg,5))
  83. end
  84. end)
  85.  
  86. function stringsplit(inputstr, sep)
  87. if sep == nil then
  88. sep = "%s"
  89. end
  90. local t={} ; i=1
  91. for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
  92. t[i] = str
  93. i = i + 1
  94. end
  95. return t
  96. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement