From 4928da788ba6df53d9c8131cc6e86b6d1c7167a5 Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Sun, 6 Jun 2021 07:14:54 +1000 Subject: [PATCH] refactor(server/main): Include the varchar command by default so people don't misplace it --- server/main.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/server/main.lua b/server/main.lua index 06c43769..87c10aa5 100644 --- a/server/main.lua +++ b/server/main.lua @@ -7,7 +7,18 @@ if ESX.GetConfig().Multichar == true then Config.Database = 'es_extended' -- enter a prefix to prepend to all user identifiers (keep it short) Config.Prefix = 'char' - + + RegisterCommand('varchar', function(source) + if source == 0 then + if next(IdentifierTables) == nil then print(' Unable to update your tables - have you defined the correct database?') return end + for _, itable in pairs(IdentifierTables) do + print('Setting `'..itable.table..'` column `'..itable.column..'` to VARCHAR(60)') + MySQL.Sync.execute("ALTER TABLE "..itable.table.." MODIFY COLUMN "..itable.column.." VARCHAR(60)", {}) + end + Citizen.Wait(100) + print(' Updated your tables to use the correct field length - you should remove this command') + end + end, true) SetupCharacters = function(playerId) while fetchCharacters == -1 do Citizen.Wait(100) end