Help with a Mail System

I have a mail system on my server, what it does is you are able to send mail to other players. Downside is, you are not allowed to send mail to other players who are offline. If anyone has a better mail system that allows cross server mailing to players who are offline or online.

I am receiving an error for the mail system that is currently on the server which is

[ERROR] lua/includes/extensions/string.lua:44: bad argument #1 to 'string_gmatch' (string expected, got nil)
  1. string_gmatch - [C]:-1
   2. Explode - lua/includes/extensions/string.lua:44
    3. populateList - addons/mail/lua/autorun/client/cl_menu.lua:111
     4. OpenMailbox - addons/mail/lua/autorun/client/cl_menu.lua:150
      5. fn - addons/mail/lua/autorun/client/cl_menu.lua:1199
       6. unknown - addons/ulib/lua/ulib/shared/hook.lua:183

If you can help me thanks. If you also have a better mail system that does what was mentioned above would also be very appreciated.

Would need to see the code to help, also sending mail to players offline and on other servers would require MySQL and storage based on steamid probably.

Like Kevin said, the

string expected, got nil

could be caused by a number of issues so really we’d have to see your whole code to help.

Thanks for the feedback, I decided to remove it entirely for a better mailing system, one with mysql so the players have the ability to message offline players. Have anything in mind?

keep track of steamids and name in sql database, let users send mail to name/steamid, store mail in database, retrieve mail when players join by looking up their steamid.

Have any idea how the code is written though?

Yes, but it would have to be written in multiple parts and is too much to just write on the spot.

If you want to start on a single part first, we can help you along the way.

Alright thanks