Пример #1
0
        // Construct
        public LSRP()
        {
            // MySQL init
            db.Connect();

            // Events
            API.onServerResourceStart += API_onServerResourceStart;
            API.onClientEventTrigger  += ClientEvents.API_OnClientEvent;
            API.onPlayerConnected     += PlayerClass.OnPlayerConnected;
            API.onPlayerHealthChange  += PlayerClass.OnPlayerHealthChangeHandler;
            API.onPlayerDisconnected  += PlayerClass.OnPlayerDisconnectedHandler;
            API.onChatMessage         += PlayerClass.OnChatMessageHandler;
            API.onChatCommand         += PlayerClass.OnChatCommandHandler;
            API.onEntityEnterColShape += OnEntityEnterColShapeHandler;

            // Set world time
            API.setTime(20, 0);

            // Main server timers
            Timer secondTimer = new Timer();

            secondTimer.Elapsed += new ElapsedEventHandler(OnSecondTimer);
            secondTimer.Interval = 1000;
            secondTimer.Enabled  = true;

            Timer minuteTimer = new Timer();

            minuteTimer.Elapsed += new ElapsedEventHandler(OnMinuteTimer);
            minuteTimer.Interval = 60000;
            minuteTimer.Enabled  = true;

            // Loads
            VehicleClass.LoadVehicles();
            ItemManager.LoadItems();
            DoorManager.LoadDoors();
        }