About esx_rpchat tweet command

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 Likes

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]'})

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]'})

Awesome @HumanTree92, was looking for this as well.

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

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

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

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

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
https://gyazo.com/feacf4fc7a2ca3842e94901c0cb01776

1 Like

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:

can i see the admins ID from Twt Chat?

Untitled

how to delete admin chat?
sorry bad english

Does anyone know how to make players when just type a msg sent it with steam name eg. OOC| FlamingOcean: hi guys? and whe they type a command and after that a msg show RP name?

@KilluaZoldyck99 It was in the Config file if I remember correctly.

One of the settings for RP needs to be set to “true”.

I believe you also need to have esx_identity for that to work.

could you tell me what to do step by step? I want << OOC | “game name” became OOC | “Steam Name”

@KilluaZoldyck99

You have to be using esx_identity and in the Config.Lua for esx_rpchat just change “Config.EnableESXIdentity = false” to “Config.EnableESXIdentity = true”’

Cheers mate!

where do i paste this script

twitter wont work

Do you have one for QB Core / Qbus, or can i use that script for that too ?