[Release] Supertable [1.3] - A Lightweight MySQL database manager for FX-Server [ST]

Just wanted to let you know that I’ve tested out your new version and I’m getting my values from the DB so this is EXCELLENT :slight_smile:

1 Like

Can’t wait to see your stuff when it’s finished :smiley:

New update is out, removed some error logs and optimized DB creation. Seems like it picked up some popularity since the last update haha, if anyone has any questions I’m always available on discord and will eventually get back to you :slight_smile: (Supa on discord)

I added a link @JinkLeft to your mod in the main post.

Hi…
Can you help me check this script is correct?
I need get result from test1 and test2…
How can I do???
Thanks…

function Super_Get_Test(player, resultCallBack1, resultCallBack2)
    local steamid = Super_Get_Steam_ID(player)
    
    MySQL.Async.fetchScalar("SELECT test1, test2 FROM supertable WHERE steamid LIKE @id LIMIT 1", {id = steamid}, function (result1, result2)
        resultCallBack1(result1)
        resultCallBack2(result2)
    end)
end

You can’t fetch multiple pieces of data using fetchScalar. You need to use fetchAll.

function Super_Get_Test(player, resultCallBack)
    local steamid = GetSteamId(player)
    
    MySQL.Async.fetchAll('SELECT test1, test2 FROM supertable WHERE steamid LIKE @id LIMIT 1', {id = steamid}, function (result)
        resultCallBack(result)
    end)
end

Should work.

If you’re trying to use the fetched values you use them like

result[1].test1
result[1].test2

Thanks for your help…

1 Like

Sorry…
Already try…
But I dont understand how to use result…
Like this???

Super_Get_Test(player, function(result)
  local test1 = result[1].test1
  local test2 = result[1].test2

  print(result[1].test1.' '..result[1].test2)
end)

print(result[1].test1) should print that value retrieved from that column… I don’t have enough information to know what kind of information is stored in those columns.

Hi, can you help me with this ? Screenshot_82 i’m not very good in coding ^^’

Even though this is an old post, this is great. Absolutely a time saver for people making game modes from scratch. A lot more simplified and lighter than EssentialMode.

Building my custom game mode on this piece of work. If you are still active, Kudos to you!

1 Like

It’s possible to update the money Just in Table users not in Table supertable please ?

This does not make a table called “users” That is another script.

When you take the money after kill a pnj for example xith the script moneydrop he update the money in table supertable in database so how can I change and do this update money to Table users in my database.

I hope I was clear :yum:

I love the script release. An FYI I am almost done converting this and money drop to work with esx and the esx database structure. I will probably release it once I’m finished.

I am not still active but I’m glad it helped you out. Best of luck in the future~

any chance you might be able to make this work for reports so for example if someone does /report it stores it in a database that you can then access from in-game

Could you please explain more what are main differences between this and regular SQL db? :slightly_smiling_face:

its says no such table on essentialmode.supertable
can i get a .sql file to create the table?
or what command to use to create essentialmode.supertable ?
tell me what colum i need to create in the essentialmode.supertable…

Doesn’t work with the payments that are already in the database, If i have already a database with payments then it doesn’t change that value but the value in supertable itself which is useless… And somehow i can’t get it to work with the payment i have in the database

this line: local sql = “UPDATE supertable SET money = money + @money WHERE steamid = @id
is adding money on supertable where steamid = @id but we have identifier as colom for our steamID and thus not working good for my purpose:(

and i tried many ways like this:
“UPDATE users SET money = money + @money WHERE identifier = steam:”…userSteamID…"
and may variants but it seems that he returns: steam:mysteamid but it doesn’t work.
and
“UPDATE users SET money = money + @money WHERE identifier = @identifier
also not work

userSteamID is a string i made string.lower so it outputs my steam id in lower cases so the output is something like this steam:1000038277kd832 so it should work but it doesn’t yet

That’s all i want, just update the money colom in the user table in the essentialmode database
The rest i don’t care in this script.