#include "$CurrentDir:mpmissions\\dayzOffline.ChernarusPlus\\map\\nwaf.c" #include "$CurrentDir:mpmissions\\dayzOffline.ChernarusPlus\\map\\altar.c" #include "$CurrentDir:mpmissions\\dayzOffline.ChernarusPlus\\map\\balota.c" #include "$CurrentDir:mpmissions\\dayzOffline.ChernarusPlus\\map\\neaf.c" #include "$CurrentDir:mpmissions\\dayzOffline.ChernarusPlus\\map\\caves.c" #include "$CurrentDir:mpmissions\\dayzOffline.ChernarusPlus\\map\\prison.c" #include "$CurrentDir:mpmissions\\dayzOffline.ChernarusPlus\\map\\tisy.c" #include "$CurrentDir:mpmissions\\dayzOffline.ChernarusPlus\\map\\bunker.c" #include "$CurrentDir:mpmissions\\dayzOffline.ChernarusPlus\\map\\pavlovo.c" #include "$CurrentDir:mpmissions\\dayzOffline.ChernarusPlus\\map\\skalisty.c" #include "$CurrentDir:mpmissions\\dayzOffline.ChernarusPlus\\map\\dubrovka.c" #include "$CurrentDir:mpmissions\\dayzOffline.ChernarusPlus\\map\\traders.c" #include "$CurrentDir:mpmissions\\dayzOffline.ChernarusPlus\\map\\Medical.c" void RemoveGardenPlots() { vector CENTERPOS = "7500 0 7500"; float RADIUS = 10000.0; array<string> TYPES = {"GardenPlot","FenceKit","WatchtowerKit"}; Print("----------------START Remove TYPES START-------------------"); array<Object> objects = new array<Object>; GetGame().GetObjectsAtPosition("7500 0 7500", 10000, objects, null); foreach(Object obj: objects) { if ( TYPES.Find( obj.GetType() ) > -1 ) { Print("CleanUp: deleted type --> " + obj.GetType()); GetGame().ObjectDelete( obj ); } } Print("----------------DONE Remove TYPES DONE-------------------"); } //spawn helper function void SpawnObject( string type, vector position, vector orientation ) { auto obj = GetGame().CreateObject( type, position ); obj.SetPosition( position ); obj.SetOrientation( orientation ); //Force collision update vector roll = obj.GetOrientation(); roll [ 2 ] = roll [ 2 ] - 1; obj.SetOrientation( roll ); roll [ 2 ] = roll [ 2 ] + 1; obj.SetOrientation( roll ); } void main() { DarkM1(); DarkM2(); DarkM3(); DarkM4(); DarkM5(); DarkM6(); DarkM7(); DarkM8(); DarkM9(); DarkM10(); DarkM11(); DarkM12(); DarkM13(); //INIT WEATHER BEFORE ECONOMY INIT------------------------ Weather weather = g_Game.GetWeather(); weather.MissionWeather(false); // false = use weather controller from Weather.c weather.GetOvercast().SetLimits( 0.0 , 0.05 ); weather.GetRain().SetLimits( 0.0, 0.0 ); weather.GetFog().SetLimits( 0.0, 0.01 ); weather.GetOvercast().SetForecastChangeLimits( 0.0, 0.5 ); weather.GetRain().SetForecastChangeLimits( 0.0, 0.06 ); weather.GetFog().SetForecastChangeLimits( 0.10, 0.30 ); weather.GetOvercast().SetForecastTimeLimits( 600 , 600 ); weather.GetRain().SetForecastTimeLimits( 600 , 600 ); weather.GetFog().SetForecastTimeLimits( 600 , 600 ); weather.GetOvercast().Set(Math.RandomFloatInclusive(0.00, 0.1), 0, 0); weather.GetRain().Set(Math.RandomFloatInclusive(0.0, 0.1), 0, 0); weather.GetFog().Set(Math.RandomFloatInclusive(0, 0.01), 0, 0); weather.SetWindMaximumSpeed(0.0); weather.SetWindFunctionParams(0.0, 0.0, 0); //weather.GetOvercast().SetLimits(0.0, 0.0); //weather.GetOvercast().SetForecastChangeLimits(0.0, 0.0); //weather.GetOvercast().SetForecastTimeLimits(0, 0); //weather.GetOvercast().Set(Math.RandomFloatInclusive(0.0, 0.0), 0, 0); //weather.GetFog().SetLimits(0.0, 0.0); //weather.GetFog().SetForecastChangeLimits(0.0, 0.0); //weather.GetFog().SetForecastTimeLimits(0, 0); //weather.GetFog().Set(Math.RandomFloatInclusive(0.0, 0.0), 0, 0); //weather.GetRain().SetLimits(0.0, 0.0); //weather.GetRain().SetForecastChangeLimits(0.0, 0.0); //weather.GetRain().SetForecastTimeLimits(0, 0); //weather.GetRain().Set(Math.RandomFloatInclusive(0.0, 0.0), 0, 0); //INIT ECONOMY-------------------------------------- Hive ce = CreateHive(); if ( ce ) ce.InitOffline(); //GetCEApi().ExportProxyData( "9000 0 9000", 15000 ); //GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(RemoveGardenPlots, 10000, false); // Get the event manager EventManager event_manager = GetDayZGame().GetEventManager(); // register the Bounty Event to run event_manager.RegisterEvent(BountyEvent); // this is the minimum and maximum time between each event (in seconds) // by default min: 10min, max: 30min event_manager.Run(600, 1800); //DATE RESET AFTER ECONOMY INIT------------------------- int year, month, day, hour, minute; int reset_month = 9, reset_day = 20; GetGame().GetWorld().GetDate(year, month, day, hour, minute); if ((month == reset_month) && (day < reset_day)) { GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute); } else { if ((month == reset_month + 1) && (day > reset_day)) { GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute); } else { if ((month < reset_month) || (month > reset_month + 1)) { GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute); } } } } class CustomMission: MissionServer { // ------------------------------------------------------------ // SetRandomHealth // ------------------------------------------------------------ void SetRandomHealth(EntityAI itemEnt) { if ( itemEnt ) { float rndHlt = Math.RandomFloat( 0.95, 1.00 ); itemEnt.SetHealth01( "", "", rndHlt ); } } // ------------------------------------------------------------ // Override StartingEquipSetup // ------------------------------------------------------------ void addMags(PlayerBase player, string mag_type, int count) { if (count < 1) return; EntityAI mag; for (int i = 0; i < count; i++) { mag = player.GetInventory().CreateInInventory(mag_type); } player.SetQuickBarEntityShortcut(mag, 2, true); } override void StartingEquipSetup(PlayerBase player, bool clothesChosen) { player.RemoveAllItems(); /* UNNECESSARY EntityAI item = player.GetInventory().CreateInInventory(topsArray.GetRandomElement()); EntityAI item2 = player.GetInventory().CreateInInventory(pantsArray.GetRandomElement()); EntityAI item3 = player.GetInventory().CreateInInventory(shoesArray.GetRandomElement()); */ EntityAI itemEnt; ItemBase itemBs; { player.GetStatWater().Add(4400); player.GetStatEnergy().Add(4400); // DEFAULT SPAWN /* Backpack Spawn */ //player.GetInventory().CreateInInventory("HuntingBag"); /* Medical Supplies */ //player.GetInventory().CreateInInventory("BandageDressing"); //EntityAI rags = player.GetInventory().CreateInInventory("Rag"); //ItemBase.Cast(rags).SetQuantity(4); /* Clothing */ player.GetInventory().CreateInInventory("OMNOGloves_Gray"); player.GetInventory().CreateInInventory("HunterPants_DD"); player.GetInventory().CreateInInventory("TacticalShirt_DD"); //player.GetInventory().CreateInInventory("PlateCarrierComplete"); player.GetInventory().CreateInInventory("JungleBoots_Black"); //player.GetInventory().CreateInInventory("MilitaryBeretChDKZ"); /* knife */ player.GetInventory().CreateInInventory("HuntingKnife"); /* Food Supplies */ player.GetInventory().CreateInInventory("BandageDressing"); player.GetInventory().CreateInInventory("SodaCan_Pipsi"); player.GetInventory().CreateInInventory("SodaCan_Pipsi"); player.GetInventory().CreateInInventory("SodaCan_Pipsi"); player.GetInventory().CreateInInventory("SpaghettiCan"); player.GetInventory().CreateInInventory("SpaghettiCan"); player.GetInventory().CreateInInventory("SpaghettiCan"); player.GetInventory().CreateInInventory("BandageDressing"); /* Utilities */ //player.GetInventory().CreateInInventory("CanOpener"); //player.GetInventory().CreateInInventory("M68Optic"); //player.GetInventory().CreateInInventory("PersonalRadio"); player.GetInventory().CreateInInventory("Battery9V"); //player.GetInventory().CreateInInventory("Battery9V"); //player.GetInventory().CreateInInventory("TetracyclineAntibiotics"); /* Handgun and Ammunication */ //player.GetInventory().CreateInInventory("FNX45"); // player.GetInventory().CreateInInventory("PistolSuppressor"); // addMags(player, "Mag_FNX45_15Rnd", 3); }; } }; Mission CreateCustomMission(string path) { return new CustomMission(); }
Write, Run & Share Javascript code online using OneCompiler's JS online compiler for free. It's one of the robust, feature-rich online compilers for Javascript language. Getting started with the OneCompiler's Javascript editor is easy and fast. The editor shows sample boilerplate code when you choose language as Javascript and start coding.
Javascript(JS) is a object-oriented programming language which adhere to ECMA Script Standards. Javascript is required to design the behaviour of the web pages.
var readline = require('readline');
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
terminal: false
});
rl.on('line', function(line){
console.log("Hello, " + line);
});
Keyword | Description | Scope |
---|---|---|
var | Var is used to declare variables(old way of declaring variables) | Function or global scope |
let | let is also used to declare variables(new way) | Global or block Scope |
const | const is used to declare const values. Once the value is assigned, it can not be modified | Global or block Scope |
let greetings = `Hello ${name}`
const msg = `
hello
world!
`
An array is a collection of items or values.
let arrayName = [value1, value2,..etc];
// or
let arrayName = new Array("value1","value2",..etc);
let mobiles = ["iPhone", "Samsung", "Pixel"];
// accessing an array
console.log(mobiles[0]);
// changing an array element
mobiles[3] = "Nokia";
Arrow Functions helps developers to write code in concise way, it’s introduced in ES6.
Arrow functions can be written in multiple ways. Below are couple of ways to use arrow function but it can be written in many other ways as well.
() => expression
const numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
const squaresOfEvenNumbers = numbers.filter(ele => ele % 2 == 0)
.map(ele => ele ** 2);
console.log(squaresOfEvenNumbers);
let [firstName, lastName] = ['Foo', 'Bar']
let {firstName, lastName} = {
firstName: 'Foo',
lastName: 'Bar'
}
const {
title,
firstName,
lastName,
...rest
} = record;
//Object spread
const post = {
...options,
type: "new"
}
//array spread
const users = [
...adminUsers,
...normalUsers
]
function greetings({ name = 'Foo' } = {}) { //Defaulting name to Foo
console.log(`Hello ${name}!`);
}
greet() // Hello Foo
greet({ name: 'Bar' }) // Hi Bar
IF is used to execute a block of code based on a condition.
if(condition){
// code
}
Else part is used to execute the block of code when the condition fails.
if(condition){
// code
} else {
// code
}
Switch is used to replace nested If-Else statements.
switch(condition){
case 'value1' :
//code
[break;]
case 'value2' :
//code
[break;]
.......
default :
//code
[break;]
}
For loop is used to iterate a set of statements based on a condition.
for(Initialization; Condition; Increment/decrement){
//code
}
While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.
while (condition) {
// code
}
Do-while is also used to iterate a set of statements based on a condition. It is mostly used when you need to execute the statements atleast once.
do {
// code
} while (condition);
ES6 introduced classes along with OOPS concepts in JS. Class is similar to a function which you can think like kind of template which will get called when ever you initialize class.
class className {
constructor() { ... } //Mandatory Class method
method1() { ... }
method2() { ... }
...
}
class Mobile {
constructor(model) {
this.name = model;
}
}
mbl = new Mobile("iPhone");