mirror of
https://github.com/ND-Framework/ND_Core.git
synced 2026-08-16 21:46:03 +01:00
Merge pull request #13 from Hakkodevelopment/main
added event to create table if it doesn't exist
This commit is contained in:
@@ -1,5 +1,14 @@
|
||||
-- For support join my discord: https://discord.gg/Z9Mxu72zZ6
|
||||
|
||||
-- Creating database tables
|
||||
AddEventHandler('onResourceStart', function(resourceName)
|
||||
if (GetCurrentResourceName() ~= resourceName) then
|
||||
return
|
||||
end
|
||||
MySQL.query("CREATE TABLE IF NOT EXISTS characters ( `character_id` INT(10) NOT NULL AUTO_INCREMENT, `license` VARCHAR(200) NOT NULL DEFAULT '0', `first_name` VARCHAR(50) NULL DEFAULT NULL, `last_name` VARCHAR(50) NULL DEFAULT NULL, `dob` VARCHAR(50) NULL DEFAULT NULL, `gender` VARCHAR(50) NULL DEFAULT NULL, `twt` VARCHAR(50) NULL DEFAULT NULL, `job` VARCHAR(50) NULL DEFAULT NULL, `cash` INT(10) NULL DEFAULT '0', `bank` INT(10) NULL DEFAULT '0', PRIMARY KEY (`character_id`) USING BTREE);")
|
||||
print('^4ND_Core ^0Database structure validated!')
|
||||
end)
|
||||
|
||||
-- Getting all the characters the player has and returning them to the client.
|
||||
RegisterNetEvent("ND:GetCharacters", function()
|
||||
local player = source
|
||||
@@ -40,4 +49,4 @@ end)
|
||||
AddEventHandler("playerDropped", function()
|
||||
local player = source
|
||||
NDCore.Players[player] = nil
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user