HasterPaster

Add a players SteamID together with the Bohemia UID to the .ADM log file

Jun 8th, 2021
773
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void main()
  2. {
  3.     //INIT WEATHER BEFORE ECONOMY INIT------------------------
  4.     Weather weather = g_Game.GetWeather();
  5.  
  6.     weather.MissionWeather(false);    // false = use weather controller from Weather.c
  7.  
  8.     weather.GetOvercast().Set( Math.RandomFloatInclusive(0.4, 0.6), 1, 0);
  9.     weather.GetRain().Set( 0, 0, 1);
  10.     weather.GetFog().Set( Math.RandomFloatInclusive(0.05, 0.1), 1, 0);
  11.  
  12.     //INIT ECONOMY--------------------------------------
  13.     Hive ce = CreateHive();
  14.     if ( ce )
  15.         ce.InitOffline();
  16.  
  17.     //DATE RESET AFTER ECONOMY INIT-------------------------
  18.     int year, month, day, hour, minute;
  19.     int reset_month = 9, reset_day = 20;
  20.     GetGame().GetWorld().GetDate(year, month, day, hour, minute);
  21.  
  22.     if ((month == reset_month) && (day < reset_day))
  23.     {
  24.         GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
  25.     }
  26.     else
  27.     {
  28.         if ((month == reset_month + 1) && (day > reset_day))
  29.         {
  30.             GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
  31.         }
  32.         else
  33.         {
  34.             if ((month < reset_month) || (month > reset_month + 1))
  35.             {
  36.                 GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
  37.             }
  38.         }
  39.     }
  40. }
  41.  
  42.  
  43.  
  44. class CustomMission: MissionServer
  45. {
  46.     void SetRandomHealth(EntityAI itemEnt)
  47.     {
  48.         if ( itemEnt )
  49.         {
  50.             int rndHlt = Math.RandomInt(55,100);
  51.             itemEnt.SetHealth("","",rndHlt);
  52.         }
  53.     }
  54.  
  55.     override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
  56.     {
  57.         Entity playerEnt;
  58.         playerEnt = GetGame().CreatePlayer(identity, characterName, pos, 0, "NONE");//Creates random player
  59.         Class.CastTo(m_player, playerEnt);
  60.  
  61.         GetGame().SelectPlayer(identity, m_player);
  62.  
  63.         return m_player;
  64.     }
  65.  
  66.     override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
  67.     {
  68.         EntityAI itemTop;
  69.         EntityAI itemEnt;
  70.         ItemBase itemBs;
  71.         float rand;
  72.  
  73.         itemTop = player.FindAttachmentBySlotName("Body");
  74.  
  75.         if ( itemTop )
  76.         {
  77.             itemEnt = itemTop.GetInventory().CreateInInventory("Rag");
  78.             if ( Class.CastTo(itemBs, itemEnt ) )
  79.                 itemBs.SetQuantity(4);
  80.  
  81.             SetRandomHealth(itemEnt);
  82.  
  83.             string chemlightArray[] = { "Chemlight_White", "Chemlight_Yellow", "Chemlight_Green", "Chemlight_Red" };
  84.             int rndIndex = Math.RandomInt(0, 4);
  85.             itemEnt = itemTop.GetInventory().CreateInInventory(chemlightArray[rndIndex]);
  86.             SetRandomHealth(itemEnt);
  87.  
  88.             rand = Math.RandomFloatInclusive(0.0, 1.0);
  89.             if ( rand < 0.35 )
  90.                 itemEnt = player.GetInventory().CreateInInventory("Apple");
  91.             else if ( rand > 0.65 )
  92.                 itemEnt = player.GetInventory().CreateInInventory("Pear");
  93.             else
  94.                 itemEnt = player.GetInventory().CreateInInventory("Plum");
  95.  
  96.             SetRandomHealth(itemEnt);
  97.         }
  98.     }
  99.    
  100.    
  101.     // Get a players GUID's upon connection.
  102.     override void InvokeOnConnect(PlayerBase player, PlayerIdentity identity)
  103.     {
  104.         super.InvokeOnConnect(player, identity);
  105.        
  106.         // GetName() = Nickname, GetPlainId() = SteamID, GetId() = DayZ GUID
  107.         GetGame().AdminLog("PlayerGUID," + player.GetIdentity().GetName() + "," + player.GetIdentity().GetPlainId() + "," + player.GetIdentity().GetId());
  108.     }
  109.    
  110. };
  111.  
  112.  
  113.    
  114. Mission CreateCustomMission(string path)
  115. {
  116.     return new CustomMission();
  117. }
RAW Paste Data