Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • Need help?

    Create a topic in the appropriate section
    Don't write everything in the chat!
  • Take a look at the marketplace

    There you can buy
    everything related to game servers
  • Don't want a ban?

    Please read our rules
    Don't disturb the order!
  • Sell or buy?

    Use services of the guarantor
    We will make your deal safe
  • 0
MEDIC36

Как задать в спавне определенное кол-во патрон в пачке

хочу прописать в стартовый лут у кепок 5 патриков, но все ровно персонаж спавнится с 20.

 

 

 override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
 {
            player.RemoveAllItems();
   
   EntityAI itemEnt;
      ItemBase itemBs;
   int rand7 = Math.RandomInt (1, 7);
   
   switch (rand7)
   {
    case 1:


            int rand;
  
   TStringArray randSuitJacket = {"Tshirt_OrangeWhiteStripes","Tshirt_RedBlackStripes","TelnyashkaShirt","Tshirt_Red","Tshirt_Beige","Tshirt_Black","Tshirt_Blue","Tshirt_Green"};
            player.GetInventory().CreateInInventory(randSuitJacket.GetRandomElement());
   TStringArray randBreeches = {"Breeches_blackcheck","Breeches_blue","Breeches_Beige","Breeches_Red","Breeches_Green","Breeches_Browncheck"};
            player.GetInventory().CreateInInventory(randBreeches.GetRandomElement());
      TStringArray randBoots = {"JoggingShoes_Violet","JoggingShoes_Black","JoggingShoes_Blue","JoggingShoes_Red","HikingBoots_Brown","HikingBoots_Black","Wellies_Green","Wellies_Black","Wellies_Grey","Wellies_Brown"};
            player.GetInventory().CreateInInventory(randBoots.GetRandomElement());

      player.GetInventory().CreateInInventory("Shovel");
   player.GetInventory().CreateInInventory("SawedoffIzh18");
   itemEnt = player.GetInventory().CreateInInventory("Ammo_762x39");
      itemBs = ItemBase.Cast(itemEnt);
      itemBs.SetQuantity(5);
      SetRandomHealth(itemEnt);
      player.GetInventory().CreateInInventory("BandageDressing");
   player.GetInventory().CreateInInventory("SodaCan_Kvass");
   player.GetInventory().CreateInInventory("SodaCan_Kvass");
   player.GetInventory().CreateInInventory("Marmalade");
   
       break;
    
    case 2:
    
                    player.GetInventory().CreateInInventory("DressShoes_Black");
           TStringArray randSuitJacket2 = {"TrackSuitJacket_Black","TrackSuitJacket_Blue","TrackSuitJacket_LightBlue"};
                    player.GetInventory().CreateInInventory(randSuitJacket2.GetRandomElement());
                    TStringArray randTrackSuitPants = {"TrackSuitPants_Black","TrackSuitPants_LightBlue","TrackSuitPants_Blue"};
                    player.GetInventory().CreateInInventory(randTrackSuitPants.GetRandomElement());
           player.GetInventory().CreateInInventory("FlatCap_Black");
           player.GetInventory().CreateInInventory("SawedoffIzh18");
           itemEnt = player.GetInventory().CreateInInventory("Ammo_762x39");
              itemBs = ItemBase.Cast(itemEnt);
              itemBs.SetQuantity(5);
              SetRandomHealth(itemEnt);
              player.GetInventory().CreateInInventory("BandageDressing");
           player.GetInventory().CreateInInventory("SodaCan_Kvass");
           player.GetInventory().CreateInInventory("SodaCan_Kvass");
           player.GetInventory().CreateInInventory("Marmalade");
     
       break;
    
    case 3:
    
     player.GetInventory().CreateInInventory("Ridersjacket_black");
     player.GetInventory().CreateInInventory("Jeans_blue");
     player.GetInventory().CreateInInventory("DirtBikeHelmet_black");
     player.GetInventory().CreateInInventory("OMNOGloves_Gray");
     itemEnt = player.GetInventory().CreateInInventory("MilitaryBoots_Redpunk");
     itemEnt.GetInventory().CreateInInventory("HuntingKnife");
     player.GetInventory().CreateInInventory("TackticalGoggles");
     player.GetInventory().CreateInInventory("SawedoffIzh18");
           itemEnt = player.GetInventory().CreateInInventory("Ammo_762x39");
              itemBs = ItemBase.Cast(itemEnt);
              itemBs.SetQuantity(5);
              SetRandomHealth(itemEnt);
              player.GetInventory().CreateInInventory("BandageDressing");
           player.GetInventory().CreateInInventory("SodaCan_Kvass");
           player.GetInventory().CreateInInventory("SodaCan_Kvass");
           player.GetInventory().CreateInInventory("Marmalade");
   
       break;
    
    case 4:
    
     player.GetInventory().CreateInInventory("PoliceBaton");
     player.GetInventory().CreateInInventory("PoliceJacket");
     player.GetInventory().CreateInInventory("PolicePants");
     player.GetInventory().CreateInInventory("PoliceCap");
     player.GetInventory().CreateInInventory("OMNOGloves_Gray");
     player.GetInventory().CreateInInventory("DressShoes_black");
     player.GetInventory().CreateInInventory("SawedoffIzh18");
           itemEnt = player.GetInventory().CreateInInventory("Ammo_762x39");
              itemBs = ItemBase.Cast(itemEnt);
              itemBs.SetQuantity(5);
              SetRandomHealth(itemEnt);
              player.GetInventory().CreateInInventory("BandageDressing");
           player.GetInventory().CreateInInventory("SodaCan_Kvass");
           player.GetInventory().CreateInInventory("SodaCan_Kvass");
           player.GetInventory().CreateInInventory("Marmalade");
   
       break;
    
    case 5:
    
     player.GetInventory().CreateInInventory("TTsKOJacket_camo");
     player.GetInventory().CreateInInventory("TTsKOBoots");
     player.GetInventory().CreateInInventory("TTsKOPants");
     player.GetInventory().CreateInInventory("TankerHelmet");
     player.GetInventory().CreateInInventory("Fieldshovel");
     player.GetInventory().CreateInInventory("SawedoffIzh18");
           itemEnt = player.GetInventory().CreateInInventory("Ammo_762x39");
              itemBs = ItemBase.Cast(itemEnt);
              itemBs.SetQuantity(5);
              SetRandomHealth(itemEnt);
              player.GetInventory().CreateInInventory("BandageDressing");
           player.GetInventory().CreateInInventory("SodaCan_Kvass");
           player.GetInventory().CreateInInventory("SodaCan_Kvass");
           player.GetInventory().CreateInInventory("Marmalade");
   
       break;
    
    case 6:
    
     player.GetInventory().CreateInInventory("FireFighterJacket_beige");
     player.GetInventory().CreateInInventory("FireFightersPants_beige");
     player.GetInventory().CreateInInventory("FireFightersHelmet_red");
     player.GetInventory().CreateInInventory("WorkingBoots_yellow");
     player.GetInventory().CreateInInventory("LeatherGloves_natural");
     player.GetInventory().CreateInInventory("FireFighterAxe");
     player.GetInventory().CreateInInventory("SawedoffIzh18");
           player.GetInventory().CreateInInventory("Ammo_762x39");
     itemEnt = player.GetInventory().CreateInInventory("Ammo_762x39");
              itemBs = ItemBase.Cast(itemEnt);
              itemBs.SetQuantity(5);
              SetRandomHealth(itemEnt);
              player.GetInventory().CreateInInventory("BandageDressing");
           player.GetInventory().CreateInInventory("SodaCan_Kvass");
           player.GetInventory().CreateInInventory("SodaCan_Kvass");
           player.GetInventory().CreateInInventory("Marmalade");
   
       break;
    
     case 7:
    
     player.GetInventory().CreateInInventory("FireFighterJacket_beige");
     player.GetInventory().CreateInInventory("FireFightersPants_beige");
     player.GetInventory().CreateInInventory("FireFightersHelmet_red");
     player.GetInventory().CreateInInventory("WorkingBoots_yellow");
     player.GetInventory().CreateInInventory("LeatherGloves_natural");
     player.GetInventory().CreateInInventory("FireFighterAxe");
     player.GetInventory().CreateInInventory("SawedoffIzh18");
           itemEnt = player.GetInventory().CreateInInventory("Ammo_762x39");
              itemBs = ItemBase.Cast(itemEnt);
              itemBs.SetQuantity(5);
              SetRandomHealth(itemEnt);
              player.GetInventory().CreateInInventory("BandageDressing");
           player.GetInventory().CreateInInventory("SodaCan_Kvass");
           player.GetInventory().CreateInInventory("SodaCan_Kvass");
           player.GetInventory().CreateInInventory("Marmalade");
   
       break;
   }

 }
};

 

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

MEDIC36 

itemEnt = player.GetInventory().CreateInInventory("Ammo_762x39");
              itemBs = ItemBase.Cast(itemEnt);
              itemBs.SetQuantity(5);

меняем на

itemEnt = player.GetInventory().CreateInInventory("Ammo_762x39");
Magazine mag_obj = Magazine.Cast(itemEnt);
mag_obj.ServerSetAmmoCount(5);

но не проверял
А вообще Ammo_762x39 - это случаем не пачка патронов запакованная?

Share this post


Link to post
Share on other sites







  • 0
8 часов назад, 123new сказал:

MEDIC36 


itemEnt = player.GetInventory().CreateInInventory("Ammo_762x39");
              itemBs = ItemBase.Cast(itemEnt);
              itemBs.SetQuantity(5);

меняем на


itemEnt = player.GetInventory().CreateInInventory("Ammo_762x39");
Magazine mag_obj = Magazine.Cast(itemEnt);
mag_obj.ServerSetAmmoCount(5);

но не проверял
А вообще Ammo_762x39 - это случаем не пачка патронов запакованная?

EURU710, 19.03 2019 17:22:14 
Can't compile mission init script'! 

$CurrentDir:mpmissions\dayzOffline.chernarusplus\init.c(200): Multiple declaration of variable 'itemMag' 

Runtime mode 
CLI params: port 2402 config D:\servers\gsp_1529\185.66.84.197-2402\serverDZ.cfg profiles D:\servers\gsp_1529\185.66.84.197-2402\SurvivalHost.ORG BEpath D:\servers\gsp_1529\185.66.84.197-2402\battleye dologs adminlog netlog freezecheck scrAllowFileWrite FilePatching scriptDebug=True mod mods\@WZPack

Share this post


Link to post
Share on other sites
  • 0

MEDIC36 так возьмите за привычку переменные разными именами называть. Ошибку "Multiple declaration of variable 'itemMag' " то переведите хоть для приличия

Share this post


Link to post
Share on other sites
  • 0

123new

Переменные надо объявлять в вверху скрипта, а не как моветоном позволено в сях - где угодно. Тогда и путаницы не будет.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site, you automaticly agree to our Guidelines and Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.