SHARE
TWEET

d

a guest Dec 14th, 2019 122 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[
  2.  
  3.   ESX RP Chat
  4.  
  5. --]]
  6.  
  7. function getIdentity(source)
  8.     local identifier = GetPlayerIdentifiers(source)[1]
  9.     local result = MySQL.Sync.fetchAll("SELECT * FROM users WHERE identifier = @identifier", {['@identifier'] = identifier})
  10.     if result[1] ~= nil then
  11.         local identity = result[1]
  12.  
  13.         return {
  14.             identifier = identity['identifier'],
  15.             firstname = identity['firstname'],
  16.             lastname = identity['lastname'],
  17.             dateofbirth = identity['dateofbirth'],
  18.             sex = identity['sex'],
  19.             height = identity['height']
  20.            
  21.         }
  22.     else
  23.         return nil
  24.     end
  25. end
  26.  
  27.  
  28.  
  29.   -- TriggerEvent('es:addCommand', 'me', function(source, args, user)
  30.   --    local name = getIdentity(source)
  31.   --    TriggerClientEvent("sendProximityMessageMe", -1, source, name.firstname, table.concat(args, " "))
  32.   -- end)
  33.  
  34.  
  35.  
  36.   --- TriggerEvent('es:addCommand', 'me', function(source, args, user)
  37.   ---    local name = getIdentity(source)
  38.   ---    TriggerClientEvent("sendProximityMessageMe", -1, source, name.firstname, table.concat(args, " "))
  39.   -- end)
  40.   TriggerEvent('es:addCommand', 'me', function(source, args, user)
  41.     local name = getIdentity(source)
  42.     table.remove(args, 2)
  43.     TriggerClientEvent('esx-qalle-chat:me', -1, source, name.firstname, table.concat(args, " "))
  44. end)
  45.  
  46.  
  47.  RegisterCommand('tweet', function(source, args, rawCommand)
  48.     local playerName = GetPlayerName(source)
  49.     local msg = rawCommand:sub(6)
  50.     local name = getIdentity(source)
  51.     fal = name.firstname .. " " .. name.lastname
  52.     TriggerClientEvent('chat:addMessage', -1, {
  53.         template = '<div class="twitter chat-message"><div class="chat-message-header"><b>Twitter</b> @{0}:<br>{1}</div>',
  54.         args = { fal, msg }
  55.     })
  56. end, false)
  57.  
  58.  RegisterCommand('anontweet', function(source, args, rawCommand)
  59.     local playerName = GetPlayerName(source)
  60.     local msg = rawCommand:sub(11)
  61.     local name = getIdentity(source)
  62.     fal = name.firstname .. " " .. name.lastname
  63.     TriggerClientEvent('chat:addMessage', -1, {
  64.         template = '<div class="orange chat-message"><div class="chat-message-header"><b>anontweet: {0}:</b></div><div class="chat-message-body">{1}</div></div>',
  65.         args = { fal, msg }
  66.     })
  67. end, false)
  68.  
  69.  RegisterCommand('ad', function(source, args, rawCommand)
  70.     local playerName = GetPlayerName(source)
  71.     local msg = rawCommand:sub(4)
  72.     local name = getIdentity(source)
  73.     fal = name.firstname .. " " .. name.lastname
  74.     TriggerClientEvent('chat:addMessage', -1, {
  75.         template = '<div class="orange chat-message"><div class="chat-message-header">[AD] :</div><div class="chat-message-body">{1}</div></div>',
  76.         args = { fal, msg }
  77.     })
  78. end, false)
  79.  
  80.  RegisterCommand('ooc', function(source, args, rawCommand)
  81.     local playerName = GetPlayerName(source)
  82.     local msg = rawCommand:sub(5)
  83.     local name = getIdentity(source)
  84.     fal = name.firstname .. " " .. name.lastname
  85.     TriggerClientEvent('chat:addMessage', -1, {
  86.         template = '<div class="blue chat-message"><div class="chat-message-header"><b>OOC: {0}:</b> {1}</div>',
  87.         args = { fal, msg }
  88.     })
  89. end, false)
  90.  
  91.  
  92. function stringsplit(inputstr, sep)
  93.     if sep == nil then
  94.         sep = "%s"
  95.     end
  96.     local t={} ; i=1
  97.     for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
  98.         t[i] = str
  99.         i = i + 1
  100.     end
  101.     return t
  102. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top