Upload files to "server"
This commit is contained in:
parent
fd2c6e0051
commit
27445f1778
|
|
@ -34,7 +34,10 @@ RegisterNetEvent("turfwar:appearance:request", function()
|
|||
{ license }
|
||||
)
|
||||
|
||||
local isNew = false
|
||||
|
||||
if not row then
|
||||
isNew = true
|
||||
local def = defaultRow(license)
|
||||
exports.oxmysql:insertSync(
|
||||
"INSERT INTO turfwar_appearance (license, gender, hair_drawable, hair_texture, hair_color, hair_highlight) VALUES (?, ?, ?, ?, ?, ?)",
|
||||
|
|
@ -43,6 +46,50 @@ RegisterNetEvent("turfwar:appearance:request", function()
|
|||
row = def
|
||||
end
|
||||
|
||||
row.isNew = isNew
|
||||
TriggerClientEvent("turfwar:appearance:update", src, row)
|
||||
end)
|
||||
|
||||
RegisterNetEvent("turfwar:appearance:setGender", function(gender)
|
||||
local src = source
|
||||
local license = getLicense(src)
|
||||
if not license then return end
|
||||
|
||||
gender = (gender == "f") and "f" or "m"
|
||||
|
||||
exports.oxmysql:updateSync(
|
||||
"UPDATE turfwar_appearance SET gender = ? WHERE license = ?",
|
||||
{ gender, license }
|
||||
)
|
||||
|
||||
local row = exports.oxmysql:singleSync(
|
||||
"SELECT gender, hair_drawable, hair_texture, hair_color, hair_highlight FROM turfwar_appearance WHERE license = ?",
|
||||
{ license }
|
||||
)
|
||||
row.isNew = false
|
||||
TriggerClientEvent("turfwar:appearance:update", src, row)
|
||||
end)
|
||||
|
||||
RegisterNetEvent("turfwar:appearance:setHair", function(drawable, texture, color, highlight)
|
||||
local src = source
|
||||
local license = getLicense(src)
|
||||
if not license then return end
|
||||
|
||||
drawable = tonumber(drawable) or 0
|
||||
texture = tonumber(texture) or 0
|
||||
color = tonumber(color) or 0
|
||||
highlight = tonumber(highlight) or color
|
||||
|
||||
exports.oxmysql:updateSync(
|
||||
"UPDATE turfwar_appearance SET hair_drawable=?, hair_texture=?, hair_color=?, hair_highlight=? WHERE license=?",
|
||||
{ drawable, texture, color, highlight, license }
|
||||
)
|
||||
|
||||
local row = exports.oxmysql:singleSync(
|
||||
"SELECT gender, hair_drawable, hair_texture, hair_color, hair_highlight FROM turfwar_appearance WHERE license = ?",
|
||||
{ license }
|
||||
)
|
||||
row.isNew = false
|
||||
TriggerClientEvent("turfwar:appearance:update", src, row)
|
||||
end)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user