Fulqrum Publishing Home   |   Register   |   Today Posts   |   Members   |   UserCP   |   Calendar   |   Search   |   FAQ

Go Back   Official Fulqrum Publishing forum > Fulqrum Publishing > IL-2 Sturmovik: Cliffs of Dover > FMB, Mission & Campaign builder Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 03-10-2012, 12:22 PM
salmo salmo is offline
Approved Member
 
Join Date: Mar 2011
Posts: 632
Default

Chat when aircraft takes off
Code:
public override void OnAircraftTookOff(int missionNumber, string shortName, AiAircraft aircraft)
    {
     sendChatMessageTo(aircraft.Army(), "The aircraft took off", null);
    }

    private void sendChatMessageTo(int army, string msg, object[] parms)
    {   // send a chat message to all players in specified army (1=red; 2=blue)
        List<Player> Players = new List<Player>();
        // on Dedi the server:
        if (GamePlay.gpPlayer() != null)
        {
            if (GamePlay.gpPlayer().Army() == army || army == -1)
                Players.Add(GamePlay.gpPlayer());
        } //rest of the crowd
        if (GamePlay.gpRemotePlayers() != null || GamePlay.gpRemotePlayers().Length > 0)
        {
            foreach (Player p in GamePlay.gpRemotePlayers())
            {
                if (p.Army() == army || army == -1)
                    Players.Add(p);
            }
        }
        if (Players != null && Players.Count > 0)
            GamePlay.gpLogServer(Players.ToArray(), msg, parms);
    }
Chat every 15 minutes
Code:
public class Mission : AMission
{
Stopwatch missionTimer = new Stopwatch();

public override void OnBattleStarted()
    {
        base.OnBattleStarted();
        missionTimer.Start();
    }

public override void OnTickGame()
    {
        base.OnTickGame();

        if (missionTimer.Elapsed.Minutes >= 15)
        {
            missionTimer.Restart();
            sendChatMessageTo(-1, "Chat every 15 min", null);  // chat to all players
        }
     }

}
__________________
When one engine fails on a two engine bomber, you will always have enough power left to get to the scene of the crash.

Get the latest COD Team Fusion patch info HERE

Last edited by salmo; 03-10-2012 at 12:30 PM.
Reply With Quote
  #2  
Old 03-11-2012, 09:58 PM
_79_dev _79_dev is offline
Approved Member
 
Join Date: Sep 2010
Location: Dublin
Posts: 242
Default

no use of Your code salmo, it has errors, unless i am wrong and dont know where to add it exacly...anyone else?
__________________

Asus P6T V2 Deluxe, I7 930, 3x2 GB RAM XMS3 Corsair1333 Mhz, Nvidia Leadtek GTX 470, Acer 1260p screen projector, Track IR 4 OS ver5, Saitek Pro Flight Rudder, Saitek X52, Win 7 x64 ultimate
Reply With Quote
  #3  
Old 03-11-2012, 11:39 PM
Smokeynz Smokeynz is offline
Approved Member
 
Join Date: Apr 2011
Posts: 106
Default

Btw, please use code # holder when you post code, easier to handle.

just rebuilt the code layout in visual studio, already contains the code screen messages to players. plus on take off.

If you find the on take off lines in code, see how I added the on take off message in the following example.

note: Salmos examples for message cycles will actually conflict with timers in current code, they are only examples. Quite often you need to modify to use.

Code:
public override void OnAircraftTookOff(int missionNumber, string shortName, AiAircraft aircraft)
    {
        #region stats
        base.OnAircraftTookOff(missionNumber, shortName, aircraft);
        try
        {
            stats.aircraftTakeoff(shortName, aircraft);
        }
        catch (Exception ex)
        {
            System.Console.WriteLine("Stats.OnAircraftTookOff - Exception: " + ex);
        }
        #endregion

        sendChatMessageTo(aircraft.Army(), " 79 Dev says The aircraft took off", null);

        //add your code here
    }

Last edited by Smokeynz; 03-12-2012 at 12:00 AM.
Reply With Quote
  #4  
Old 03-12-2012, 07:45 AM
_79_dev _79_dev is offline
Approved Member
 
Join Date: Sep 2010
Location: Dublin
Posts: 242
Default

ok thanks for help...
__________________

Asus P6T V2 Deluxe, I7 930, 3x2 GB RAM XMS3 Corsair1333 Mhz, Nvidia Leadtek GTX 470, Acer 1260p screen projector, Track IR 4 OS ver5, Saitek Pro Flight Rudder, Saitek X52, Win 7 x64 ultimate
Reply With Quote
  #5  
Old 03-12-2012, 07:56 AM
_79_dev _79_dev is offline
Approved Member
 
Join Date: Sep 2010
Location: Dublin
Posts: 242
Default

ok, if I use this code:

Code:
   
 public override void OnAircraftTookOff(int missionNumber, string shortName, AiAircraft aircraft)
    {
        #region stats
        base.OnAircraftTookOff(missionNumber, shortName, aircraft);
        try
        {
            stats.aircraftTakeoff(shortName, aircraft);
        }
        catch (Exception ex)
        {
            System.Console.WriteLine("Stats.OnAircraftTookOff - Exception: " + ex);
        }

       #endregion

        sendChatMessageTo(aircraft.Army(), " _79_dev has a problem", null);

            //add your code here
    }
console gives me error anyway????

System.Exception: c:\Users\John\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\missions\Multi\Dogfight\Kanalkampf\kanalkamp f_spawns.cs(446,9): error CS0103: The name 'sendChatMessageTo' does not exist in the current context
c:\Users\John\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\missions\Multi\Dogfight\Kanalkampf\kanalkamp f_spawns.cs(446,27): error CS1501: No overload for method 'Army' takes 1 arguments
at LB33FuQ4EXuxyJPZ68D.GrT31TQ99wLitevXpuS.ATy34ceFvF k(String , Boolean , Boolean )
at LB33FuQ4EXuxyJPZ68D.GrT31TQ99wLitevXpuS.3LP34ebVrC U(String )
at LB33FuQ4EXuxyJPZ68D.GrT31TQ99wLitevXpuS.gMaqT2fu7O VhvSHaMehN(Object )
at LB33FuQ4EXuxyJPZ68D.GrT31TQ99wLitevXpuS.Xi734IyswC Q(String , Int32 )
=================================================
=================================================
System.Exception: c:\Users\John\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\missions\Multi\Dogfight\Kanalkampf\kanalkamp f_spawns.cs(446,9): error CS0103: The name 'sendChatMessageTo' does not exist in the current context
c:\Users\John\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\missions\Multi\Dogfight\Kanalkampf\kanalkamp f_spawns.cs(446,27): error CS1501: No overload for method 'Army' takes 1 arguments
at LB33FuQ4EXuxyJPZ68D.GrT31TQ99wLitevXpuS.Xi734IyswC Q(String , Int32 )
at 4YQguDGg7WLABsU9pm3.T8Lw4SGw95gwTxUSs13.ySFG6YYvRQ bIruAHfae(Object , Int32 )
at 4YQguDGg7WLABsU9pm3.T8Lw4SGw95gwTxUSs13.sWbmrit6GT (dL3MgPdYLnmRhd1hBIK )
=================================================
__________________

Asus P6T V2 Deluxe, I7 930, 3x2 GB RAM XMS3 Corsair1333 Mhz, Nvidia Leadtek GTX 470, Acer 1260p screen projector, Track IR 4 OS ver5, Saitek Pro Flight Rudder, Saitek X52, Win 7 x64 ultimate

Last edited by _79_dev; 03-12-2012 at 08:13 AM.
Reply With Quote
  #6  
Old 03-12-2012, 08:48 AM
Smokeynz Smokeynz is offline
Approved Member
 
Join Date: Apr 2011
Posts: 106
Default

ahh thats because it is actually...it isnt Chat..slap myself

sendScreenMessageTo
Reply With Quote
  #7  
Old 03-12-2012, 08:56 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

@_79_dev

Code:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using maddox.game;
using maddox.game.world;
using maddox.GP;


public class Mission : AMission
{


    private void sendChatMessage(string msg, params object[] args)
    {
        GamePlay.gpLogServer(null, msg, args);
    }


    private void sendChatMessage(Player player, string msg, params object[] args)
    {
        if (player != null)
            GamePlay.gpLogServer(new Player[] { player }, msg, args);
    }


    private void sendChatMessage(int army, string msg, params object[] args)
    {
        List<Player> Consignees = new List<Player>();

        if (GamePlay.gpPlayer() != null)
            Consignees.Add(GamePlay.gpPlayer());
        if (GamePlay.gpRemotePlayers() != null)
            Consignees.AddRange(GamePlay.gpRemotePlayers());

        if (army == -1)
            GamePlay.gpLogServer(null, msg, args);
        else if (Consignees.Exists(item => item.Army() == army))
            GamePlay.gpLogServer(Consignees.FindAll(item => item.Army() == army).ToArray(), msg, args);
    }


    private void sendScreenMessage(string msg, params object[] args)
    {
        GamePlay.gpHUDLogCenter(null, msg, args);
    }


    private void sendScreenMessage(Player player, string msg, params object[] args)
    {
        if (player != null)
            GamePlay.gpHUDLogCenter(new Player[] { player }, msg, args);
    }


    private void sendScreenMessage(int army, string msg, params object[] args)
    {
        List<Player> Consignees = new List<Player>();

        if (GamePlay.gpPlayer() != null)
            Consignees.Add(GamePlay.gpPlayer());
        if (GamePlay.gpRemotePlayers() != null)
            Consignees.AddRange(GamePlay.gpRemotePlayers());

        if (army == -1)
            GamePlay.gpHUDLogCenter(null, msg, args);
        else if (Consignees.Exists(item => item.Army() == army))
            GamePlay.gpHUDLogCenter(Consignees.FindAll(item => item.Army() == army).ToArray(), msg, args);
    }


 public override void OnAircraftTookOff(int missionNumber, string shortName, AiAircraft aircraft)
    {
        #region stats
        base.OnAircraftTookOff(missionNumber, shortName, aircraft);
        try
        {
            stats.aircraftTakeoff(shortName, aircraft);
        }
        catch (Exception ex)
        {
            System.Console.WriteLine("Stats.OnAircraftTookOff - Exception: " + ex);
        }

       #endregion

        sendChatMessage(aircraft.Army(), " _79_dev has a problem");

            //add your code here
    }

}
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:32 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.