Ejemplo n.º 1
0
        private async Task onStore()
        {
            if (ShopsPeds.Count() == 0)
            {
                return;
            }

            int     pid     = API.PlayerPedId();
            Vector3 pCoords = API.GetEntityCoords(pid, true, true);

            for (int i = 0; i < GetConfig.Config["BarberShops"].Count(); i++)
            {
                float x      = float.Parse(GetConfig.Config["BarberShops"][i]["EnterShop"][0].ToString());
                float y      = float.Parse(GetConfig.Config["BarberShops"][i]["EnterShop"][1].ToString());
                float z      = float.Parse(GetConfig.Config["BarberShops"][i]["EnterShop"][2].ToString());
                float radius = float.Parse(GetConfig.Config["BarberShops"][i]["EnterShop"][3].ToString());

                if (API.GetDistanceBetweenCoords(pCoords.X, pCoords.Y, pCoords.Z, x, y, z, false) <= radius && !Function.Call <bool>((Hash)0x57AB4A3080F85143, API.PlayerPedId()))
                {
                    await DrawTxt(GetConfig.Langs["PressToOpen"], 0.5f, 0.9f, 0.7f, 0.7f, 255, 255, 255, 255, true, true);

                    if (API.IsControlJustPressed(2, 0xD9D0E1C0))
                    {
                        Function.Call((Hash)0x322BFDEA666E2B0E, API.PlayerPedId(), x, y, z, 2.0f, -1, 1, 1, 1, 1);
                        BarberMenu.GetMenu().OpenMenu();
                        TriggerEvent("vorp:setInstancePlayer", true);
                        barberID = i;
                        await Delay(1000);
                    }
                }
            }
        }
Ejemplo n.º 2
0
 internal static void LoadComps()
 {
     TriggerEvent("vorpcharacter:getPlayerComps", new Action <dynamic, dynamic>((skin, cloths) =>
     {
         if (API.IsPedMale(API.PlayerPedId()))
         {
             uint beard = ConvertValue(skin.Beard);
             int index  = SkinUtils.BEARD_MALE.IndexOf(beard);
             if (index != -1)
             {
                 BarberMenu.setIndex(0, index + 1);
                 lastBeard = beard;
             }
             uint hair  = ConvertValue(skin.Hair);
             int index2 = SkinUtils.HAIR_MALE.IndexOf(hair);
             if (index2 != -1)
             {
                 BarberMenu.setIndex(1, index2 + 1);
                 lastHair = hair;
             }
         }
         else
         {
             uint hair  = ConvertValue(skin.Hair);
             int index2 = SkinUtils.HAIR_FEMALE.IndexOf(hair);
             if (index2 != -1)
             {
                 BarberMenu.setIndex(1, index2 + 1);
                 lastHair = hair;
             }
         }
     }));
 }
Ejemplo n.º 3
0
        public static async Task InitShops()
        {
            await Delay(10000);

            foreach (var store in GetConfig.Config["BarberShops"])
            {
                string ped     = store["NPCModel"].ToString();
                uint   HashPed = (uint)API.GetHashKey(ped);
                await LoadModel(HashPed);

                int   blipIcon   = int.Parse(store["BlipIcon"].ToString());
                float x          = float.Parse(store["EnterShop"][0].ToString());
                float y          = float.Parse(store["EnterShop"][1].ToString());
                float z          = float.Parse(store["EnterShop"][2].ToString());
                float Pedx       = float.Parse(store["NPCShop"][0].ToString());
                float Pedy       = float.Parse(store["NPCShop"][1].ToString());
                float Pedz       = float.Parse(store["NPCShop"][2].ToString());
                float Pedheading = float.Parse(store["NPCShop"][3].ToString());

                int _blip = Function.Call <int>((Hash)0x554D9D53F696D002, 1664425300, x, y, z);
                Function.Call((Hash)0x74F74D3207ED525C, _blip, blipIcon, 1);
                Function.Call((Hash)0x9CB1A1623062F402, _blip, store["name"].ToString());
                ShopsBlips.Add(_blip);

                int _PedShop = API.CreatePed(HashPed, Pedx, Pedy, Pedz, Pedheading, false, true, true, true);
                Function.Call((Hash)0x283978A15512B2FE, _PedShop, true);
                ShopsPeds.Add(_PedShop);
                API.SetEntityNoCollisionEntity(API.PlayerPedId(), _PedShop, false);
                API.SetEntityCanBeDamaged(_PedShop, false);
                API.SetEntityInvincible(_PedShop, true);
                API.SetBlockingOfNonTemporaryEvents(_PedShop, true);
                await Delay(1000);

                API.FreezeEntityPosition(_PedShop, true);

                await Delay(100);
            }

            BarberMenu.GetMenu();
        }