How to save data from this resource in Database

Hello,
I installed this resource:

Now i want to save the skin in Database.
How to do it?

thanks for help

You can use the server-sided event (lbg-chardone) already built into the client-side.

Server side:

RegisterNetEvent('lbg-chardone')
AddEventHandler('lbg-chardone', function(Character)
    -- SQL Query here (use Character table as the player skin data)
end)

If you are unsure how to setup and use databases look at MySQL Async.

Not the Solution. I want to know the DB schema and how to insert it in the DB.
You can’t insert the hole Character in one line in the DB

use json and longtext data type.

check mysql-async Documentation - mysql-async Documentation
or even better use updated and maintained version of oxmysql
Getting Started | Overextended

You can insert the hole Character in one line, using the good method, using json.encode and a longtext in you db, you can do it

Example?

@Vinc189

  1. Create a table
local player_clothes = {}
  1. Where you set your player clothes (body torso, shoes, mask etc), add to the player_clothes table
-- Your code goes here
player_clothes.torso = 57 -- The clothing ID (example number)
  1. Then when you save to the database, encode it so it saves as JSON
local json = json.encode(player_clothes)
-- In your SQL insert/update query, use the 'json' variable (NOT player_clothes)
  1. When loading from database, don’t forget to use json.decode to turn the JSON object back to a Lua readable table
2 Likes

you dont need to save the information to a database because it already saves information to the built in kvp database, you just need to extract the information on loading into the server