示例#1
0
        private async void OnResourceStart()
        {
            API.setGamemodeName("pbrp");

            Server serverData = ServerRepository.LoadServerData();

            Server.Date = serverData.DateTime;

            Globals.MAX_PLAYERS = API.getMaxPlayers();

            LoadWeatherData();

            Player.IDs = new Client[Globals.MAX_PLAYERS];
            Player.IDs.Initialize();

            Vehicle.IDs = new GrandTheftMultiplayer.Server.Elements.Vehicle[2000];
            Vehicle.IDs.Initialize();

            // -- Dropped Weapons
            Weapon.DroppedWeapons = WeaponRepository.GetAllDroppedWeapons();
            foreach (Weapon w in Weapon.DroppedWeapons)
            {
                string weaponName = NameToHash.Weapons.Keys.Where(k => NameToHash.Weapons[k] == (WeaponHash)w.Model).First();
                w.DroppedObj = API.createObject(NameToHash.WeaponObjects[weaponName], w.DroppedPos, w.DroppedRot, w.DroppedDimension);
            }

            // --- Dropped Items
            Inventory.DroppedItems = await InventoryRepository.GetAllDroppedInventoryItems();

            foreach (Inventory i in Inventory.DroppedItems)
            {
                i.DroppedObj = API.createObject(Inventory.GetObjectForItem[i.Type], i.DroppedPos, i.DroppedRot, i.DroppedDimension);
            }

            SkinImagePed = API.createPed(PedHash.Barry, new Vector3(-697.0174, 5803.262, 17.33096), 90, 0);

            System.Globalization.CultureInfo.DefaultThreadCurrentCulture = new System.Globalization.CultureInfo("en-US");

            API.removeIpl("bnkheist_apt_dest");
            API.removeIpl("bnkheist_apt_dest_vfx");
            API.removeIpl("bnkheist_apt_dest_lod");
            API.requestIpl("bnkheist_apt_norm");
            API.requestIpl("bnkheist_apt_norm_lod");
            API.removeIpl("CS1_02_cf_offmission");
            API.requestIpl("CS1_02_cf_onmission1");
            API.requestIpl("CS1_02_cf_onmission2");
            API.requestIpl("CS1_02_cf_onmission3");
            API.requestIpl("CS1_02_cf_onmission4");

            API.removeIpl("fakeint");
            API.requestIpl("shr_int");

            API.createObject(1539730305, new Vector3(-810.866821, -210.795883, 340.32489), new Vector3(0, 0, 14.6697245));
            API.createObject(1539730305, new Vector3(-809.520752, -210.520264, 341.861816), new Vector3(89.0096512, -2.6680425e-08, -163.269455));
            API.createObject(1539730305, new Vector3(-810.520752, -208.520264, 341.861816), new Vector3(89.0096512, 4.00206375e-08, -78.2687149));
            API.createObject(1539730305, new Vector3(-810.520752, -212.520264, 341.861816), new Vector3(89.0096512, -2.134434e-07, 101.731239));

            //API.requestIpl("shr_int_lod");

            var doorManager = API.exported.doormanager;

            // -- Base Doors
            doorManager.setDoorState(doorManager.registerDoor(-1666470363, new Vector3(-109.65, 6462.11, 31.98499)), false, 0);   // PB Bank Right Door 1(1)
            doorManager.setDoorState(doorManager.registerDoor(-353187150, new Vector3(-111.48, 6463.94, 31.98499)), false, 0);    // PB Bank Left Door 2 (2)

            doorManager.setDoorState(doorManager.registerDoor(-1501157055, new Vector3(-442.66, 6015.222, 31.86633)), true, 0);   // PB PD Left Door (3)
            doorManager.setDoorState(doorManager.registerDoor(-1501157055, new Vector3(-444.66, 6017.060, 31.86633)), true, 0);   // PB PD Right Door (3)

            doorManager.setDoorState(doorManager.registerDoor(1417577297, new Vector3(-37.33113, -1108.873, 26.7198)), true, 0);  // Simeon Garage Door 1 (5)
            doorManager.setDoorState(doorManager.registerDoor(2059227086, new Vector3(-39.13366, -1108.218, 26.7198)), true, 0);  // Simeon Garage Door 2 (6)
            doorManager.setDoorState(doorManager.registerDoor(2059227086, new Vector3(-59.89302, -1092.952, 26.88362)), true, 0); // Simeon Garage Door 3 (7)
            doorManager.setDoorState(doorManager.registerDoor(1417577297, new Vector3(-60.54582, -1094.749, 26.88872)), true, 0); // Simeone Garage Door 4 (8)

            doorManager.setDoorState(doorManager.registerDoor(-116041313, new Vector3(127.9552, -1298.503, 29.41962)), true, 0);  // LS Strip Club Door 1 (9)
            doorManager.setDoorState(doorManager.registerDoor(668467214, new Vector3(96.09197, -1284.854, 29.43878)), true, 0);   // LS Strip Club Door 2 (10)

            // --- PD INTERIOR DOORS

            doorManager.setDoorState(doorManager.registerDoor(-1033001619, new Vector3(463.4782, -1003.538, 25.00599)), true, 0); // LS PD Door 1 (11)
            doorManager.setDoorState(doorManager.registerDoor(749848321, new Vector3(461.2865, -985.3206, 30.83926)), true, 0);   // LS PD Door 2 (12)
            doorManager.setDoorState(doorManager.registerDoor(749848321, new Vector3(453.0793, -983.1895, 30.83926)), true, 0);   // LS PD Door 3 (Armoury) (13)

            PDManager.AddCell(631614199, new Vector3(464.5601, -992.6381, 25.0649), true);                                        // LS PD Cell 1
            PDManager.AddCell(631614199, new Vector3(461.8293, -994.4047, 25.0649), true);                                        // LS PD Cell 2
            PDManager.AddCell(631614199, new Vector3(461.8293, -998.6381, 25.0649), true);                                        // LS PD Cell 3
            PDManager.AddCell(631614199, new Vector3(461.8293, -1002.6381, 25.0649), true);                                       // LS PD Cell 4

            // -- Property Doors are handled in Property Manager

            ServerDay   = Server.Date.Day;
            ServerMonth = Server.Date.Month;
            ServerYear  = Server.Date.Year;

            ServerHour   = Server.Date.Hour;
            ServerMinute = Server.Date.Minute;

            API.delay(1200, true, OnServerTick);
        }