#31
|
|||
|
|||
Player planes are spawned on airfields of mainmission. But also didn´t work when I load the script as sole script of the main-mission, as mainscript, if you know what I mean.
MissionA.mis (spawn-airfield) MissionA.cs (penalty script)
__________________
http://cornedebrouwer.nl/cf48e |
#32
|
|||
|
|||
So i tested the script as a single and a multiplayer version (as host) without any problem. But i don't have a dedicated server so i can not test this case.
Think we should meet us in ts, so we can run a test on a dedi. Edit: Ok there is a problem with Dedicated Server, hitnamed seems to be ignored. Last edited by FG28_Kodiak; 09-11-2011 at 04:50 PM. |
#33
|
|||
|
|||
So script modified, hitnamed not working on dedicated so i use cutlimb
On ground the Undercarriage is cut off and in Air the tail (@SNAFU: Works with Spitfires also, problem on spitfire was only one part should be cut off, all others are ignored). Code:
using System; using maddox.game; using maddox.game.world; using System.Collections.Generic; public class Mission : AMission { const int TotalArrestTime = 30; // Time in seconds public class prisonCell { public string PrisonerName { get; set; } public DateTime ArrestBeginTime { get; set; } public DateTime ArrestEndTime { get; set; } public bool Removable { get; set; } } public List<prisonCell> PrisonCamp = new List<prisonCell>(); public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex) { base.OnPlaceEnter(player, actor, placeIndex); if (actor == null) // if player bailed out the actor is null so remove the player from prison if he is in { if (PrisonCamp.Count != 0) { foreach (prisonCell pri in PrisonCamp) { if (pri.PrisonerName.Equals(player.Name())) { pri.Removable = true; } } PrisonCamp.RemoveAll(item => item.Removable == true); } } if (PrisonCamp.Count != 0) { foreach (prisonCell pri in PrisonCamp) { if (pri.PrisonerName.Equals(player.Name())) { TimeSpan ArrestTime = DateTime.Now.Subtract(pri.ArrestBeginTime); if (ArrestTime.TotalSeconds < TotalArrestTime) { TimeSpan RestTime = pri.ArrestEndTime.Subtract(DateTime.Now); GamePlay.gpLogServer(null, "Player: {0} get a time penalty for leaving Airplane in flight\n", new object[] { player.Name() }); if (!(actor as AiAircraft).IsAirborne()) { (actor as AiAircraft).cutLimb(part.LimbNames.UC0); (actor as AiAircraft).cutLimb(part.LimbNames.UC1); (actor as AiAircraft).cutLimb(part.LimbNames.UC2); (actor as AiAircraft).cutLimb(part.LimbNames.UC3); (actor as AiAircraft).cutLimb(part.LimbNames.UC4); (actor as AiAircraft).cutLimb(part.LimbNames.UC5); } else { (actor as AiAircraft).cutLimb(part.LimbNames.Tail0); (actor as AiAircraft).cutLimb(part.LimbNames.Tail1); (actor as AiAircraft).cutLimb(part.LimbNames.Tail2); (actor as AiAircraft).cutLimb(part.LimbNames.Tail3); (actor as AiAircraft).cutLimb(part.LimbNames.Tail4); (actor as AiAircraft).cutLimb(part.LimbNames.Tail5); (actor as AiAircraft).cutLimb(part.LimbNames.Tail6); (actor as AiAircraft).cutLimb(part.LimbNames.Tail7); } } else { pri.Removable = true; } } } PrisonCamp.RemoveAll(item => item.Removable == true); } } public override void OnPlaceLeave(Player player, AiActor actor, int placeIndex) { base.OnPlaceLeave(player, actor, placeIndex); if ((actor as AiAircraft).IsAirborne()) { prisonCell NewPrisoner = new prisonCell(); NewPrisoner.PrisonerName = player.Name(); NewPrisoner.ArrestBeginTime = DateTime.Now; NewPrisoner.ArrestEndTime = DateTime.Now.AddSeconds(TotalArrestTime); PrisonCamp.Add(NewPrisoner); } } public override void OnTickGame() { base.OnTickGame(); if (Time.tickCounter() % 34 == 0) // 34 Ticks should be a second { if (PrisonCamp.Count != 0) { foreach (prisonCell pri in PrisonCamp) { foreach (Player aktplayer in GamePlay.gpRemotePlayers()) { if (pri.PrisonerName.Equals(aktplayer.Name())) { TimeSpan RestTime = pri.ArrestEndTime.Subtract(DateTime.Now); if (RestTime.TotalSeconds > 0.0) { GamePlay.gpHUDLogCenter(new Player[] { aktplayer }, "{0} Arrest ends in {1:00} min. {2:00} sec.", new object[] { aktplayer.Name(), RestTime.Minutes, RestTime.Seconds }); } else { GamePlay.gpHUDLogCenter(new Player[] { aktplayer }, "{0} Arrest over - Have Fun!", new object[] { aktplayer.Name() }); pri.Removable = true; } } } } PrisonCamp.RemoveAll(item => item.Removable == true); } } } } |
#34
|
|||
|
|||
When tested the script on III./JG27 Server (iirc) I was still able to enter aircraft that were already flying in AI groups while under arrest.
|
#35
|
|||
|
|||
The script is currently not used on our server, due to problems with changing place in mulitcrew planes, but Kodiak posted that is aware of this problem and is going to correct it.
__________________
http://cornedebrouwer.nl/cf48e |
|
|