Advertisement
Guest User

Untitled

a guest
Mar 4th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var FiveRP;
  2. (function (FiveRP) {
  3.     var Application = (function () {
  4.         function Application() {
  5.         }
  6.         Application.run = function () {
  7.             Application.loadConfig();
  8.             Application.loadDatabase();
  9.             Application.loadServerEvents();
  10.         };
  11.         Application.loadConfig = function () {
  12.             Application.config = FiveRP.Utils.Config.load();
  13.             console.log('###config:', Application.config);
  14.         };
  15.         Application.loadDatabase = function () {
  16.             FiveRP.Manager.Database.initialize();
  17.         };
  18.         Application.loadServerEvents = function () {
  19.             on('playerConnecting', function (playerName, setKickReason, deferrals) {
  20.                 console.log('###: ' + playerName);
  21.                 console.log(GetPlayerIdentifier(source));
  22.             });
  23.         };
  24.         return Application;
  25.     }());
  26.     FiveRP.Application = Application;
  27. })(FiveRP || (FiveRP = {}));
  28. setTimeout(function () { return FiveRP.Application.run(); }, 200);
  29. var mysql = require('mysql');
  30. var FiveRP;
  31. (function (FiveRP) {
  32.     var Manager;
  33.     (function (Manager) {
  34.         var Database = (function () {
  35.             function Database() {
  36.             }
  37.             Database.initialize = function () {
  38.                 Database.db = mysql.createConnection({
  39.                     host: 'localhost',
  40.                     port: 3306,
  41.                     user: 'root',
  42.                     password: '',
  43.                     database: 'fivem'
  44.                 });
  45.                 Database.db.connect(function (err) {
  46.                     if (err)
  47.                         throw err;
  48.                     console.log("Connected!");
  49.                 });
  50.             };
  51.             return Database;
  52.         }());
  53.         Manager.Database = Database;
  54.     })(Manager = FiveRP.Manager || (FiveRP.Manager = {}));
  55. })(FiveRP || (FiveRP = {}));
  56. var fs = require('fs');
  57. var FiveRP;
  58. (function (FiveRP) {
  59.     var Utils;
  60.     (function (Utils) {
  61.         var Config = (function () {
  62.             function Config() {
  63.             }
  64.             Config.load = function () {
  65.                 var path = GetResourcePath(GetCurrentResourceName());
  66.                 return JSON.parse(fs.readFileSync(path + "/config.json"));
  67.             };
  68.             return Config;
  69.         }());
  70.         Utils.Config = Config;
  71.     })(Utils = FiveRP.Utils || (FiveRP.Utils = {}));
  72. })(FiveRP || (FiveRP = {}));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement