Hello,
I installed this resource:
Now i want to save the skin in Database.
How to do it?
thanks for help
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?
local player_clothes = {}
player_clothes
table-- Your code goes here
player_clothes.torso = 57 -- The clothing ID (example number)
local json = json.encode(player_clothes)
-- In your SQL insert/update query, use the 'json' variable (NOT player_clothes)
json.decode
to turn the JSON object back to a Lua readable tableyou 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