Esempio n. 1
0
        public ELS()
        {
            bool Loaded = false;

            _controlConfiguration = new configuration.ControlConfiguration();
            _FileLoader           = new FileLoader(this);
            _vehicleManager       = new VehicleManager();
            EventHandlers["onClientResourceStart"] += new Action <string>((string obj) =>
            {
                //TODO rewrite loader so that it
                if (obj == Function.Call <string>(Hash.GET_CURRENT_RESOURCE_NAME))
                {
                    //await Delay(500);
                    try
                    {
                        _FileLoader.RunLoader(obj);
                        //TODO: make a load files from all resouces.
                        Screen.ShowNotification($"Welcome {LocalPlayer.Name}\n ELS FiveM\n\n ELS FiveM is Licensed under LGPL 3.0\n\nMore inforomation can be found at http://fivem-scripts.net");
                        SetupConnections();
                        TriggerServerEvent("ELS:FullSync:Request:All", Game.Player.ServerId);
                    }
                    catch (Exception e)
                    {
                        TriggerServerEvent($"ONDEBUG", e.ToString());
                        Screen.ShowNotification($"ERROR:{e.Message}");
                        Tick -= Class1_Tick;
                        throw;
                    }
                }
                else
                {
                    try
                    {
                        _FileLoader.RunLoader(obj);
                    }
                    catch (Exception e)
                    {
                        TriggerServerEvent($"ONDEBUG", e.ToString());
                        Screen.ShowNotification($"ERROR:{e.Message}");
                    }
                }

                //_spotLight= new SpotLight();
            });
        }
Esempio n. 2
0
        public ELS()
        {
            controlConfiguration = new configuration.ControlConfiguration();
            _FileLoader          = new FileLoader(this);
            _sirenManager        = new SirenManager();

            EventHandlers["onClientResourceStart"] += new Action <string>(
                (string obj) =>
            {
                try
                {
                    if (obj != CurrentResourceName())
                    {
                        _FileLoader.RunLoadeer(obj);
                    }
                    else if (obj == CurrentResourceName())
                    {
                        Screen.ShowNotification($"Welcome {LocalPlayer.Name}  to ELS FiveM\n\n ELS FiveM is Licensed under LGPL 3.0\n\nMore inforomation can be found at http://fivem-scripts.net");

                        // BaseScript.Delay(5000);
                        _FileLoader.RunLoadeer(obj);
                        Tick += Class1_Tick;
                    }
                }
                catch (Exception e)
                {
                    TriggerServerEvent($"ONDEBUG", e.ToString());
                    Screen.ShowNotification($"ERROR:{e.Message}");
                    Tick -= Class1_Tick;
                    throw;
                }

                //_spotLight= new SpotLight();
            });
            EventHandlers["ELS:SirenUpdated"] += new Action <int, string, bool>(_sirenManager.UpdateSirens);

            EventHandlers["onPlayerJoining"] += new Action(() =>
            {
            });
        }