Radio player not working

Hi there! I’m using this release


And when I type /radio in game I get this:

Error running system event handling function for resource radio: citizen:/scripting/lua/scheduler.lua:41: Failed to execute thread: server.lua:33: attempt to call a nil value (method ‘Split’)

This script is fairly old and uses an outdated stringSplit function I believe. Try this:

Open up server.lua, and replace

function stringSplit(self, delimiter)
  local a = self:Split(delimiter)
  local t = {}

  for i = 0, #a - 1 do
     table.insert(t, a[i])
  end

  return t
end

with this

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

If that doesn’t work, the script may have to be rewritten

1 Like