mirror of
https://github.com/ND-Framework/ND_Core.git
synced 2026-08-17 05:56:01 +01:00
feat: callback when creating a character
This commit is contained in:
@@ -353,6 +353,7 @@ function NDCore.Functions.CreateCharacter(player, firstName, lastName, dob, gend
|
|||||||
local result = MySQL.query.await("SELECT character_id FROM characters WHERE license = ?", {license})
|
local result = MySQL.query.await("SELECT character_id FROM characters WHERE license = ?", {license})
|
||||||
if result and config.characterLimit > #result then
|
if result and config.characterLimit > #result then
|
||||||
characterId = MySQL.insert.await("INSERT INTO characters (license, first_name, last_name, dob, gender, cash, bank) VALUES (?, ?, ?, ?, ?, ?, ?)", {license, firstName, lastName, dob, gender, cash, bank})
|
characterId = MySQL.insert.await("INSERT INTO characters (license, first_name, last_name, dob, gender, cash, bank) VALUES (?, ?, ?, ?, ?, ?, ?)", {license, firstName, lastName, dob, gender, cash, bank})
|
||||||
|
if cb then cb(characterId) end
|
||||||
TriggerClientEvent("ND:returnCharacters", player, NDCore.Functions.GetPlayerCharacters(player))
|
TriggerClientEvent("ND:returnCharacters", player, NDCore.Functions.GetPlayerCharacters(player))
|
||||||
end
|
end
|
||||||
return characterId
|
return characterId
|
||||||
|
|||||||
Reference in New Issue
Block a user