Jump to content
Sign in to follow this  
Mostabdel

Need Help With Scripts

Recommended Posts

i make this in init.c

//keep the goddamn init clean you FUCKS!
#include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\ScriptedMods\\DayZSurvival.c"
Mission CreateCustomMission(string path)
{
    return new DayZSurvival();
}

void main()
{
    Weather weather = g_Game.GetWeather();

    weather.GetOvercast().SetLimits( 0.0 , 1.0 );
    weather.GetRain().SetLimits( 0.0 , 1.0 );
    weather.GetFog().SetLimits( 0.0 , 0.25 );

    weather.GetOvercast().SetForecastChangeLimits( 0.0, 0.2 );
    weather.GetRain().SetForecastChangeLimits( 0.0, 0.1 );
    weather.GetFog().SetForecastChangeLimits( 0.15, 0.45 );

    weather.GetOvercast().SetForecastTimeLimits( 1800 , 1800 );
    weather.GetRain().SetForecastTimeLimits( 600 , 600 );
    weather.GetFog().SetForecastTimeLimits( 1800 , 1800 );

    weather.GetOvercast().Set( Math.RandomFloatInclusive(0.0, 0.3), 0, 0);
    weather.GetRain().Set( Math.RandomFloatInclusive(0.0, 0.2), 0, 0);
    weather.GetFog().Set( Math.RandomFloatInclusive(0.0, 0.1), 0, 0);
    
    weather.SetWindMaximumSpeed(15);
    weather.SetWindFunctionParams(0.1, 0.3, 50);
}

and this in DayZSurvival.c 

class DayZSurvival : MissionServer
{
    // Called within class as extentions NOT class mainscope DO NOT DEFINE CLASS IN FILE! 
    #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\ScriptedMods\\BuildingSpawner.c"
    #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\ScriptedMods\\MOTDMessages.c" //Custom MOTD fucns
    #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\ScriptedMods\\SafeZoneFunctions.c" //Safe zone script
    #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\ScriptedMods\\AdminTool\\AdminTool.c" //Adds other voids to class (so this .c file stays a little more clean)
    #include "$CurrentDir:\\mpmissions\\dayzOffline.ChernarusPlus\\plugins\\AirDrop.c"

    string SelectedPos;
    string m_LoadoutsPath = "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\ScriptedMods\\LoadOuts\\";
    string m_AdminListPath = "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\ScriptedMods\\";

    ref TStringArray LoadoutCatagories = {"Bags","Gloves","Vests","Tops","Pants","Boots","HeadGear"}; //Add any new catagories here, make sure the name matches everywhere used including file

    ref TStringArray Bags = {};
    ref TStringArray Gloves = {};
    ref TStringArray Vests = {};
    ref TStringArray Tops = {};
    ref TStringArray Pants = {};
    ref TStringArray Boots = {};
    ref TStringArray HeadGear = {};

    ref map<string,string>    PoweredOptics = new map<string,string>; //Type of optics, type of battery
    bool m_VanillaLoadouts;
    bool m_SpawnArmed;
    bool m_StaminaStatus;
    bool m_SafeZone;
    bool m_CustomBuildings;
    float m_LogInTimerLength;

    override void OnPreloadEvent(PlayerIdentity identity, out bool useDB, out vector pos, out float yaw, out int queueTime)
    {
        if (GetHive())
        {
            // Preload data on client by character from database
            useDB = true;
            queueTime = m_LogInTimerLength;
        }
        else
        {
            // Preload data on client without database
            useDB = false;
            pos = "1189.3 0.0 5392.48";
            yaw = 0;
            queueTime = 5;
        }
    }

    override void TickScheduler(float timeslice)
    {
        GetGame().GetWorld().GetPlayerList(m_Players);
        if( m_Players.Count() == 0 ) return;
        for(int i = 0; i < SCHEDULER_PLAYERS_PER_TICK; i++)
        {
            if(m_currentPlayer >= m_Players.Count() )
            {
                m_currentPlayer = 0;
            }

            PlayerBase currentPlayer = PlayerBase.Cast(m_Players.Get(m_currentPlayer));
            if (m_StaminaStatus) { currentPlayer.GetStatStamina().Set(1000); }
            if (m_SafeZone) { SafeZoneHandle(currentPlayer); } //Check if player is near safezone
            currentPlayer.OnTick();
            m_currentPlayer++;
        }
    }

    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;
    }

    void ConstructLoadouts(bool update)
    {
        if (update) {
            Bags.Clear();
            Gloves.Clear();
            Vests.Clear();
            Tops.Clear();
            Pants.Clear();
            Boots.Clear();
            HeadGear.Clear();
        }

        for ( int i = 0; i < LoadoutCatagories.Count(); ++i )
        {
            string currentCatagory = LoadoutCatagories.Get(i);
            string checkEmpty;
            FileHandle currentFile = OpenFile(m_LoadoutsPath + currentCatagory + ".txt", FileMode.READ);
            if (currentFile != 0)
            {
                FGets(currentFile,checkEmpty);
                if (checkEmpty != "")
                {
                    string line_content = "";
                    while ( FGets(currentFile,line_content) > 0 )
                    {
                        switch(currentCatagory)
                        {
                            case "Bags":
                            Bags.Insert(line_content);
                            break;

                            case "Gloves":
                            Gloves.Insert(line_content);
                            break;

                            case "Vests":
                            Vests.Insert(line_content);
                            break;

                            case "Tops":
                            Tops.Insert(line_content);
                            break;

                            case "Pants":
                            Pants.Insert(line_content);
                            break;

                            case "Boots":
                            Boots.Insert(line_content);
                            break;

                            case "HeadGear":
                            HeadGear.Insert(line_content);
                            break;
                        }
                    }
                }
                CloseFile(currentFile);
            }
        }
    }

    override void OnInit()
    {
        Hive ce = CreateHive();
        if (ce)
        ce.InitOffline();
        //---------------
        #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\ModSettings.c" //Read mod settings
        //-----Add Admins from txt-----
        FileHandle AdminUIDSFile = OpenFile(m_AdminListPath + "Admins.txt", FileMode.READ);
        if (AdminUIDSFile != 0)
        {
            string line_content = "";
            while ( FGets(AdminUIDSFile,line_content) > 0 )
            {
                m_AdminList.Insert(line_content,"null"); //UID , NAME
                Print("Adding Admin: "+ line_content + " To the Admin List!");
            }
            CloseFile(AdminUIDSFile);
        }

        //-----------
        GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(this.PlayerCounter, 110000, true);  //Default 120000 2 mins Looped
        GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(this.CustomMOTD, TIME_INTERVAL, true);  //Default 120000 2 mins Looped
        //----------------------------------
        AdminTool(); //Call for admin tool scripts
        if (m_CustomBuildings) { BuildingSpawner(); } //Spawn for custom buildings
        ConstructLoadouts(false); //Read and construct loadouts Array from files.
        //----------------------------------

        //-----------------------------
        PoweredOptics.Insert("m4_carryhandleoptic","");
        PoweredOptics.Insert("buisoptic","");
        PoweredOptics.Insert("M68Optic","Battery9V");
        PoweredOptics.Insert("m4_t3nrdsoptic","Battery9V");
        PoweredOptics.Insert("fnp45_mrdsoptic","Battery9V");
        PoweredOptics.Insert("crossbow_redpointoptic","Battery9V");
        PoweredOptics.Insert("reflexoptic","Battery9V");
        PoweredOptics.Insert("acogoptic","");
        PoweredOptics.Insert("puscopeoptic","");
        PoweredOptics.Insert("kashtanoptic","");
        PoweredOptics.Insert("huntingoptic","");
        PoweredOptics.Insert("pistoloptic","");
        PoweredOptics.Insert("pso1optic","");
        PoweredOptics.Insert("pso11optic","Battery9V");
        PoweredOptics.Insert("grozaoptic","");
        PoweredOptics.Insert("kobraoptic","Battery9V");
        //-----------------------------
    }

    void GlobalMessage(int Channel, string Message)
    {
        if (Message != "")
        {
            GetGame().ChatPlayer(Channel,Message);
        }
    }

    void PlayerCounter()
    {
        array<Man> players = new array<Man>;
        GetGame().GetPlayers( players );
        int numbOfplayers = players.Count();
        GlobalMessage(3,"Online Players: "+ numbOfplayers.ToString());
    }
    
    void SpawnGunIn(PlayerBase player, string item = "", bool isMainGun = true, TStringArray attachments = NULL, TStringArray Extras = NULL)
    {
        ItemBase itemAI;

        EntityAI myAttachmentAI;
        ItemBase myAttachmentIB;

        EntityAI ExtraEntity;
        ItemBase magEntity;

        if (isMainGun)
        {
            if ( item != "" ) 
            {
                itemAI = player.GetHumanInventory().CreateInHands( item );
                Weapon_Base wpn = Weapon_Base.Cast(itemAI);

                player.SetQuickBarEntityShortcut(itemAI, 2, true); //Puts gun on hotkey 3

                if ( attachments != NULL && attachments.Count() > 0 )
                {
                    
                    for (int i = 0; i < attachments.Count(); ++i)
                    {
                        myAttachmentAI = itemAI.GetInventory().CreateInInventory( attachments.Get(i) );

                        if (PoweredOptics.Contains(attachments.Get(i)))
                        {
                            myAttachmentAI.GetInventory().CreateInInventory( "Battery9V" );
                        }
                    }
                }
                
                if ( Extras != NULL && Extras.Count() > 0 )
                {
                    for (int ii = 0; ii < Extras.Count(); ++ii)
                    {
                        if (GetGame().IsKindOf( Extras.Get(ii), "Magazine_Base") && ! (GetGame().IsKindOf( Extras.Get(ii), "Ammunition_Base")) )
                        {
                            magEntity = player.GetHumanInventory().CreateInInventory(Extras.Get(ii));
                            Magazine mag = Magazine.Cast(magEntity);
                            player.GetWeaponManager().AttachMagazine(mag);
                            ExtraEntity = player.GetInventory().CreateInInventory( Extras.Get(ii) );
                            player.SetQuickBarEntityShortcut(ExtraEntity, 0, true);  //Puts main weapons mag on hotkey 1
                        }
                        else
                        {
                            ExtraEntity = player.GetInventory().CreateInInventory( Extras.Get(ii) );
                        }
                    }
                }
            
            }
        }
        else
        {
            //For Pistols/Secondary that spawn in inevntory
            if ( item != "" ) 
            {
                itemAI = player.GetHumanInventory().CreateInInventory( item );

                player.SetQuickBarEntityShortcut(itemAI, 3, true);  //Puts the Secondary weapon on hotkey 4
            
                if ( attachments != NULL && attachments.Count() > 0 )
                {
                    myAttachmentAI;
                    myAttachmentIB;
                    
                    for (int iz = 0; iz < attachments.Count(); ++iz)
                    {
                        myAttachmentIB = itemAI.GetInventory().CreateAttachment( attachments.Get(iz) );
                        if (PoweredOptics.Contains(attachments.Get(iz)))
                        {
                            myAttachmentIB.GetInventory().CreateInInventory( "Battery9V" );
                        }
                    }
                }
                
                if ( Extras != NULL && Extras.Count() > 0 )
                {
                    for (int ip = 0; ip < Extras.Count(); ++ip)
                    {
                        if (GetGame().IsKindOf( Extras.Get(ip), "Magazine_Base") && ! (GetGame().IsKindOf( Extras.Get(ip), "Ammunition_Base")) )
                        {
                            ExtraEntity = player.GetInventory().CreateInInventory( Extras.Get(ip) );
                            player.SetQuickBarEntityShortcut(ExtraEntity, 1, true);   //Puts the mag for the secondary on hotkey 2
                        }
                        else
                        {
                            ExtraEntity = player.GetInventory().CreateInInventory( Extras.Get(ip) );
                        }
                    }
                }
            
            }
        }
        
    } 

    override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
    {
        EntityAI EntityRifle;
        ItemBase itemRifle;
            
        EntityAI EntityPistol;
        ItemBase itemPistol;

        ItemBase itemBs;
        EntityAI itemEnt;
        
        if (m_VanillaLoadouts)
        {
            itemEnt = player.GetInventory().CreateInInventory( "Rag" );
            itemBs = ItemBase.Cast(itemEnt);                            
            itemBs.SetQuantity(6);
        }
        else
        {
            player.RemoveAllItems();
            //Edit loadouts Via the LOADOUTS folder in ScriptedMods folder!
            //If you wish for an item from a specific catagory to not be spawned just hash out this part:: player.GetInventory().CreateInInventory( Bags.GetRandomElement() );
            
            if (Bags.Count() > 0) { player.GetInventory().CreateInInventory( Bags.GetRandomElement() );  }
            if (Gloves.Count() > 0) { player.GetInventory().CreateInInventory( Gloves.GetRandomElement() ); }
            if (Vests.Count() > 0) { player.GetInventory().CreateInInventory( Vests.GetRandomElement() ); }
            if (Tops.Count() > 0) { player.GetInventory().CreateInInventory( Tops.GetRandomElement() ); }
            if (Pants.Count() > 0) { player.GetInventory().CreateInInventory( Pants.GetRandomElement() ); }
            if (Boots.Count() > 0) { player.GetInventory().CreateInInventory( Boots.GetRandomElement() ); }
            if (HeadGear.Count() > 0) { player.GetInventory().CreateInInventory( HeadGear.GetRandomElement() ); }

            player.GetInventory().CreateInInventory( "Battery9V" );
            
            itemEnt = player.GetInventory().CreateInInventory( "Rag" );
            itemBs = ItemBase.Cast(itemEnt);                            
            itemBs.SetQuantity(6);

            player.SetQuickBarEntityShortcut(itemBs, 0, true);
           }
            
          if (m_SpawnArmed)
          {
                //Gun spawner Handle
                //SpawnGunIn( PlayerBase player, string ClassName, bool isPrimary, TstringArray Attachments, TstringArray Extras) NOTE: Set bool to 'true' IF weapon was primary
                int oRandValue = Math.RandomIntInclusive(0,2);
                switch(oRandValue.ToString())
                {
                    case "0":
                    SpawnGunIn( player , "fnx45", true, {"fnp45_mrdsoptic","PistolSuppressor"},{"mag_fnx45_15rnd","mag_fnx45_15rnd","ammo_45acp","ammo_45acp"} );
                    break;

                    case "1":
                    SpawnGunIn( player , "CZ75", true, {"PistolSuppressor"} , {"Mag_CZ75_15Rnd","Mag_CZ75_15Rnd","ammo_9x19","ammo_9x19"} );
                    break;

                    case "2":
                    SpawnGunIn( player , "makarovij70", true, {"PistolSuppressor"} , {"mag_ij70_8rnd","mag_ij70_8rnd","ammo_380","ammo_380"} );
                    break;
                }
          }
    }
};

            ref AirDrop AirDropClass; // Class definition

void CustomMission()
{
    AirDropClass = new AirDrop;        
}

float TimerSlice; // Timeslice
override void OnUpdate( float timeslice )
{
    super.OnUpdate( timeslice );

    // FPS Fix
    TimerSlice += timeslice;
    if (TimerSlice >= AirDropClass.TimesliceMultiplyier)
    {
        AirDropClass.CreateAirDrop();
        TimerSlice = 0;    
    }
}
};
 Mission CreateCustomMission(string path)
{
    return new CustomMission();
}

void OnClientRespawnEvent(PlayerIdentity identity, PlayerBase player)
    {
        // note: player is now killed in db right after the actual kill happens
        /*if (GetHive() && player)
        {
            GetHive().CharacterKill(player);
        }*/
        if(player)
        {
            if (player.IsUnconscious() || player.IsRestrained())
            {
                // kill character
                player.SetHealth("", "", 0.0);
            }
            GetGame().ObjectDelete( player );
        }
    }    

and i like to add this. where i can make it ?

}
     override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
    {
/*
        player.RemoveAllItems();

        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;
        
        itemEnt = player.GetInventory().CreateInInventory("Rag");
        itemBs = ItemBase.Cast(itemEnt);
        itemBs.SetQuantity(6);

        itemEnt = player.GetInventory().CreateInInventory("HuntingKnife");
        itemBs = ItemBase.Cast(itemEnt);
        
        itemEnt = player.GetInventory().CreateInInventory("SodaCan_Cola");
        itemBs = ItemBase.Cast(itemEnt);
        
        itemEnt = player.GetInventory().CreateInInventory("PeachesCan");
        itemBs = ItemBase.Cast(itemEnt);
    }

help me pls. thx !!!

 

Share this post


Link to post
Share on other sites

For in the future, wrap the code parts with the [ code ] [ /code ] tags or click on the <> icon in the editor. Makes it easier to understand and read.

What you need to do is the following, remove:

override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
    {
        EntityAI EntityRifle;
        ItemBase itemRifle;
            
        EntityAI EntityPistol;
        ItemBase itemPistol;

        ItemBase itemBs;
        EntityAI itemEnt;
        
        if (m_VanillaLoadouts)
        {
            itemEnt = player.GetInventory().CreateInInventory( "Rag" );
            itemBs = ItemBase.Cast(itemEnt);                            
            itemBs.SetQuantity(6);
        }
        else
        {
            player.RemoveAllItems();
            //Edit loadouts Via the LOADOUTS folder in ScriptedMods folder!
            //If you wish for an item from a specific catagory to not be spawned just hash out this part:: player.GetInventory().CreateInInventory( Bags.GetRandomElement() );
            
            if (Bags.Count() > 0) { player.GetInventory().CreateInInventory( Bags.GetRandomElement() );  }
            if (Gloves.Count() > 0) { player.GetInventory().CreateInInventory( Gloves.GetRandomElement() ); }
            if (Vests.Count() > 0) { player.GetInventory().CreateInInventory( Vests.GetRandomElement() ); }
            if (Tops.Count() > 0) { player.GetInventory().CreateInInventory( Tops.GetRandomElement() ); }
            if (Pants.Count() > 0) { player.GetInventory().CreateInInventory( Pants.GetRandomElement() ); }
            if (Boots.Count() > 0) { player.GetInventory().CreateInInventory( Boots.GetRandomElement() ); }
            if (HeadGear.Count() > 0) { player.GetInventory().CreateInInventory( HeadGear.GetRandomElement() ); }

            player.GetInventory().CreateInInventory( "Battery9V" );
            
            itemEnt = player.GetInventory().CreateInInventory( "Rag" );
            itemBs = ItemBase.Cast(itemEnt);                            
            itemBs.SetQuantity(6);

            player.SetQuickBarEntityShortcut(itemBs, 0, true);
           }
            
          if (m_SpawnArmed)
          {
                //Gun spawner Handle
                //SpawnGunIn( PlayerBase player, string ClassName, bool isPrimary, TstringArray Attachments, TstringArray Extras) NOTE: Set bool to 'true' IF weapon was primary
                int oRandValue = Math.RandomIntInclusive(0,2);
                switch(oRandValue.ToString())
                {
                    case "0":
                    SpawnGunIn( player , "fnx45", true, {"fnp45_mrdsoptic","PistolSuppressor"},{"mag_fnx45_15rnd","mag_fnx45_15rnd","ammo_45acp","ammo_45acp"} );
                    break;

                    case "1":
                    SpawnGunIn( player , "CZ75", true, {"PistolSuppressor"} , {"Mag_CZ75_15Rnd","Mag_CZ75_15Rnd","ammo_9x19","ammo_9x19"} );
                    break;

                    case "2":
                    SpawnGunIn( player , "makarovij70", true, {"PistolSuppressor"} , {"mag_ij70_8rnd","mag_ij70_8rnd","ammo_380","ammo_380"} );
                    break;
                }
          }
    }

And replace it with:

override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
    {
/*
        player.RemoveAllItems();

        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;
        
        itemEnt = player.GetInventory().CreateInInventory("Rag");
        itemBs = ItemBase.Cast(itemEnt);
        itemBs.SetQuantity(6);

        itemEnt = player.GetInventory().CreateInInventory("HuntingKnife");
        itemBs = ItemBase.Cast(itemEnt);
        
        itemEnt = player.GetInventory().CreateInInventory("SodaCan_Cola");
        itemBs = ItemBase.Cast(itemEnt);
        
        itemEnt = player.GetInventory().CreateInInventory("PeachesCan");
        itemBs = ItemBase.Cast(itemEnt);
    } 

By the way, if you're going to keep those lines commented out, I would just remove them. Same goes for the unused boolean clothesChosen.

In fact, the whole script gives me the itches.

Share this post


Link to post
Share on other sites

and for the all script its ok or there are problemes ?

Share this post


Link to post
Share on other sites

I'm not sure, haven't checked everything to be honest. Only the parts which you had trouble with. Did you try to run them?

Share this post


Link to post
Share on other sites

oui je bac mais erreur avec airdrop ligne

this is the script of aidrop

 

class AirDrop
{
    /* ### ### ### ### ### ### ### ### */
    /* DayZ 0.63 AirDrop plugin by mov3ax / mov3ax.pro */
    /* ### ### ### ### ### ### ### ### */    

    void AirDrop()
    {
    }

    void ~AirDrop()
    {
    }

    /* ### ### ### ### ### ### ### ### */
    /* Configuration of plugin */
    /* ### ### ### ### ### ### ### ### */

    bool EnableAirdrops = true; // Main switch
    float TimesliceMultiplyier = 0.01; // Timeslice multiplyier, default value is 0.01 (60 FPS)
    float AirPlaneSpeed = 0.25; // Airplane fly speed 
    float AirPlaneHeight = 300; // Airplane fly height 
    float AirDropFallSpeed = 0.2; // Airdrop fall speed
    // 600 Seconds = 10 Minutes
    float TicksTimerFromStart = 1800 / TimesliceMultiplyier; // How much time will pass from the server start to first airdrop
    bool PrintInformationMessages = true; // Show in chat when airplane flew out and when airdrop is landed
    bool PrintInformationCoordinates = true; // Show in chat coordinates where airdrop is landed
    // 36000 Seconds = 1 Hour
    float RemoveTime = 1800 / TimesliceMultiplyier; // After how much time airplane and loot will be removed and new airplane will be spawned
    bool SpawnZombie = true; // Spawn zombie near airdrop when landed
    bool ShowSignal = true; // Show smoke signal when airdrop landed
    float RandomBoundsMin = 5; // Airdrop drop bounds min
    float RandomBoundsMax = 10; // Airdrop drop bounds max
    bool PrintDebugMessages = false; // Show debug messages (Debug)
    bool DropOnStart = false; // Drop airdrop instantly after airplane (Debug)
    bool TeleportDebug = false; // Teleport to airplane and airdrop during flight (Debug)

    /* ### ### ### ### ### ### ### ### */
    /* Local variables */
    /* ### ### ### ### ### ### ### ### */

    vector m_AirPlaneFixedPosition; // Local variable
    vector m_DropPos; // Local variable

    Object m_AirPlane; // Global airplane object
    Object m_AirDrop; // Glbal airdrop container object
    Object m_Platform; // Glbal airdrop container object

    EntityAI m_AirDropLoot; // Airdrop container body
    ItemBase m_AirDropBase; // Airdrop container base

    Particle DropEffect; // Airdrop land particle effect    
    Particle SignalEffect; // Airdrop land particle effect    

    vector RandomRotOrientation; // Local variable    
    EntityAI PhysicsBody; // Local variable

    float RandomRot = 0; // Default random rotation variable
    float RandomTime = 100; // Default random drop variable
    float Delay = 0; // Local variable for security
    float Ground; // Local variable for security

    int AirDropTime = 0; // Local variable
    int AirTimer = 0; // Local variable
    int RemoveTimer = 0; // Local variable

    bool RayReady = true; // Local variable
    bool TimerPassed = false; // Local variable
    bool AirPassed = false; // Local variable
    bool RemovePased = false; // Local variable
    bool DropTime = false; // Local variable
    bool PassTime = false; // Local variable

    /* ### ### ### ### ### ### ### ### */
    /* Global functions */
    /* ### ### ### ### ### ### ### ### */

    // Send message in global chat
    void SendMessage(string message) 
    {
        ref array<Man> players = new array<Man>; 
        GetGame().GetPlayers( players ); 
        
        for ( int i = 0; i < players.Count(); i++ ) 
        { 
            PlayerBase player1; 
            Class.CastTo(player1, players.Get(i)); 

            Param1<string> m_AirTimer = new Param1<string>(message); 
            GetGame().RPCSingleParam(player1, ERPCs.RPC_USER_ACTION_MESSAGE, m_AirTimer, true, player1.GetIdentity()); 
        }
    }
    
    // Teleport all players to position, debug
    void SendPos(vector pos) 
    {
        ref array<Man> players = new array<Man>; 
        GetGame().GetPlayers( players ); 
        
        for ( int i = 0; i < players.Count(); i++ ) 
        { 
            PlayerBase player1; 
            Class.CastTo(player1, players.Get(i)); 

            player1.SetPosition(pos);
        }
    }

    /* ### ### ### ### ### ### ### ### */
    /* Configuration of loot and spawn points */
    /* ### ### ### ### ### ### ### ### */

    // Random Loot Presets
    string GetRandomLoot() 
    {
        TStringArray loot = {
        "LandMineTrap", 
        "Marmalade", 
        "GhillieSuit_Tan", 
        "M4A1", 
        "PlateCarrierComplete", 
        "BalaclavaMask_Blackskull", 
        "GorkaHelmetComplete",
        "BallisticHelmet_Green",
        "Suppressor_East",
        "GhillieBushrag_Tan",
        "M4_Suppressor",
        "AK_Suppressor",
        "AK_Bayonet",
        "M9A1_Bayonet",
        "RDG2SmokeGrenade_Black",
        "RDG2SmokeGrenade_White",
        "Mag_AKM_Drum75Rnd",
        "Mag_STANAGCoupled_30Rnd",
        
        };

        return loot.GetRandomElement();
    }
    
    // Generating random airdrop position from list
    // You can get coordinates using debug monitor or this map https://dayz.ginfo.gg/
    vector GetAirPlanePos() 
    {
        TVectorArray positions = { 
        "3559 0 7238",
        "5088 0 2379",
        "7971 0 9030",
        "4716 0 9974",
        "11990 0 12498",
        };

        vector what = positions.GetRandomElement();
        what[1] = AirPlaneHeight;
        return what;
    }

    /* ### ### ### ### ### ### ### ### */
    /* Zombie spawn list */
    /* ### ### ### ### ### ### ### ### */

    TStringArray WorkingZombieClasses()
    {
        return {
        "ZmbM_HermitSkinny_Base","ZmbM_HermitSkinny_Beige","ZmbM_HermitSkinny_Black","ZmbM_HermitSkinny_Green",
        "ZmbM_HermitSkinny_Red","ZmbM_FarmerFat_Base","ZmbM_FarmerFat_Beige","ZmbM_FarmerFat_Blue","ZmbM_FarmerFat_Brown",
        "ZmbM_FarmerFat_Green","ZmbF_CitizenANormal_Base","ZmbF_CitizenANormal_Beige","ZmbF_CitizenANormal_Brown",
        "ZmbF_CitizenANormal_Blue","ZmbM_CitizenASkinny_Base","ZmbM_CitizenASkinny_Blue","ZmbM_CitizenASkinny_Brown",
        "ZmbM_CitizenASkinny_Grey","ZmbM_CitizenASkinny_Red","ZmbM_CitizenBFat_Base","ZmbM_CitizenBFat_Blue","ZmbM_CitizenBFat_Red",
        "ZmbM_CitizenBFat_Green","ZmbF_CitizenBSkinny_Base","ZmbF_CitizenBSkinny","ZmbM_PrisonerSkinny_Base","ZmbM_PrisonerSkinny",
        "ZmbM_FirefighterNormal_Base","ZmbM_FirefighterNormal","ZmbM_FishermanOld_Base","ZmbM_FishermanOld_Blue","ZmbM_FishermanOld_Green",
        "ZmbM_FishermanOld_Grey","ZmbM_FishermanOld_Red","ZmbM_JournalistSkinny_Base","ZmbM_JournalistSkinny","ZmbF_JournalistNormal_Base",
        "ZmbF_JournalistNormal_Blue","ZmbF_JournalistNormal_Green","ZmbF_JournalistNormal_Red","ZmbF_JournalistNormal_White",
        "ZmbM_ParamedicNormal_Base","ZmbM_ParamedicNormal_Blue","ZmbM_ParamedicNormal_Green","ZmbM_ParamedicNormal_Red",
        "ZmbM_ParamedicNormal_Black","ZmbF_ParamedicNormal_Base","ZmbF_ParamedicNormal_Blue","ZmbF_ParamedicNormal_Green",
        "ZmbF_ParamedicNormal_Red","ZmbM_HikerSkinny_Base","ZmbM_HikerSkinny_Blue","ZmbM_HikerSkinny_Green","ZmbM_HikerSkinny_Yellow",
        "ZmbF_HikerSkinny_Base","ZmbF_HikerSkinny_Blue","ZmbF_HikerSkinny_Grey","ZmbF_HikerSkinny_Green","ZmbF_HikerSkinny_Red",
        "ZmbM_HunterOld_Base","ZmbM_HunterOld_Autumn","ZmbM_HunterOld_Spring","ZmbM_HunterOld_Summer","ZmbM_HunterOld_Winter",
        "ZmbF_SurvivorNormal_Base","ZmbF_SurvivorNormal_Blue","ZmbF_SurvivorNormal_Orange","ZmbF_SurvivorNormal_Red",
        "ZmbF_SurvivorNormal_White","ZmbM_SurvivorDean_Base","ZmbM_SurvivorDean_Black","ZmbM_SurvivorDean_Blue","ZmbM_SurvivorDean_Grey",
        "ZmbM_PolicemanFat_Base","ZmbM_PolicemanFat","ZmbF_PoliceWomanNormal_Base","ZmbF_PoliceWomanNormal","ZmbM_PolicemanSpecForce_Base",
        "ZmbM_PolicemanSpecForce","ZmbM_SoldierNormal_Base","ZmbM_SoldierNormal","ZmbM_usSoldier_normal_Base",
        "ZmbM_usSoldier_normal_Woodland","ZmbM_usSoldier_normal_Desert","ZmbM_CommercialPilotOld_Base","ZmbM_CommercialPilotOld_Blue",
        "ZmbM_CommercialPilotOld_Olive","ZmbM_CommercialPilotOld_Brown","ZmbM_CommercialPilotOld_Grey","ZmbM_PatrolNormal_Base",
        "ZmbM_PatrolNormal_PautRev","ZmbM_PatrolNormal_Autumn","ZmbM_PatrolNormal_Flat","ZmbM_PatrolNormal_Summer","ZmbM_JoggerSkinny_Base",
        "ZmbM_JoggerSkinny_Blue","ZmbM_JoggerSkinny_Green","ZmbM_JoggerSkinny_Red","ZmbF_JoggerSkinny_Base","ZmbF_JoggerSkinny_Blue",
        "ZmbF_JoggerSkinny_Brown","ZmbF_JoggerSkinny_Green","ZmbF_JoggerSkinny_Red","ZmbM_MotobikerFat_Base","ZmbM_MotobikerFat_Beige",
        "ZmbM_MotobikerFat_Black","ZmbM_MotobikerFat_Blue","ZmbM_VillagerOld_Base","ZmbM_VillagerOld_Blue","ZmbM_VillagerOld_Green",
        "ZmbM_VillagerOld_White","ZmbM_SkaterYoung_Base","ZmbM_SkaterYoung_Blue","ZmbM_SkaterYoung_Brown","ZmbM_SkaterYoung_Green",
        "ZmbM_SkaterYoung_Grey","ZmbF_SkaterYoung_Base","ZmbF_SkaterYoung_Brown","ZmbF_SkaterYoung_Striped","ZmbF_SkaterYoung_Violet",
        "ZmbF_DoctorSkinny_Base","ZmbF_DoctorSkinny","ZmbF_BlueCollarFat_Base","ZmbF_BlueCollarFat_Blue","ZmbF_BlueCollarFat_Green",
        "ZmbF_BlueCollarFat_Red","ZmbF_BlueCollarFat_White","ZmbF_MechanicNormal_Base","ZmbF_MechanicNormal_Beige","ZmbF_MechanicNormal_Green",
        "ZmbF_MechanicNormal_Grey","ZmbF_MechanicNormal_Orange","ZmbM_MechanicSkinny_Base","ZmbM_MechanicSkinny_Blue","ZmbM_MechanicSkinny_Grey",
        "ZmbM_MechanicSkinny_Green","ZmbM_MechanicSkinny_Red","ZmbM_ConstrWorkerNormal_Base","ZmbM_ConstrWorkerNormal_Beige",
        "ZmbM_ConstrWorkerNormal_Black","ZmbM_ConstrWorkerNormal_Green","ZmbM_ConstrWorkerNormal_Grey","ZmbM_HeavyIndustryWorker_Base",
        "ZmbM_HeavyIndustryWorker","ZmbM_OffshoreWorker_Base","ZmbM_OffshoreWorker_Green","ZmbM_OffshoreWorker_Orange","ZmbM_OffshoreWorker_Red",
        "ZmbM_OffshoreWorker_Yellow","ZmbF_NurseFat_Base","ZmbF_NurseFat","ZmbM_HandymanNormal_Base","ZmbM_HandymanNormal_Beige",
        "ZmbM_HandymanNormal_Blue","ZmbM_HandymanNormal_Green","ZmbM_HandymanNormal_Grey","ZmbM_HandymanNormal_White","ZmbM_DoctorFat_Base",
        "ZmbM_DoctorFat","ZmbM_Jacket_Base","ZmbM_Jacket_beige","ZmbM_Jacket_black","ZmbM_Jacket_blue","ZmbM_Jacket_bluechecks",
        "ZmbM_Jacket_brown","ZmbM_Jacket_greenchecks","ZmbM_Jacket_grey","ZmbM_Jacket_khaki","ZmbM_Jacket_magenta","ZmbM_Jacket_stripes",
        "ZmbF_PatientOld_Base","ZmbF_PatientOld","ZmbM_PatientSkinny_Base","ZmbM_PatientSkinny","ZmbF_ShortSkirt_Base","ZmbF_ShortSkirt_beige",
        "ZmbF_ShortSkirt_black","ZmbF_ShortSkirt_brown","ZmbF_ShortSkirt_green","ZmbF_ShortSkirt_grey","ZmbF_ShortSkirt_checks",
        "ZmbF_ShortSkirt_red","ZmbF_ShortSkirt_stripes","ZmbF_ShortSkirt_white","ZmbF_ShortSkirt_yellow","ZmbF_VillagerOld_Base",
        "ZmbF_VillagerOld_Blue","ZmbF_VillagerOld_Green","ZmbF_VillagerOld_Red","ZmbF_VillagerOld_White","ZmbM_Soldier","ZmbM_SoldierAlice",
        "ZmbM_SoldierHelmet","ZmbM_SoldierVest","ZmbM_SoldierAliceHelmet","ZmbM_SoldierVestHelmet","ZmbF_MilkMaidOld_Base",
        "ZmbF_MilkMaidOld_Beige","ZmbF_MilkMaidOld_Black","ZmbF_MilkMaidOld_Green","ZmbF_MilkMaidOld_Grey","ZmbM_priestPopSkinny_Base",
        "ZmbM_priestPopSkinny","ZmbM_ClerkFat_Base","ZmbM_ClerkFat_Brown","ZmbM_ClerkFat_Grey","ZmbM_ClerkFat_Khaki","ZmbM_ClerkFat_White",
        "ZmbF_Clerk_Normal_Base","ZmbF_Clerk_Normal_Blue","ZmbF_Clerk_Normal_White","ZmbF_Clerk_Normal_Green","ZmbF_Clerk_Normal_Red",
        };
    }

    /* ### ### ### ### ### ### ### ### */
    /* Airplane and airdrop setup */
    /* ### ### ### ### ### ### ### ### */

    void GetAirPlaneInfo()
    {
        // Seconds devide on value of TimesliceMultiplyier (By default it is 0.01)
        RandomTime = Math.RandomFloat(RandomBoundsMin / TimesliceMultiplyier, RandomBoundsMax / TimesliceMultiplyier); // Random drop bounds
        RandomRot = Math.RandomFloat(130, 190); // Random rot bounds

        if (PrintDebugMessages)
        SendMessage("[Airdrop, Debug] Random rotation of airplane is " + RandomRot);        
        
        // Dynamic movement forward
        float Forward = RandomRot * 0.017453292;

        // 7.5 is airdrop container motion speed
        float MotionX  = (double)(Math.Sin(Forward) * 7.5); 
        float MotionZ = (double)(Math.Cos(Forward) * 7.5);

        // Fixed position, if we dont multiply value to -1 it will move backwards
        m_AirPlaneFixedPosition[0] = MotionX * -1;
        m_AirPlaneFixedPosition[1] = 10;
        m_AirPlaneFixedPosition[2] = MotionZ * -1;
        RandomRotOrientation[0] = RandomRot;

        m_AirPlane = GetGame().CreateObject( "Land_Wreck_C130J", GetAirPlanePos(), false, true ); // Create airplane model
        m_AirPlane.SetOrientation(RandomRotOrientation); // Rotate it to random angles in yaw

        m_AirPlane.PlaySoundLoop("powerGeneratorLoop", 10000, true); // Attach airplane sound to itself, need to be fixed
        
        if (PrintInformationMessages)
            if (m_AirPlane != NULL)
                SendMessage("[Airdrop] Airplane was spotted on map!");    

        m_AirPlane.SetPosition( m_AirPlane.GetPosition() );
        m_DropPos = ( m_AirPlane.GetPosition() ) - m_AirPlaneFixedPosition;

        protected vector pos; pos[0] = 0; pos[1] = AirPlaneHeight; pos[2] = 0;

        m_Platform = GetGame().CreateObject( "Land_Container_1Bo", pos, false, true ); 
        PhysicsBody = EntityAI.Cast( GetGame().CreateObject( "CivilianSedan", m_Platform.GetPosition(), false, true ) );
        PhysicsBody.SetAllowDamage( false );    
    
        if (DropOnStart) // For debug puproses only
        {
            RayReady = false;

            if (PrintInformationMessages)
            SendMessage("[Airdrop] Airdrop was dropped from the plane!");    

            m_AirDrop = GetGame().CreateObject( "Land_Container_1Bo", m_DropPos, false, true ); // Create airdrop model, in this case it is red container
            
            SetVelocity(PhysicsBody, "10 0 0");
            GetGame().ObjectDelete(m_Platform);
            SetVelocity(PhysicsBody, "10 0 0");

            // Reset it to default values
            RemoveTimer = 0;
            RemovePased = false;
        }

        if (TeleportDebug) // For debug puproses only
        {
            if (m_AirPlane != NULL)
            {
                SendPos(m_AirPlane.GetPosition());
            }
        }
    }

    void MoveAirPlane()
    {
        // Dynamic movement forward
            float Forward = RandomRot * 0.017453292;

        // 7.5 is airdrop container motion speed
        float MotionX  = (double)(Math.Sin(Forward) * AirPlaneSpeed); 
            float MotionZ = (double)(Math.Cos(Forward) * AirPlaneSpeed);

        // Fixed position, if we dont multiply value to -1 it will move backwards
        m_AirPlaneFixedPosition[0] = MotionX * -1;
        m_AirPlaneFixedPosition[1] = 0;
        m_AirPlaneFixedPosition[2] = MotionZ * -1;

        m_AirPlane.SetPosition( m_AirPlane.GetPosition() + m_AirPlaneFixedPosition );
        m_DropPos = ( m_AirPlane.GetPosition() ) - m_AirPlaneFixedPosition;

        if (!RayReady)
        {
            Ground = GetGame().SurfaceY(m_AirDrop.GetPosition()[0], m_AirDrop.GetPosition()[2]);
            if (PhysicsBody.GetPosition()[1] <= Ground)
                PhysicsBody.SetVelocity(PhysicsBody, "0 0 0");

            if (GetVelocity(PhysicsBody)[0] < 0.0001 && GetVelocity(PhysicsBody)[1] < 0.0001 && GetVelocity(PhysicsBody)[2] < 0.0001)
            {
                m_AirDrop.PlaceOnSurface();
    
                // Create airdrop lootable container, in this case it is sea chest    
                m_AirDropLoot = EntityAI.Cast(GetGame().CreateObject( "SeaChest", m_AirDrop.GetPosition(), false, true )); // We can't add barrel because it have to be opened
                
                // You can extend items count inside airdrop container or make it random
                m_AirDropLoot.GetInventory().CreateInInventory(GetRandomLoot());
                m_AirDropLoot.GetInventory().CreateInInventory(GetRandomLoot());
                m_AirDropLoot.GetInventory().CreateInInventory(GetRandomLoot());
                m_AirDropLoot.GetInventory().CreateInInventory(GetRandomLoot());
                m_AirDropLoot.GetInventory().CreateInInventory(GetRandomLoot());
                m_AirDropLoot.GetInventory().CreateInInventory(GetRandomLoot());
                
                m_AirDropBase = ItemBase.Cast(m_AirDropLoot); // Cast items to airdrop container

                // Play particle when airdrop container, in this case it is red container
                DropEffect = Particle.Play( ParticleList.EXPLOSION_LANDMINE, m_AirDrop.GetPosition() );
            
                if (PrintInformationMessages && !PrintInformationCoordinates)
                SendMessage("[Airdrop] Airdrop landed!");    
                else if (PrintInformationMessages && PrintInformationCoordinates) {
                    array<string> arrCoords = new array<string>;
                    string strAirdropPos = m_AirDrop.GetPosition().ToString();
                    strAirdropPos = strAirdropPos.Substring(1, strAirdropPos.Length() - 2);
                    strAirdropPos.Split( ", ", arrCoords );
                    SendMessage("[Airdrop] Airdrop landed on coordinates " + Math.Round( arrCoords.Get(0).ToInt() ) + " " + Math.Round( arrCoords.Get(2).ToInt() ) + "!");
                }

                if (SpawnZombie)
                {
                    GetGame().CreateObject( WorkingZombieClasses().GetRandomElement(), m_AirDrop.GetPosition() - "10 0 0", false, true );    
                    GetGame().CreateObject( WorkingZombieClasses().GetRandomElement(), m_AirDrop.GetPosition() - "0 0 10", false, true );    
                    GetGame().CreateObject( WorkingZombieClasses().GetRandomElement(), m_AirDrop.GetPosition() - "10 0 -10", false, true );        
                    GetGame().CreateObject( WorkingZombieClasses().GetRandomElement(), m_AirDrop.GetPosition() - "-10 0 10", false, true );
                }
                
                if (ShowSignal)
                {
                    vector signal = "0 1.5 0";
                    SignalEffect = Particle.Play( ParticleList.RDG2, m_AirDrop.GetPosition() + signal );            
                }

                // Removing physics body
                PhysicsBody.SetPosition(vector.Zero);
                GetGame().ObjectDelete( PhysicsBody ); 
                PhysicsBody = NULL;    
                
                // Reset it to default values
                RayReady = true;
            }
            else
            {
                if (m_AirDrop != NULL)
                {
                    vector phys;
                    phys[0] = m_AirDrop.GetPosition()[0];
                    phys[1] = PhysicsBody.GetPosition()[1];
                    phys[2] = m_AirDrop.GetPosition()[2];
                
                    m_AirDrop.SetPosition(phys);
                    m_AirDrop.SetOrientation(PhysicsBody.GetOrientation());
                }
            }
        }

        if (DropTime && !DropOnStart)
        {    
            RayReady = false;

            if (PrintInformationMessages)
            SendMessage("[Airdrop] Airdrop was dropped from the plane!");    
            
            m_AirDrop = GetGame().CreateObject( "Land_Container_1Bo", m_DropPos, false, true ); // Create airdrop model, in this case it is red container
            
            SetVelocity(PhysicsBody, "10 0 0");
            GetGame().ObjectDelete(m_Platform);
            SetVelocity(PhysicsBody, "10 0 0");
            
            // Reset it to default values
            RemoveTimer = 0;
            RemovePased = false;
            DropTime = false;        
        }
    }

    /* ### ### ### ### ### ### ### ### */
    /* Airdrop controller */
    /* ### ### ### ### ### ### ### ### */

    bool init = true;
    void CreateAirDrop()
    {
        if (!EnableAirdrops)
            return;

        if (init)
            SendMessage("[Airdrop] Plugin initialized");
        init = false;

        // Remove timer        
        if (RemoveTimer <= RemoveTime)
        {
            RemoveTimer++;
        }
        else
        {
            // Removing all objects when remove timer is passed
            if (!RemovePased)
            {
                if (m_AirDrop != NULL)
                {
                    m_AirDrop.SetPosition(vector.Zero);
                    GetGame().ObjectDelete( m_AirDrop ); 
                    m_AirDrop = NULL;    
                }
                
                if (m_AirPlane != NULL)
                {
                    m_AirPlane.SetPosition(vector.Zero);
                    GetGame().ObjectDelete( m_AirPlane ); 
                    m_AirPlane = NULL;    
                }
                
                if (m_AirDropBase != NULL)
                {
                    m_AirDropBase.SetPosition(vector.Zero);
                    GetGame().ObjectDelete( m_AirDropBase ); 
                    m_AirDropBase = NULL;    
                }
                
                if (m_AirDropLoot != NULL)
                {
                    m_AirDropLoot.SetPosition(vector.Zero);
                    GetGame().ObjectDelete( m_AirDropLoot ); 
                    m_AirDropLoot = NULL;    
                }
                
                if (DropEffect != NULL)
                {
                    DropEffect.Stop();
                    DropEffect = NULL;
                }
                
                if (SignalEffect != NULL)
                {
                    SignalEffect.Stop();
                    SignalEffect = NULL;
                }
                
                // Reset it to default values
                AirPassed = false;
                TimerPassed = false;
                AirDropTime = 0;
                AirTimer = 0;    
                DropTime = false;        
                RemovePased = true;    
            }
        }
        
        //  After how much time after restart need to wait before airplane spawn
        if (AirTimer <= TicksTimerFromStart)
        {
            AirTimer++;
            
            if (PrintDebugMessages)
            SendMessage("[Airdrop, Debug] Airtimer value is " + AirTimer);
        }
        else
        {    
            // Reset it to default values
            TimerPassed = true;
        }

        if (TimerPassed && !AirPassed)    
        {
            if (PrintDebugMessages)
            SendMessage("[Airdrop, Debug] Airtimer passed");    
            
            GetAirPlaneInfo();
            
            if (PrintDebugMessages)
            SendMessage("[Airdrop, Debug] Airdrop spawned via timer");        
                
            // Reset it to default values
            AirPassed = true;
        }    

        if (AirPassed)
        {
            if (m_AirPlane)
            {
                MoveAirPlane();
            }
        }
            
        if (AirDropTime <= RandomTime)
        {
            AirDropTime++;
            
            if (TeleportDebug) // For debug puproses only
            {
                SendPos(m_AirPlane.GetPosition());
            }

            if (PrintDebugMessages)
                SendMessage("[Airdrop, Debug] Airdrop time is " + AirDropTime + " from " + RandomTime);        
        }
        else
        {
            if (Delay <= 1000)
            {
                Delay++;
            }
            else
            {
                if (!RayReady)
                {
                    if (TeleportDebug) // For debug puproses only
                    {
                        SendPos(m_AirPlane.GetPosition());
                    }
                }
            
                if (!PassTime)
                {
                    // Reset it to default values
                    DropTime = true;
                    PassTime = true;
                }
            }
        }
    }

    /* ### ### ### ### ### ### ### ### */
}


 

Edited by Mostabdel

Share this post


Link to post
Share on other sites
On 01/11/2018 at 11:46 PM, Mostabdel said:

oui je bac mais erreur avec airdrop ligne

this is the script of aidrop

 

class AirDrop
{
    /* ### ### ### ### ### ### ### ### */
    /* DayZ 0.63 AirDrop plugin by mov3ax / mov3ax.pro */
    /* ### ### ### ### ### ### ### ### */    

    void AirDrop()
    {
    }

    void ~AirDrop()
    {
    }

    /* ### ### ### ### ### ### ### ### */
    /* Configuration of plugin */
    /* ### ### ### ### ### ### ### ### */

    bool EnableAirdrops = true; // Main switch
    float TimesliceMultiplyier = 0.01; // Timeslice multiplyier, default value is 0.01 (60 FPS)
    float AirPlaneSpeed = 0.25; // Airplane fly speed 
    float AirPlaneHeight = 300; // Airplane fly height 
    float AirDropFallSpeed = 0.2; // Airdrop fall speed
    // 600 Seconds = 10 Minutes
    float TicksTimerFromStart = 1800 / TimesliceMultiplyier; // How much time will pass from the server start to first airdrop
    bool PrintInformationMessages = true; // Show in chat when airplane flew out and when airdrop is landed
    bool PrintInformationCoordinates = true; // Show in chat coordinates where airdrop is landed
    // 36000 Seconds = 1 Hour
    float RemoveTime = 1800 / TimesliceMultiplyier; // After how much time airplane and loot will be removed and new airplane will be spawned
    bool SpawnZombie = true; // Spawn zombie near airdrop when landed
    bool ShowSignal = true; // Show smoke signal when airdrop landed
    float RandomBoundsMin = 5; // Airdrop drop bounds min
    float RandomBoundsMax = 10; // Airdrop drop bounds max
    bool PrintDebugMessages = false; // Show debug messages (Debug)
    bool DropOnStart = false; // Drop airdrop instantly after airplane (Debug)
    bool TeleportDebug = false; // Teleport to airplane and airdrop during flight (Debug)

    /* ### ### ### ### ### ### ### ### */
    /* Local variables */
    /* ### ### ### ### ### ### ### ### */

    vector m_AirPlaneFixedPosition; // Local variable
    vector m_DropPos; // Local variable

    Object m_AirPlane; // Global airplane object
    Object m_AirDrop; // Glbal airdrop container object
    Object m_Platform; // Glbal airdrop container object

    EntityAI m_AirDropLoot; // Airdrop container body
    ItemBase m_AirDropBase; // Airdrop container base

    Particle DropEffect; // Airdrop land particle effect    
    Particle SignalEffect; // Airdrop land particle effect    

    vector RandomRotOrientation; // Local variable    
    EntityAI PhysicsBody; // Local variable

    float RandomRot = 0; // Default random rotation variable
    float RandomTime = 100; // Default random drop variable
    float Delay = 0; // Local variable for security
    float Ground; // Local variable for security

    int AirDropTime = 0; // Local variable
    int AirTimer = 0; // Local variable
    int RemoveTimer = 0; // Local variable

    bool RayReady = true; // Local variable
    bool TimerPassed = false; // Local variable
    bool AirPassed = false; // Local variable
    bool RemovePased = false; // Local variable
    bool DropTime = false; // Local variable
    bool PassTime = false; // Local variable

    /* ### ### ### ### ### ### ### ### */
    /* Global functions */
    /* ### ### ### ### ### ### ### ### */

    // Send message in global chat
    void SendMessage(string message) 
    {
        ref array<Man> players = new array<Man>; 
        GetGame().GetPlayers( players ); 
        
        for ( int i = 0; i < players.Count(); i++ ) 
        { 
            PlayerBase player1; 
            Class.CastTo(player1, players.Get(i)); 

            Param1<string> m_AirTimer = new Param1<string>(message); 
            GetGame().RPCSingleParam(player1, ERPCs.RPC_USER_ACTION_MESSAGE, m_AirTimer, true, player1.GetIdentity()); 
        }
    }
    
    // Teleport all players to position, debug
    void SendPos(vector pos) 
    {
        ref array<Man> players = new array<Man>; 
        GetGame().GetPlayers( players ); 
        
        for ( int i = 0; i < players.Count(); i++ ) 
        { 
            PlayerBase player1; 
            Class.CastTo(player1, players.Get(i)); 

            player1.SetPosition(pos);
        }
    }

    /* ### ### ### ### ### ### ### ### */
    /* Configuration of loot and spawn points */
    /* ### ### ### ### ### ### ### ### */

    // Random Loot Presets
    string GetRandomLoot() 
    {
        TStringArray loot = {
        "LandMineTrap", 
        "Marmalade", 
        "GhillieSuit_Tan", 
        "M4A1", 
        "PlateCarrierComplete", 
        "BalaclavaMask_Blackskull", 
        "GorkaHelmetComplete",
        "BallisticHelmet_Green",
        "Suppressor_East",
        "GhillieBushrag_Tan",
        "M4_Suppressor",
        "AK_Suppressor",
        "AK_Bayonet",
        "M9A1_Bayonet",
        "RDG2SmokeGrenade_Black",
        "RDG2SmokeGrenade_White",
        "Mag_AKM_Drum75Rnd",
        "Mag_STANAGCoupled_30Rnd",
        
        };

        return loot.GetRandomElement();
    }
    
    // Generating random airdrop position from list
    // You can get coordinates using debug monitor or this map https://dayz.ginfo.gg/
    vector GetAirPlanePos() 
    {
        TVectorArray positions = { 
        "3559 0 7238",
        "5088 0 2379",
        "7971 0 9030",
        "4716 0 9974",
        "11990 0 12498",
        };

        vector what = positions.GetRandomElement();
        what[1] = AirPlaneHeight;
        return what;
    }

    /* ### ### ### ### ### ### ### ### */
    /* Zombie spawn list */
    /* ### ### ### ### ### ### ### ### */

    TStringArray WorkingZombieClasses()
    {
        return {
        "ZmbM_HermitSkinny_Base","ZmbM_HermitSkinny_Beige","ZmbM_HermitSkinny_Black","ZmbM_HermitSkinny_Green",
        "ZmbM_HermitSkinny_Red","ZmbM_FarmerFat_Base","ZmbM_FarmerFat_Beige","ZmbM_FarmerFat_Blue","ZmbM_FarmerFat_Brown",
        "ZmbM_FarmerFat_Green","ZmbF_CitizenANormal_Base","ZmbF_CitizenANormal_Beige","ZmbF_CitizenANormal_Brown",
        "ZmbF_CitizenANormal_Blue","ZmbM_CitizenASkinny_Base","ZmbM_CitizenASkinny_Blue","ZmbM_CitizenASkinny_Brown",
        "ZmbM_CitizenASkinny_Grey","ZmbM_CitizenASkinny_Red","ZmbM_CitizenBFat_Base","ZmbM_CitizenBFat_Blue","ZmbM_CitizenBFat_Red",
        "ZmbM_CitizenBFat_Green","ZmbF_CitizenBSkinny_Base","ZmbF_CitizenBSkinny","ZmbM_PrisonerSkinny_Base","ZmbM_PrisonerSkinny",
        "ZmbM_FirefighterNormal_Base","ZmbM_FirefighterNormal","ZmbM_FishermanOld_Base","ZmbM_FishermanOld_Blue","ZmbM_FishermanOld_Green",
        "ZmbM_FishermanOld_Grey","ZmbM_FishermanOld_Red","ZmbM_JournalistSkinny_Base","ZmbM_JournalistSkinny","ZmbF_JournalistNormal_Base",
        "ZmbF_JournalistNormal_Blue","ZmbF_JournalistNormal_Green","ZmbF_JournalistNormal_Red","ZmbF_JournalistNormal_White",
        "ZmbM_ParamedicNormal_Base","ZmbM_ParamedicNormal_Blue","ZmbM_ParamedicNormal_Green","ZmbM_ParamedicNormal_Red",
        "ZmbM_ParamedicNormal_Black","ZmbF_ParamedicNormal_Base","ZmbF_ParamedicNormal_Blue","ZmbF_ParamedicNormal_Green",
        "ZmbF_ParamedicNormal_Red","ZmbM_HikerSkinny_Base","ZmbM_HikerSkinny_Blue","ZmbM_HikerSkinny_Green","ZmbM_HikerSkinny_Yellow",
        "ZmbF_HikerSkinny_Base","ZmbF_HikerSkinny_Blue","ZmbF_HikerSkinny_Grey","ZmbF_HikerSkinny_Green","ZmbF_HikerSkinny_Red",
        "ZmbM_HunterOld_Base","ZmbM_HunterOld_Autumn","ZmbM_HunterOld_Spring","ZmbM_HunterOld_Summer","ZmbM_HunterOld_Winter",
        "ZmbF_SurvivorNormal_Base","ZmbF_SurvivorNormal_Blue","ZmbF_SurvivorNormal_Orange","ZmbF_SurvivorNormal_Red",
        "ZmbF_SurvivorNormal_White","ZmbM_SurvivorDean_Base","ZmbM_SurvivorDean_Black","ZmbM_SurvivorDean_Blue","ZmbM_SurvivorDean_Grey",
        "ZmbM_PolicemanFat_Base","ZmbM_PolicemanFat","ZmbF_PoliceWomanNormal_Base","ZmbF_PoliceWomanNormal","ZmbM_PolicemanSpecForce_Base",
        "ZmbM_PolicemanSpecForce","ZmbM_SoldierNormal_Base","ZmbM_SoldierNormal","ZmbM_usSoldier_normal_Base",
        "ZmbM_usSoldier_normal_Woodland","ZmbM_usSoldier_normal_Desert","ZmbM_CommercialPilotOld_Base","ZmbM_CommercialPilotOld_Blue",
        "ZmbM_CommercialPilotOld_Olive","ZmbM_CommercialPilotOld_Brown","ZmbM_CommercialPilotOld_Grey","ZmbM_PatrolNormal_Base",
        "ZmbM_PatrolNormal_PautRev","ZmbM_PatrolNormal_Autumn","ZmbM_PatrolNormal_Flat","ZmbM_PatrolNormal_Summer","ZmbM_JoggerSkinny_Base",
        "ZmbM_JoggerSkinny_Blue","ZmbM_JoggerSkinny_Green","ZmbM_JoggerSkinny_Red","ZmbF_JoggerSkinny_Base","ZmbF_JoggerSkinny_Blue",
        "ZmbF_JoggerSkinny_Brown","ZmbF_JoggerSkinny_Green","ZmbF_JoggerSkinny_Red","ZmbM_MotobikerFat_Base","ZmbM_MotobikerFat_Beige",
        "ZmbM_MotobikerFat_Black","ZmbM_MotobikerFat_Blue","ZmbM_VillagerOld_Base","ZmbM_VillagerOld_Blue","ZmbM_VillagerOld_Green",
        "ZmbM_VillagerOld_White","ZmbM_SkaterYoung_Base","ZmbM_SkaterYoung_Blue","ZmbM_SkaterYoung_Brown","ZmbM_SkaterYoung_Green",
        "ZmbM_SkaterYoung_Grey","ZmbF_SkaterYoung_Base","ZmbF_SkaterYoung_Brown","ZmbF_SkaterYoung_Striped","ZmbF_SkaterYoung_Violet",
        "ZmbF_DoctorSkinny_Base","ZmbF_DoctorSkinny","ZmbF_BlueCollarFat_Base","ZmbF_BlueCollarFat_Blue","ZmbF_BlueCollarFat_Green",
        "ZmbF_BlueCollarFat_Red","ZmbF_BlueCollarFat_White","ZmbF_MechanicNormal_Base","ZmbF_MechanicNormal_Beige","ZmbF_MechanicNormal_Green",
        "ZmbF_MechanicNormal_Grey","ZmbF_MechanicNormal_Orange","ZmbM_MechanicSkinny_Base","ZmbM_MechanicSkinny_Blue","ZmbM_MechanicSkinny_Grey",
        "ZmbM_MechanicSkinny_Green","ZmbM_MechanicSkinny_Red","ZmbM_ConstrWorkerNormal_Base","ZmbM_ConstrWorkerNormal_Beige",
        "ZmbM_ConstrWorkerNormal_Black","ZmbM_ConstrWorkerNormal_Green","ZmbM_ConstrWorkerNormal_Grey","ZmbM_HeavyIndustryWorker_Base",
        "ZmbM_HeavyIndustryWorker","ZmbM_OffshoreWorker_Base","ZmbM_OffshoreWorker_Green","ZmbM_OffshoreWorker_Orange","ZmbM_OffshoreWorker_Red",
        "ZmbM_OffshoreWorker_Yellow","ZmbF_NurseFat_Base","ZmbF_NurseFat","ZmbM_HandymanNormal_Base","ZmbM_HandymanNormal_Beige",
        "ZmbM_HandymanNormal_Blue","ZmbM_HandymanNormal_Green","ZmbM_HandymanNormal_Grey","ZmbM_HandymanNormal_White","ZmbM_DoctorFat_Base",
        "ZmbM_DoctorFat","ZmbM_Jacket_Base","ZmbM_Jacket_beige","ZmbM_Jacket_black","ZmbM_Jacket_blue","ZmbM_Jacket_bluechecks",
        "ZmbM_Jacket_brown","ZmbM_Jacket_greenchecks","ZmbM_Jacket_grey","ZmbM_Jacket_khaki","ZmbM_Jacket_magenta","ZmbM_Jacket_stripes",
        "ZmbF_PatientOld_Base","ZmbF_PatientOld","ZmbM_PatientSkinny_Base","ZmbM_PatientSkinny","ZmbF_ShortSkirt_Base","ZmbF_ShortSkirt_beige",
        "ZmbF_ShortSkirt_black","ZmbF_ShortSkirt_brown","ZmbF_ShortSkirt_green","ZmbF_ShortSkirt_grey","ZmbF_ShortSkirt_checks",
        "ZmbF_ShortSkirt_red","ZmbF_ShortSkirt_stripes","ZmbF_ShortSkirt_white","ZmbF_ShortSkirt_yellow","ZmbF_VillagerOld_Base",
        "ZmbF_VillagerOld_Blue","ZmbF_VillagerOld_Green","ZmbF_VillagerOld_Red","ZmbF_VillagerOld_White","ZmbM_Soldier","ZmbM_SoldierAlice",
        "ZmbM_SoldierHelmet","ZmbM_SoldierVest","ZmbM_SoldierAliceHelmet","ZmbM_SoldierVestHelmet","ZmbF_MilkMaidOld_Base",
        "ZmbF_MilkMaidOld_Beige","ZmbF_MilkMaidOld_Black","ZmbF_MilkMaidOld_Green","ZmbF_MilkMaidOld_Grey","ZmbM_priestPopSkinny_Base",
        "ZmbM_priestPopSkinny","ZmbM_ClerkFat_Base","ZmbM_ClerkFat_Brown","ZmbM_ClerkFat_Grey","ZmbM_ClerkFat_Khaki","ZmbM_ClerkFat_White",
        "ZmbF_Clerk_Normal_Base","ZmbF_Clerk_Normal_Blue","ZmbF_Clerk_Normal_White","ZmbF_Clerk_Normal_Green","ZmbF_Clerk_Normal_Red",
        };
    }

    /* ### ### ### ### ### ### ### ### */
    /* Airplane and airdrop setup */
    /* ### ### ### ### ### ### ### ### */

    void GetAirPlaneInfo()
    {
        // Seconds devide on value of TimesliceMultiplyier (By default it is 0.01)
        RandomTime = Math.RandomFloat(RandomBoundsMin / TimesliceMultiplyier, RandomBoundsMax / TimesliceMultiplyier); // Random drop bounds
        RandomRot = Math.RandomFloat(130, 190); // Random rot bounds

        if (PrintDebugMessages)
        SendMessage("[Airdrop, Debug] Random rotation of airplane is " + RandomRot);        
        
        // Dynamic movement forward
        float Forward = RandomRot * 0.017453292;

        // 7.5 is airdrop container motion speed
        float MotionX  = (double)(Math.Sin(Forward) * 7.5); 
        float MotionZ = (double)(Math.Cos(Forward) * 7.5);

        // Fixed position, if we dont multiply value to -1 it will move backwards
        m_AirPlaneFixedPosition[0] = MotionX * -1;
        m_AirPlaneFixedPosition[1] = 10;
        m_AirPlaneFixedPosition[2] = MotionZ * -1;
        RandomRotOrientation[0] = RandomRot;

        m_AirPlane = GetGame().CreateObject( "Land_Wreck_C130J", GetAirPlanePos(), false, true ); // Create airplane model
        m_AirPlane.SetOrientation(RandomRotOrientation); // Rotate it to random angles in yaw

        m_AirPlane.PlaySoundLoop("powerGeneratorLoop", 10000, true); // Attach airplane sound to itself, need to be fixed
        
        if (PrintInformationMessages)
            if (m_AirPlane != NULL)
                SendMessage("[Airdrop] Airplane was spotted on map!");    

        m_AirPlane.SetPosition( m_AirPlane.GetPosition() );
        m_DropPos = ( m_AirPlane.GetPosition() ) - m_AirPlaneFixedPosition;

        protected vector pos; pos[0] = 0; pos[1] = AirPlaneHeight; pos[2] = 0;

        m_Platform = GetGame().CreateObject( "Land_Container_1Bo", pos, false, true ); 
        PhysicsBody = EntityAI.Cast( GetGame().CreateObject( "CivilianSedan", m_Platform.GetPosition(), false, true ) );
        PhysicsBody.SetAllowDamage( false );    
    
        if (DropOnStart) // For debug puproses only
        {
            RayReady = false;

            if (PrintInformationMessages)
            SendMessage("[Airdrop] Airdrop was dropped from the plane!");    

            m_AirDrop = GetGame().CreateObject( "Land_Container_1Bo", m_DropPos, false, true ); // Create airdrop model, in this case it is red container
            
            SetVelocity(PhysicsBody, "10 0 0");
            GetGame().ObjectDelete(m_Platform);
            SetVelocity(PhysicsBody, "10 0 0");

            // Reset it to default values
            RemoveTimer = 0;
            RemovePased = false;
        }

        if (TeleportDebug) // For debug puproses only
        {
            if (m_AirPlane != NULL)
            {
                SendPos(m_AirPlane.GetPosition());
            }
        }
    }

    void MoveAirPlane()
    {
        // Dynamic movement forward
            float Forward = RandomRot * 0.017453292;

        // 7.5 is airdrop container motion speed
        float MotionX  = (double)(Math.Sin(Forward) * AirPlaneSpeed); 
            float MotionZ = (double)(Math.Cos(Forward) * AirPlaneSpeed);

        // Fixed position, if we dont multiply value to -1 it will move backwards
        m_AirPlaneFixedPosition[0] = MotionX * -1;
        m_AirPlaneFixedPosition[1] = 0;
        m_AirPlaneFixedPosition[2] = MotionZ * -1;

        m_AirPlane.SetPosition( m_AirPlane.GetPosition() + m_AirPlaneFixedPosition );
        m_DropPos = ( m_AirPlane.GetPosition() ) - m_AirPlaneFixedPosition;

        if (!RayReady)
        {
            Ground = GetGame().SurfaceY(m_AirDrop.GetPosition()[0], m_AirDrop.GetPosition()[2]);
            if (PhysicsBody.GetPosition()[1] <= Ground)
                PhysicsBody.SetVelocity(PhysicsBody, "0 0 0");

            if (GetVelocity(PhysicsBody)[0] < 0.0001 && GetVelocity(PhysicsBody)[1] < 0.0001 && GetVelocity(PhysicsBody)[2] < 0.0001)
            {
                m_AirDrop.PlaceOnSurface();
    
                // Create airdrop lootable container, in this case it is sea chest    
                m_AirDropLoot = EntityAI.Cast(GetGame().CreateObject( "SeaChest", m_AirDrop.GetPosition(), false, true )); // We can't add barrel because it have to be opened
                
                // You can extend items count inside airdrop container or make it random
                m_AirDropLoot.GetInventory().CreateInInventory(GetRandomLoot());
                m_AirDropLoot.GetInventory().CreateInInventory(GetRandomLoot());
                m_AirDropLoot.GetInventory().CreateInInventory(GetRandomLoot());
                m_AirDropLoot.GetInventory().CreateInInventory(GetRandomLoot());
                m_AirDropLoot.GetInventory().CreateInInventory(GetRandomLoot());
                m_AirDropLoot.GetInventory().CreateInInventory(GetRandomLoot());
                
                m_AirDropBase = ItemBase.Cast(m_AirDropLoot); // Cast items to airdrop container

                // Play particle when airdrop container, in this case it is red container
                DropEffect = Particle.Play( ParticleList.EXPLOSION_LANDMINE, m_AirDrop.GetPosition() );
            
                if (PrintInformationMessages && !PrintInformationCoordinates)
                SendMessage("[Airdrop] Airdrop landed!");    
                else if (PrintInformationMessages && PrintInformationCoordinates) {
                    array<string> arrCoords = new array<string>;
                    string strAirdropPos = m_AirDrop.GetPosition().ToString();
                    strAirdropPos = strAirdropPos.Substring(1, strAirdropPos.Length() - 2);
                    strAirdropPos.Split( ", ", arrCoords );
                    SendMessage("[Airdrop] Airdrop landed on coordinates " + Math.Round( arrCoords.Get(0).ToInt() ) + " " + Math.Round( arrCoords.Get(2).ToInt() ) + "!");
                }

                if (SpawnZombie)
                {
                    GetGame().CreateObject( WorkingZombieClasses().GetRandomElement(), m_AirDrop.GetPosition() - "10 0 0", false, true );    
                    GetGame().CreateObject( WorkingZombieClasses().GetRandomElement(), m_AirDrop.GetPosition() - "0 0 10", false, true );    
                    GetGame().CreateObject( WorkingZombieClasses().GetRandomElement(), m_AirDrop.GetPosition() - "10 0 -10", false, true );        
                    GetGame().CreateObject( WorkingZombieClasses().GetRandomElement(), m_AirDrop.GetPosition() - "-10 0 10", false, true );
                }
                
                if (ShowSignal)
                {
                    vector signal = "0 1.5 0";
                    SignalEffect = Particle.Play( ParticleList.RDG2, m_AirDrop.GetPosition() + signal );            
                }

                // Removing physics body
                PhysicsBody.SetPosition(vector.Zero);
                GetGame().ObjectDelete( PhysicsBody ); 
                PhysicsBody = NULL;    
                
                // Reset it to default values
                RayReady = true;
            }
            else
            {
                if (m_AirDrop != NULL)
                {
                    vector phys;
                    phys[0] = m_AirDrop.GetPosition()[0];
                    phys[1] = PhysicsBody.GetPosition()[1];
                    phys[2] = m_AirDrop.GetPosition()[2];
                
                    m_AirDrop.SetPosition(phys);
                    m_AirDrop.SetOrientation(PhysicsBody.GetOrientation());
                }
            }
        }

        if (DropTime && !DropOnStart)
        {    
            RayReady = false;

            if (PrintInformationMessages)
            SendMessage("[Airdrop] Airdrop was dropped from the plane!");    
            
            m_AirDrop = GetGame().CreateObject( "Land_Container_1Bo", m_DropPos, false, true ); // Create airdrop model, in this case it is red container
            
            SetVelocity(PhysicsBody, "10 0 0");
            GetGame().ObjectDelete(m_Platform);
            SetVelocity(PhysicsBody, "10 0 0");
            
            // Reset it to default values
            RemoveTimer = 0;
            RemovePased = false;
            DropTime = false;        
        }
    }

    /* ### ### ### ### ### ### ### ### */
    /* Airdrop controller */
    /* ### ### ### ### ### ### ### ### */

    bool init = true;
    void CreateAirDrop()
    {
        if (!EnableAirdrops)
            return;

        if (init)
            SendMessage("[Airdrop] Plugin initialized");
        init = false;

        // Remove timer        
        if (RemoveTimer <= RemoveTime)
        {
            RemoveTimer++;
        }
        else
        {
            // Removing all objects when remove timer is passed
            if (!RemovePased)
            {
                if (m_AirDrop != NULL)
                {
                    m_AirDrop.SetPosition(vector.Zero);
                    GetGame().ObjectDelete( m_AirDrop ); 
                    m_AirDrop = NULL;    
                }
                
                if (m_AirPlane != NULL)
                {
                    m_AirPlane.SetPosition(vector.Zero);
                    GetGame().ObjectDelete( m_AirPlane ); 
                    m_AirPlane = NULL;    
                }
                
                if (m_AirDropBase != NULL)
                {
                    m_AirDropBase.SetPosition(vector.Zero);
                    GetGame().ObjectDelete( m_AirDropBase ); 
                    m_AirDropBase = NULL;    
                }
                
                if (m_AirDropLoot != NULL)
                {
                    m_AirDropLoot.SetPosition(vector.Zero);
                    GetGame().ObjectDelete( m_AirDropLoot ); 
                    m_AirDropLoot = NULL;    
                }
                
                if (DropEffect != NULL)
                {
                    DropEffect.Stop();
                    DropEffect = NULL;
                }
                
                if (SignalEffect != NULL)
                {
                    SignalEffect.Stop();
                    SignalEffect = NULL;
                }
                
                // Reset it to default values
                AirPassed = false;
                TimerPassed = false;
                AirDropTime = 0;
                AirTimer = 0;    
                DropTime = false;        
                RemovePased = true;    
            }
        }
        
        //  After how much time after restart need to wait before airplane spawn
        if (AirTimer <= TicksTimerFromStart)
        {
            AirTimer++;
            
            if (PrintDebugMessages)
            SendMessage("[Airdrop, Debug] Airtimer value is " + AirTimer);
        }
        else
        {    
            // Reset it to default values
            TimerPassed = true;
        }

        if (TimerPassed && !AirPassed)    
        {
            if (PrintDebugMessages)
            SendMessage("[Airdrop, Debug] Airtimer passed");    
            
            GetAirPlaneInfo();
            
            if (PrintDebugMessages)
            SendMessage("[Airdrop, Debug] Airdrop spawned via timer");        
                
            // Reset it to default values
            AirPassed = true;
        }    

        if (AirPassed)
        {
            if (m_AirPlane)
            {
                MoveAirPlane();
            }
        }
            
        if (AirDropTime <= RandomTime)
        {
            AirDropTime++;
            
            if (TeleportDebug) // For debug puproses only
            {
                SendPos(m_AirPlane.GetPosition());
            }

            if (PrintDebugMessages)
                SendMessage("[Airdrop, Debug] Airdrop time is " + AirDropTime + " from " + RandomTime);        
        }
        else
        {
            if (Delay <= 1000)
            {
                Delay++;
            }
            else
            {
                if (!RayReady)
                {
                    if (TeleportDebug) // For debug puproses only
                    {
                        SendPos(m_AirPlane.GetPosition());
                    }
                }
            
                if (!PassTime)
                {
                    // Reset it to default values
                    DropTime = true;
                    PassTime = true;
                }
            }
        }
    }

    /* ### ### ### ### ### ### ### ### */
}

 

Use code brackets please

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×