From 441eaca65dc52eae51d934d2dda064bf64230342 Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Sat, 18 Feb 2023 14:38:52 -0600 Subject: [PATCH] Start working on custom classes for native wrapping --- scripts/server/native/connected.js | 23 +++++++++++++++++++++-- scripts/server/native/ragemp.js | 24 ++++++++++++++++++++++-- 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/scripts/server/native/connected.js b/scripts/server/native/connected.js index 02da8ee1..d8d669e5 100644 --- a/scripts/server/native/connected.js +++ b/scripts/server/native/connected.js @@ -7,6 +7,25 @@ // TYPE: Server (JavaScript) // =========================================================================== +class vPlayer { + constructor(id, name = "", object = null) { + object: null; + name: null; + id: -1; + } +} + +// =========================================================================== + +class vVehicle { + constructor(id, object = null) { + object: null; + id: -1; + } +} + +// =========================================================================== + let builtInCommands = [ "refresh", "restart", @@ -827,7 +846,7 @@ function connectToDatabase() { if (getDatabaseConfig().usePersistentConnection) { if (persistentDatabaseConnection == null) { logToConsole(LOG_DEBUG, `[V.RP.Database] Initializing database connection ...`); - persistentDatabaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port); + persistentDatabaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port, getDatabaseConfig().useSSL); if (persistentDatabaseConnection.error) { logToConsole(LOG_ERROR, `[V.RP.Database] Database connection error: ${persistentDatabaseConnection.error}`); persistentDatabaseConnection = null; @@ -841,7 +860,7 @@ function connectToDatabase() { return persistentDatabaseConnection; } } else { - let databaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port); + let databaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port, getDatabaseConfig().useSSL); if (databaseConnection.error) { logToConsole(LOG_ERROR, `[V.RP.Database] Database connection error: ${persistentDatabaseConnection.error}`); return false; diff --git a/scripts/server/native/ragemp.js b/scripts/server/native/ragemp.js index 33b2b84d..8faa0621 100644 --- a/scripts/server/native/ragemp.js +++ b/scripts/server/native/ragemp.js @@ -7,6 +7,26 @@ // TYPE: Server (JavaScript) // =========================================================================== +class vPlayer { + constructor(id, name = "", object = null) { + object: null; + name: null; + id: -1; + } +} + +// =========================================================================== + +class vVehicle { + constructor(id, object = null) { + object: null; + id: -1; + } +} + +// =========================================================================== + +// Needs updated for RAGEMP let builtInCommands = [ "refresh", "restart", @@ -743,7 +763,7 @@ function connectToDatabase() { if (getDatabaseConfig().usePersistentConnection) { if (persistentDatabaseConnection == null) { logToConsole(LOG_DEBUG, `[V.RP.Database] Initializing database connection ...`); - persistentDatabaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port); + persistentDatabaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port, getDatabaseConfig().useSSL); if (persistentDatabaseConnection.error) { logToConsole(LOG_ERROR, `[V.RP.Database] Database connection error: ${persistentDatabaseConnection.error}`); persistentDatabaseConnection = null; @@ -757,7 +777,7 @@ function connectToDatabase() { return persistentDatabaseConnection; } } else { - let databaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port); + let databaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port, getDatabaseConfig().useSSL); if (databaseConnection.error) { logToConsole(LOG_ERROR, `[V.RP.Database] Database connection error: ${persistentDatabaseConnection.error}`); return false;