EDIT: Solved.
You must differentiate the extracted string with how many letters you plan to put in the command header.
I dont tend to ask for help much, however a bit new to LUA.
I am currently running a server and came across a custom commands script. Which looks like this.
AddEventHandler('chatMessage', function(source, name, msg)
sm = stringsplit(msg, " ");
if sm[1] == "/t" then
CancelEvent()
TriggerClientEvent('chatMessage', -1, "Tweet | @" .. name, { 30, 144, 255 }, string.sub(msg,5))
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
However, the problem is, that when the message is delivered in the chatbox, the VERY first letter of said message is removed. Which looks like this.
I am unable to solve this, and was curious if anyone had a solution.
Thanks in advanced.