[Release] Private/Text Message Script [UPDATED]

  • Added an optional Automatic updating function

  • Added /141 for Anonymous Messaging

  • Minor Bug Fixes

1 Like

darn wish this worked with vrp_paycheck, not sure what the issue is… just stops working and then corrupts the paycheck alerts

Hey guys, this function work in ESX base? i want to try it

This is a standalone script

im getting a page error when i try
load this website

Here is the script. textscript.rar (2.2 KB)

ty but that’s the same version as have mine is trying to update and i playing up

Error running system event handling function for resource textscript: citizen:/scripting/lua/scheduler.lua:41: Failed to execute thread: server.lua:74: attempt to compare string with nil
stack traceback:
server.lua:74: in local ‘userCallback’
citizen:/scripting/lua/scheduler.lua:274: in upvalue ‘handler’
citizen:/scripting/lua/scheduler.lua:175: in function citizen:/scripting/lua/scheduler.lua:174
stack traceback:
[C]: in function ‘error’
citizen:/scripting/lua/scheduler.lua:41: in field ‘CreateThreadNow’
citizen:/scripting/lua/scheduler.lua:174: in function citizen:/scripting/lua/scheduler.lua:138
Your version: 2.0
Error running system event handling function for resource textscript: citizen:/scripting/lua/scheduler.lua:41: Failed to execute thread: server.lua:11: attempt to concatenate a nil value (local ‘rText’)
stack traceback:
server.lua:11: in local ‘userCallback’
citizen:/scripting/lua/scheduler.lua:274: in upvalue ‘handler’
citizen:/scripting/lua/scheduler.lua:175: in function citizen:/scripting/lua/scheduler.lua:174
stack traceback:
[C]: in function ‘error’
citizen:/scripting/lua/scheduler.lua:41: in field ‘CreateThreadNow’
citizen:/scripting/lua/scheduler.lua:174: in function citizen:/scripting/lua/scheduler.lua:138

Just out-comment the update functions…

Or take this
--Config
--autoupdatever = true  -- automatically detect and fetch the download for the latest version of this script?
--End Config

--Startup
print("TextScript, Created By ToniMorton and RJRoss")
--[[
_version = "2.0"
print("Checking Version...")
PerformHttpRequest("https://simplicity-gaming.com/2w3dj19qh8e98192h19he9032.txt", function(err, rText, headers)
print("Your version: " .. _version )
print("Current version: " .. rText .. "\n")
end, "GET", "", {table = nil})
]]
--End Startup

-- Eventhandlers
AddEventHandler('chatMessage', function(source, color, msg)
	cm = stringsplit(msg, " ")
	if cm[1] == "/text" or cm[1] == "/txt" then
		CancelEvent()
			if tablelength(cm) > 1 then
			local tPID = tonumber(cm[2])
			local names2 = GetPlayerName(tPID)
			local names3 = GetPlayerName(source)
			local msgVar = {}
			local textmsg = ""
			for i=1, #cm do
				if i ~= 1 and i ~= 2 then
					textmsg = (textmsg .. " " .. tostring(cm[i]))
				end
			end		
			TriggerClientEvent('simp:textmsg', tPID, source, textmsg, names2, names3)
			TriggerClientEvent('simp:textsent', source, tPID, names2)
		end
	end	
	if cm[1] == "/re-read" or cm[1] == "/reread" or cm[1] == "/rerd" then
		CancelEvent()
	    TriggerClientEvent('simp:recovermessage', source)
	end
end)

AddEventHandler('chatMessage', function(source, name, msg)
	sm = stringsplit(msg, " ");
	if sm[1] == "/141" then
		CancelEvent()
			TriggerClientEvent("simp:141text", sm[2], string.sub(msg,8))
			TriggerClientEvent("simp:141sent", source)
	end
end)
--end Eventhandlers

--functions
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
--end Functions
--[[
--AutoUpdater
if autoupdatever == true then
PerformHttpRequest("https://simplicity-gaming.com/2w3dj19qh8e98192h19he9032.txt", function(err, rText, headers)
		if rText > _version then
			print("\n\nOutdated Version!\nThe download for the latest version of TextScript will now be opened!\nPlease install the new version!")
			os.execute("start https://simplicity-gaming.com/releases/files/textscript.zip")
		elseif _version > rText then
			print("\n\nUnknown Version!\nThe download for the latest version of TextScript will now be opened!\nPlease install the new version!")
			os.execute("start https://simplicity-gaming.com/releases/files/textscript.zip")
		else
			print("TextScript is OK\n")
		end
end, "GET", "", {table = nil})
else
print("Automatic updates are disabled. Please ensure your version matches the current version manually.")
end
--End AutoUpdater
]]

awesome you


You can turn off the automatic updates by just changing

autoupdatever = true
to
autoupdatever = false

Ive had an issue with my host and im in the process of moving stuff to a new webserver so i hope to be able to get the autoupdater back online shortly.

awesome thanks for letting us know

The download link doesn’t work?

Fixed the download link! The Autoupdater should no longer have any issues either (you would need to replace the link in it though for it to actually supply any updates)

I have been trying to get this to work with vRP for my server with no Luck…

the discord invite is not working

i get all types of errors from this

https://gyazo.com/e15008b69a7bd9634dc4bb181a68fe4b

The download link isn’t working anymore

here is a direct download.

Hello there!

Been using this script for a while now without issues, but now I get this issue when I laod the script into the server.cfg.

Anyone able to help me out?

would be much appreciated :slight_smile:

why would this work fine but pop up the error ‘/text 1 blahblah not a valid command’??

I like the script but I cant shake that issue