About esx_rpchat tweet command


#1

Can somebody tell me how i can set that when i use /twt i can get character name on the tweet not my steam name. Using esx_identity.


#2

I have found a solution to your problem. I have also added in lastname so instead of it just being the players first name it will show both first & last like John Doe. I will also include my adv command that i did. I left ooc alone as its always best to leave that as normal. But for me, do, twt, & adv it will show both first & last name of the character.

  TriggerEvent('es:addCommand', 'me', function(source, args, user)
      local name = getIdentity(source)
      TriggerClientEvent("sendProximityMessageMe", -1, source, name.firstname .. " " .. name.lastname, table.concat(args, " "))
  end)

  TriggerEvent('es:addCommand', 'do', function(source, args, user)
      local name = getIdentity(source)
      TriggerClientEvent("sendProximityMessageDo", -1, source, name.firstname .. " " .. name.lastname, table.concat(args, " "))
  end)

  TriggerEvent('es:addCommand', 'twt', function(source, args, user)
  	local name = getIdentity(source)
	TriggerClientEvent('chatMessage', -1, "^0[^4Twitter^0] (^5@" .. name.firstname .. " " .. name.lastname .. "^0)", {30, 144, 255}, table.concat(args, " "))
  end, {help = 'Send a tweet. [IC]'})
  
  TriggerEvent('es:addCommand', 'adv', function(source, args, user)
  	local name = getIdentity(source)
	TriggerClientEvent('chatMessage', -1, "^0[^4Advert^0] (^5" .. name.firstname .. " " .. name.lastname .. "^0)", {30, 144, 255}, table.concat(args, " "))
  end, {help = 'Send a advert. [IC]'})

#3

If you don’t want to use the last name you can do

  TriggerEvent('es:addCommand', 'me', function(source, args, user)
      local name = getIdentity(source)
      TriggerClientEvent("sendProximityMessageMe", -1, source, name.firstname, table.concat(args, " "))
  end)

  TriggerEvent('es:addCommand', 'do', function(source, args, user)
      local name = getIdentity(source)
      TriggerClientEvent("sendProximityMessageDo", -1, source, name.firstname, table.concat(args, " "))
  end)

  TriggerEvent('es:addCommand', 'twt', function(source, args, user)
  	local name = getIdentity(source)
	TriggerClientEvent('chatMessage', -1, "^0[^4Twitter^0] (^5@" .. name.firstname .. "^0)", {30, 144, 255}, table.concat(args, " "))
  end, {help = 'Send a tweet. [IC]'})
  
  TriggerEvent('es:addCommand', 'adv', function(source, args, user)
  	local name = getIdentity(source)
	TriggerClientEvent('chatMessage', -1, "^0[^4Advert^0] (^5" .. name.firstname .. "^0)", {30, 144, 255}, table.concat(args, " "))
  end, {help = 'Send a advert. [IC]'})

[Release]RP CHAT WITH /ME /DO /TWT /DARKWEB /NEWS /WARNING /OOC /WANTED
#4

Awesome @HumanTree92, was looking for this as well.

Did somebody figure out how to make the use of hashtags (#) possible in the /twt messages?


#5

What do you mean us # hashtags. Can you give me an example and i will see what i can do


#6

Ok i see what you mean. On a fix i have looked and i don’t see a way to get the hashtags working.


#7

Just create a command twt like this:

AddEventHandler('chatMessage', function(source, color, msg)
	cm = stringsplit(msg, " ")
	
	if cm[1] == "/twt" then
		CancelEvent()
		if tablelength(cm) > 1 then
			local name = getIdentity(source)
			local textmsg = ""
			for i=1, #cm do
				if i ~= 1 then
					textmsg = (textmsg .. " " .. tostring(cm[i]))
				end
			end
		    TriggerClientEvent('chatMessage', -1, "^0[^4Twitter^0] (^5@" .. name.firstname .. "^0)", {30, 144, 255}, textmsg)
		end
	end	
	
end)



function stringsplit(inputstr, sep)
    if sep == nil then
        sep = "%s"
    end
    local t={} ; i=1
    for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
        t[i] = str
        i = i + 1
    end
    return t
end



function tablelength(T)
	local count = 0
	for _ in pairs(T) do count = count + 1 end
	return count
end


#8

I’m having an issue where everytime I type /me or /do it comes up with it’s an invalid command, yet it isn’t an invalid command as it works. It used to do it with /911 before I removed that script. See the gyazo below


#9

Hello. May someone please tell me how to add an /do command to esx_rpchat and how to add last name ? I will be very appreciate for response! :wink: