Welche MODs hast Du auf Deinem Server?
Wenn die Expansion dabei ist, geht es nicht.
Code
//Spawn helper function
void SpawnObject( string type, vector position, vector orientation )
{
auto obj = GetGame().CreateObject( type, position );
obj.SetPosition( position );
obj.SetOrientation( orientation );
obj.SetOrientation( obj.GetOrientation() ); //Collision fix
obj.Update();
obj.SetAffectPathgraph( true, false );
if( obj.CanAffectPathgraph() ) GetGame().GetCallQueue( CALL_CATEGORY_SYSTEM ).CallLater( GetGame().UpdatePathgraphRegionByObject, 100, false, obj );
}
void main()
{
//INIT WEATHER BEFORE ECONOMY INIT------------------------
Weather weather = g_Game.GetWeather();
weather.GetOvercast().SetLimits( 0.0 , 0.0 );
weather.GetRain().SetLimits( 0.0 , 0.0 );
weather.GetFog().SetLimits( 0.0 , 0.0 );
weather.GetOvercast().SetForecastChangeLimits( 0.0, 0.0 );
weather.GetRain().SetForecastChangeLimits( 0.0, 0.0 );
weather.GetFog().SetForecastChangeLimits( 0.0, 0.0 );
weather.GetOvercast().Set( 0, 0, 0);
weather.GetRain().Set( 0, 0, 0);
weather.GetFog().Set( 0, 0, 0);
weather.SetWindMaximumSpeed(0);
weather.SetWindFunctionParams(0.0, 0.0, 0);
//Costum Spawn objects
SpawnObject("DC_BankingATM", "905.11 182.04 7659.3", "235 0 0"); //Baumarkt
SpawnObject("DC_BankingATM", "9546.63 84.324 13662.2", "235 0 0"); //Autohändler
SpawnObject("DC_BankingATM", "6072.82 53.017 3432.66", "235 0 0"); //Cherno
SpawnObject("DC_BankingATM", "12112.2 12.373 9766.16", "235 0 0"); //Berenzino
//INIT ECONOMY--------------------------------------
Hive ce = CreateHive();
if ( ce )
ce.InitOffline();
GetGame().GetWorld().SetDate(2020, 8, 10, 13, 00); //Set the ingame date and time
}
class CustomMission: MissionServer
{
void SetRandomHealth(EntityAI itemEnt)
{
if ( itemEnt )
{
float rndHlt = Math.RandomFloat( 55, 100 );
itemEnt.SetHealth01( "", "", rndHlt );
}
}
void addMags(PlayerBase player, string mag_type, int count)
{
EntityAI mag;
if (count < 1) return;
for (int i = 0; i < count; i++)
{
mag = player.GetInventory().CreateInInventory(mag_type);
}
}
override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
{
Entity playerEnt;
playerEnt = GetGame().CreatePlayer( identity, characterName, pos, 0, "NONE" );
Class.CastTo( m_player, playerEnt );
GetGame().SelectPlayer( identity, m_player );
return m_player;
}
override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
{
EntityAI itemEnt;
ItemBase itemBs;
//Entitys
EntityAI gun_m4a1;
EntityAI gun_fnx45;
EntityAI cloth_gorkaHelmet;
EntityAI cloth_militaryBoots;
//Get & Save Admin UIDs
const string admin_uid = "HO09jUa9-G5hxSerxxxxxxgVLddi3he3oP6ZHNg";
const string admin_uid2 = "cD7okYA_psk64wxxxxxxAuZXHKnEhktRaLwDwY_YY";
const string admin_uid3 = "ECTri4x38qMvG61xxxxxxxxDSOWLNzAbcUkONn4E";
const string admin_uid4 = "KmVKm4eDU6bP5dGxxxxxxxP6YFK2xT8h7h5q9AU";
const string admin_uid5 = "rKm1D8o-7rBlgxxxxxxDU2pC0MjDB-CyK6YziQo";
string player_uid = player.GetIdentity().GetPlainId();
//RemoveAllItems
player.RemoveAllItems();
//Check if admin or not and choose spawn type
if(player_uid == admin_uid || player_uid == admin_uid2 || player_uid == admin_uid3 || player_uid == admin_uid4 || player_uid == admin_uid5)
{
// ADMIN SPAWN
//Backpack
ItemBase.Cast(player.GetInventory().CreateInInventory("HuntingBag"));
//Clothing
cloth_gorkaHelmet = player.GetInventory().CreateInInventory("GorkaHelmet");
//cloth_gorkaHelmet.GetInventory().CreateAttachment("GorkaHelmetVisor"); //not working, don't know why
cloth_militaryBoots = player.GetInventory().CreateInInventory("MilitaryBoots_Black");
cloth_militaryBoots.GetInventory().CreateAttachment("CombatKnife"); //attach the knife to the boots
ItemBase.Cast(player.GetInventory().CreateInInventory("BalaclavaMask_Blackskull"));
ItemBase.Cast(player.GetInventory().CreateInInventory("TacticalGloves_Black"));
ItemBase.Cast(player.GetInventory().CreateInInventory("TTsKOJacket_Camo"));
ItemBase.Cast(player.GetInventory().CreateInInventory("TTSKOPants"));
ItemBase.Cast(player.GetInventory().CreateInInventory("Armband_White"));
//Primary Weapon
gun_m4a1 = player.GetHumanInventory().CreateInHands("M4A1"); //if not working you can try .GetEntityInHands()
//attach the following attachments to the gun
gun_m4a1.GetInventory().CreateAttachment("ACOGOptic");
gun_m4a1.GetInventory().CreateAttachment("M4_Suppressor");
gun_m4a1.GetInventory().CreateAttachment("M4_RISHndgrd_Black");
gun_m4a1.GetInventory().CreateAttachment("M4_OEBttstck_Black");
gun_m4a1.GetInventory().CreateAttachment("Light_Universal");
//gun_m4a1.GetInventory().CreateAttachment("Mag_STANAG_30Rnd"); BUGGY DONT USE
//addMags(player, "Mag_STANAG_30Rnd", 2); //addMags(player, "Mag_STANAGCoupled_30Rnd", 2);
// Secondary Weapon
gun_fnx45 = player.GetInventory().CreateInInventory("FNX45");
gun_fnx45.GetInventory().CreateAttachment("PistolSuppressor");
//gun_fnx45.GetInventory().CreateAttachment("Mag_FNX45_15Rnd"); BUGGY DONT USE
//Ammunition
ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_STANAG_30Rnd"));
ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_STANAG_30Rnd"));
ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_STANAG_30Rnd"));
ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd"));
ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd"));
ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd"));
//Food
ItemBase.Cast(player.GetInventory().CreateInInventory("SodaCan_Pipsi"));
ItemBase.Cast(player.GetInventory().CreateInInventory("SodaCan_Pipsi"));
ItemBase.Cast(player.GetInventory().CreateInInventory("SodaCan_Pipsi"));
ItemBase.Cast(player.GetInventory().CreateInInventory("SpaghettiCan"));
ItemBase.Cast(player.GetInventory().CreateInInventory("SpaghettiCan"));
ItemBase.Cast(player.GetInventory().CreateInInventory("SpaghettiCan"));
// Medical Supplies
ItemBase.Cast(player.GetInventory().CreateInInventory("Morphine"));
ItemBase.Cast(player.GetInventory().CreateInInventory("Rag")).SetQuantity(6);
// Utilities
ItemBase.Cast(player.GetInventory().CreateInInventory("CanOpener"));
ItemBase.Cast(player.GetInventory().CreateInInventory("Battery9V"));
ItemBase.Cast(player.GetInventory().CreateInInventory("Battery9V"));
ItemBase.Cast(player.GetInventory().CreateInInventory("Battery9V"));
ItemBase.Cast(player.GetInventory().CreateInInventory("SparkPlug"));
ItemBase.Cast(player.GetInventory().CreateInInventory("TetracyclineAntibiotics"));
//CreateQuickbar Shortcuts, 0 is the 1st place, 1 the 2nd etc.
player.SetQuickBarEntityShortcut(gun_m4a1, 0, true); //you can use without true, true is for forcing player.SetQuickBarEntityShortcut(gun_m4a1, 0);
player.SetQuickBarEntityShortcut(gun_fnx45, 1, true);
}
else
{
// DEFAULT SPAWN
//Backpack
ItemBase.Cast(player.GetInventory().CreateInInventory("HuntingBag"));
//Clothing
ItemBase.Cast(player.GetInventory().CreateInInventory("WorkingGloves_Beige"));
ItemBase.Cast(player.GetInventory().CreateInInventory("CargoPants_Beige"));
ItemBase.Cast(player.GetInventory().CreateInInventory("TacticalShirt_Tan"));
ItemBase.Cast(player.GetInventory().CreateInInventory("PlateCarrierComplete"));
ItemBase.Cast(player.GetInventory().CreateInInventory("HikingBootsLow_Beige"));
ItemBase.Cast(player.GetInventory().CreateInInventory("MilitaryBeretChDKZ"));
ItemBase.Cast(player.GetInventory().CreateInInventory("Armband_Red"));
//Primary Weapon
gun_fnx45 = player.GetHumanInventory().CreateInHands("FNX45");
gun_fnx45.GetInventory().CreateAttachment("PistolSuppressor");
//Ammunition
ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd"));
ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd"));
//Food
ItemBase.Cast(player.GetInventory().CreateInInventory("SodaCan_Pipsi"));
ItemBase.Cast(player.GetInventory().CreateInInventory("SodaCan_Pipsi"));
ItemBase.Cast(player.GetInventory().CreateInInventory("SodaCan_Pipsi"));
ItemBase.Cast(player.GetInventory().CreateInInventory("SpaghettiCan"));
ItemBase.Cast(player.GetInventory().CreateInInventory("SpaghettiCan"));
ItemBase.Cast(player.GetInventory().CreateInInventory("SpaghettiCan"));
// Medical Supplies
ItemBase.Cast(player.GetInventory().CreateInInventory("Morphine"));
ItemBase.Cast(player.GetInventory().CreateInInventory("Rag")).SetQuantity(6);
// Utilities
ItemBase.Cast(player.GetInventory().CreateInInventory("CanOpener"));
ItemBase.Cast(player.GetInventory().CreateInInventory("Flashlight"));
ItemBase.Cast(player.GetInventory().CreateInInventory("Battery9V"));
ItemBase.Cast(player.GetInventory().CreateInInventory("Battery9V"));
ItemBase.Cast(player.GetInventory().CreateInInventory("SparkPlug"));
ItemBase.Cast(player.GetInventory().CreateInInventory("TetracyclineAntibiotics"));
//CreateQuickbar Shortcuts
player.SetQuickBarEntityShortcut(gun_fnx45, 0, true);
}
}
};
Mission CreateCustomMission(string path)
{
return new CustomMission();
}
Alles anzeigen
Das ist meine init.c