Beispiel #1
0
        private async Task SpawnCartDefault()
        {
            Cart def = spawnedCart.Item2;

            uint hashCart = (uint)API.GetHashKey(def.getHorseModel());
            await InitStables.LoadModel(hashCart);

            int     pPID      = API.PlayerPedId();
            Vector3 playerPos = API.GetEntityCoords(pPID, true, true);


            Vector3 spawnPos     = playerPos;
            Vector3 spawnPos2    = Vector3.Zero;
            float   spawnHeading = 0.0F;
            int     unk1         = 0;

            //API.GetClosestRoad(playerPos.X + 10.0f, playerPos.Y + 10.0f, playerPos.Z, 0.0f, 25, ref spawnPos, ref spawnPos2, ref unk1, ref unk1, ref spawnHeading, true);

            int spawnedh = Function.Call <int>((Hash)0xAF35D0D2583051B0, hashCart, spawnPos.X, spawnPos.Y, spawnPos.Z, spawnHeading, true, true, false, true);

            API.SetPedIntoVehicle(API.PlayerPedId(), spawnedh, -1);

            SET_PED_DEFAULT_OUTFIT(spawnedh);

            //Function.Call((Hash)0x283978A15512B2FE, spawnedh, true);

            await Delay(1000);

            Function.Call((Hash)0x23F74C2FDA6E7C61, -1236452613, spawnedh);
            Function.Call((Hash)0x6A071245EB0D1882, spawnedh, pPID, 4000, 5.0F, 2.0F, 0F, 0);
            Function.Call((Hash)0x98EFA132A4117BE1, spawnedh, def.getHorseName());
            Function.Call((Hash)0x4A48B6E03BABB4AC, spawnedh, def.getHorseName());

            uint hashP = (uint)API.GetHashKey("PLAYER");

            Function.Call((Hash)0xADB3F206518799E8, spawnedh, hashP);
            Function.Call((Hash)0xCC97B29285B1DC3B, spawnedh, 1);

            spawnedCart = new Tuple <int, Cart>(spawnedh, def);

            //Function.Call((Hash)0x931B241409216C1F, API.PlayerPedId(), spawnedh, 0); //Brush

            API.SetModelAsNoLongerNeeded(hashCart);
        }
        public static async Task LoadMyHorsePreview(int stID, int index)
        {
            if (!MyhorseIsLoaded)
            {
                float x       = float.Parse(GetConfig.Config["Stables"][stID]["SpawnHorse"][0].ToString());
                float y       = float.Parse(GetConfig.Config["Stables"][stID]["SpawnHorse"][1].ToString());
                float z       = float.Parse(GetConfig.Config["Stables"][stID]["SpawnHorse"][2].ToString());
                float heading = float.Parse(GetConfig.Config["Stables"][stID]["SpawnHorse"][3].ToString());

                uint hashPed = (uint)GetHashKey(HorseManagment.MyHorses[index].getHorseModel());

                await InitStables.LoadModel(hashPed);

                HorsePed = CreatePed(hashPed, x, y, z, heading, false, true, true, true);
                Function.Call((Hash)0x283978A15512B2FE, HorsePed, true);
                SetEntityCanBeDamaged(HorsePed, false);
                SetEntityInvincible(HorsePed, true);
                FreezeEntityPosition(HorsePed, true);
                SetModelAsNoLongerNeeded(hashPed);
            }
        }
        public static async Task LoadCartPreview(int index, int veh2Delete)
        {
            cartIsLoaded = false;
            DeleteVehicle(ref veh2Delete);
            float x       = float.Parse(GetConfig.Config["Stables"][stableId]["SpawnCart"][0].ToString());
            float y       = float.Parse(GetConfig.Config["Stables"][stableId]["SpawnCart"][1].ToString());
            float z       = float.Parse(GetConfig.Config["Stables"][stableId]["SpawnCart"][2].ToString());
            float heading = float.Parse(GetConfig.Config["Stables"][stableId]["SpawnCart"][3].ToString());
            uint  hashVeh = (uint)GetHashKey(GetConfig.CartLists.ElementAt(index).Key);

            await InitStables.LoadModel(hashVeh);

            CartPed = CreateVehicle(hashVeh, x, y, z, heading, false, true, true, true);
            Function.Call((Hash)0xAF35D0D2583051B0, CartPed, true);
            SetEntityCanBeDamaged(CartPed, false);
            SetEntityInvincible(CartPed, true);
            FreezeEntityPosition(CartPed, true);
            SetModelAsNoLongerNeeded(hashVeh);

            cartIsLoaded = true;
        }
        public static async Task LoadHorsePreview(int cat, int index, int ped2Delete)
        {
            horseIsLoaded = false;
            DeletePed(ref ped2Delete);
            float x       = float.Parse(GetConfig.Config["Stables"][stableId]["SpawnHorse"][0].ToString());
            float y       = float.Parse(GetConfig.Config["Stables"][stableId]["SpawnHorse"][1].ToString());
            float z       = float.Parse(GetConfig.Config["Stables"][stableId]["SpawnHorse"][2].ToString());
            float heading = float.Parse(GetConfig.Config["Stables"][stableId]["SpawnHorse"][3].ToString());

            uint hashPed = (uint)GetHashKey(GetConfig.HorseLists.ElementAt(cat).Value.ElementAt(index).Key);

            await InitStables.LoadModel(hashPed);

            HorsePed = CreatePed(hashPed, x, y, z, heading, false, true, true, true);
            Function.Call((Hash)0x283978A15512B2FE, HorsePed, true);
            SetEntityCanBeDamaged(HorsePed, false);
            SetEntityInvincible(HorsePed, true);
            FreezeEntityPosition(HorsePed, true);
            SetModelAsNoLongerNeeded(hashPed);

            horseIsLoaded = true;
        }
Beispiel #5
0
        private void LoadDefaultConfig(string dc, ExpandoObject dl)
        {
            Config = JObject.Parse(dc);

            foreach (var l in dl)
            {
                Langs[l.Key] = l.Value.ToString();
            }

            foreach (JObject categories in GetConfig.Config["Horses"].Children <JObject>())
            {
                foreach (JProperty cat in categories.Properties())
                {
                    Dictionary <string, double> hlist = new Dictionary <string, double>();

                    foreach (JObject horse in cat.Value.Children <JObject>())
                    {
                        foreach (JProperty h in horse.Properties())
                        {
                            hlist.Add(h.Name, double.Parse(h.Value.ToString()));
                        }
                    }

                    HorseLists.Add(cat.Name, hlist);
                }
            }

            foreach (JObject carts in GetConfig.Config["Carts"].Children <JObject>())
            {
                foreach (JProperty cart in carts.Properties())
                {
                    CartLists.Add(cart.Name, cart.Value.ToObject <double>());
                }
            }

            foreach (JObject catComponents in GetConfig.Config["Complements"].Children <JObject>())
            {
                foreach (JProperty cat in catComponents.Properties())
                {
                    Dictionary <string, List <uint> > hlist = new Dictionary <string, List <uint> >();
                    Dictionary <string, double>       clist = new Dictionary <string, double>();

                    foreach (JObject comps in cat.Value.Children <JObject>())
                    {
                        foreach (JProperty c in comps.Properties())
                        {
                            List <uint> hashes = new List <uint>();
                            for (int i = 0; i < c.Value.Count() - 1; i++)
                            {
                                hashes.Add(FromHex(c.Value[i].ToString()));
                            }

                            hlist.Add(c.Name, hashes);
                            clist.Add(c.Name, double.Parse(c.Value[c.Value.Count() - 1].ToString()));
                        }
                    }

                    CompsLists.Add(cat.Name, hlist);
                    CompsPrices.Add(cat.Name, clist);
                }
            }

            //Start When finish Loading
            InitStables.StartInit();
        }
Beispiel #6
0
        private async Task SpawnHorseDefault()
        {
            Horse def = spawnedHorse.Item2;

            uint hashHorse = (uint)API.GetHashKey(def.getHorseModel());
            await InitStables.LoadModel(hashHorse);

            int     pPID      = API.PlayerPedId();
            Vector3 playerPos = API.GetEntityCoords(pPID, true, true);


            Vector3 spawnPos     = Vector3.Zero;
            Vector3 spawnPos2    = Vector3.Zero;
            float   spawnHeading = 0.0F;
            int     unk1         = 0;

            //API.GetNthClosestVehicleNodeWithHeading(playerPos.X, playerPos.Y, playerPos.Z, 25, ref spawnPos, ref spawnHeading, ref unk1, 0, 0f, 0f);

            API.GetClosestRoad(playerPos.X + 10.0f, playerPos.Y + 10.0f, playerPos.Z, 0.0f, 25, ref spawnPos, ref spawnPos2, ref unk1, ref unk1, ref spawnHeading, true);

            if (API.GetDistanceBetweenCoords(playerPos.X, playerPos.Y, playerPos.Z, spawnPos.X, spawnPos.Y, spawnPos.Z, false) > 25.0f)
            {
                spawnPos.X = playerPos.X + 10.0f;
                spawnPos.Y = playerPos.Y + 10.0f;
                spawnPos.Z = playerPos.Z + 1.0f;
            }

            int spawnedh = API.CreatePed(hashHorse, spawnPos.X, spawnPos.Y, spawnPos.Z, spawnHeading, true, true, false, false);

            Function.Call((Hash)0x283978A15512B2FE, spawnedh, true);
            Function.Call((Hash)0x23F74C2FDA6E7C61, -1230993421, spawnedh);
            Function.Call((Hash)0x6A071245EB0D1882, spawnedh, pPID, 4000, 5.0F, 2.0F, 0F, 0);
            Function.Call((Hash)0x98EFA132A4117BE1, spawnedh, def.getHorseName());
            Function.Call((Hash)0x4A48B6E03BABB4AC, spawnedh, def.getHorseName());

            uint hashP = (uint)API.GetHashKey("PLAYER");

            Function.Call((Hash)0xADB3F206518799E8, spawnedh, hashP);
            Function.Call((Hash)0xCC97B29285B1DC3B, spawnedh, 1);

            JObject gear     = def.getGear();
            uint    blanket  = ConvertValue(gear["blanket"].ToString());
            uint    saddle   = ConvertValue(gear["saddle"].ToString());
            uint    mane     = ConvertValue(gear["mane"].ToString());
            uint    tail     = ConvertValue(gear["tail"].ToString());
            uint    bag      = ConvertValue(gear["bag"].ToString());
            uint    bedroll  = ConvertValue(gear["bedroll"].ToString());
            uint    stirrups = ConvertValue(gear["stirrups"].ToString());
            uint    horn     = ConvertValue(gear["horn"].ToString());

            if (blanket != -1)
            {
                Function.Call((Hash)0xD3A7B003ED343FD9, spawnedh, blanket, true, true, true);
            }
            if (saddle != -1)
            {
                Function.Call((Hash)0xD3A7B003ED343FD9, spawnedh, saddle, true, true, true);
            }
            if (mane != -1)
            {
                Function.Call((Hash)0xD3A7B003ED343FD9, spawnedh, mane, true, true, true);
            }
            if (tail != -1)
            {
                Function.Call((Hash)0xD3A7B003ED343FD9, spawnedh, tail, true, true, true);
            }
            if (bag != -1)
            {
                Function.Call((Hash)0xD3A7B003ED343FD9, spawnedh, bag, true, true, true);
            }
            if (bedroll != -1)
            {
                Function.Call((Hash)0xD3A7B003ED343FD9, spawnedh, bedroll, true, true, true);
            }
            if (stirrups != -1)
            {
                Function.Call((Hash)0xD3A7B003ED343FD9, spawnedh, stirrups, true, true, true);
            }
            if (horn != -1)
            {
                Function.Call((Hash)0xD3A7B003ED343FD9, spawnedh, horn, true, true, true);
            }

            //NoHair
            if (mane == 1)
            {
                Function.Call((Hash)0xD710A5007C2AC539, spawnedh, 0xAA0217AB, 0);
            }
            if (tail == 1)
            {
                Function.Call((Hash)0xD710A5007C2AC539, spawnedh, 0xA63CAE10, 0);
            }

            //Create Tag
            MPTagHorse = Function.Call <int>((Hash)0x53CB4B502E1C57EA, spawnedh, def.getHorseName(), false, false, "", 0);

            spawnedHorse = new Tuple <int, Horse>(spawnedh, def);

            Function.Call((Hash)0xFE26E4609B1C3772, spawnedh, "HorseCompanion", true);

            Function.Call((Hash)0xA691C10054275290, API.PlayerPedId(), spawnedh, 0);
            Function.Call((Hash)0x931B241409216C1F, API.PlayerPedId(), spawnedh, 0);
            Function.Call((Hash)0xED1C764997A86D5A, API.PlayerPedId(), spawnedh);


            Function.Call((Hash)0xB8B6430EAD2D2437, spawnedh, 130495496);

            Function.Call((Hash)0xDF93973251FB2CA5, API.GetEntityModel(spawnedh), 1);

            Function.Call((Hash)0xAEB97D84CDF3C00B, spawnedh, 0);

            Function.Call((Hash)0x1913FE4CBF41C463, spawnedh, 211, true);
            Function.Call((Hash)0x1913FE4CBF41C463, spawnedh, 208, true);
            Function.Call((Hash)0x1913FE4CBF41C463, spawnedh, 209, true);
            Function.Call((Hash)0x1913FE4CBF41C463, spawnedh, 400, true);
            Function.Call((Hash)0x1913FE4CBF41C463, spawnedh, 297, true);
            Function.Call((Hash)0x1913FE4CBF41C463, spawnedh, 136, false);
            Function.Call((Hash)0x1913FE4CBF41C463, spawnedh, 312, false);
            Function.Call((Hash)0x1913FE4CBF41C463, spawnedh, 113, false);
            Function.Call((Hash)0x1913FE4CBF41C463, spawnedh, 301, false);
            Function.Call((Hash)0x1913FE4CBF41C463, spawnedh, 277, true);
            Function.Call((Hash)0x1913FE4CBF41C463, spawnedh, 319, true);
            Function.Call((Hash)0x1913FE4CBF41C463, spawnedh, 6, true);

            Function.Call((Hash)0x9FF1E042FA597187, spawnedh, 25, false);
            Function.Call((Hash)0x9FF1E042FA597187, spawnedh, 24, false);
            Function.Call((Hash)0x9FF1E042FA597187, spawnedh, 48, false);

            Function.Call((Hash)0xA691C10054275290, spawnedh, API.PlayerId(), 431);

            Function.Call((Hash)0x6734F0A6A52C371C, API.PlayerId(), 431);
            Function.Call((Hash)0x024EC9B649111915, spawnedh, 1);
            Function.Call((Hash)0xEB8886E1065654CD, spawnedh, 10, "ALL", 10f);

            API.SetModelAsNoLongerNeeded(hashHorse);


            if (def.status.ContainsKey("Health"))
            {
                if (def.status["Health"].ToObject <int>() >= 100)
                {
                    Function.Call((Hash)0xC6258F41D86676E0, spawnedh, 0, 100);
                    int lesshealth = def.status["Health"].ToObject <int>() - 100;
                    Function.Call((Hash)0xAC2767ED8BDFAB15, spawnedh, lesshealth, 0);
                }
                else
                {
                    Function.Call((Hash)0xC6258F41D86676E0, spawnedh, 0, def.status["Health"].ToObject <int>());
                }
            }

            if (def.status.ContainsKey("Stamina"))
            {
                Function.Call((Hash)0xC6258F41D86676E0, spawnedh, 1, def.status["Stamina"].ToObject <int>());
            }

            horsespawned = true;
        }