View Full Version : Request for scripters: Death/ESC-Ban
SNAFU
09-09-2011, 09:05 AM
May I ask any talented c# expert to give me a hint how to install a kind of "death ban" script of online-players for
-leaving their plane via ESC without beeing on safely on the ground
-after X number of deaths
to have a ban for Y minutes.
To draft our server-concept:
We run an dedicated online server and our approach is orientated on historically circumstances and based on daily reports of missions during July 1940. Every ingame hour one mission is launched to simulate certain events of these days as far as possible with the given tools. The nature of these missions demand teamplay and organization, the player will have little chance flying alone or in small numbers and should stick to the tasks given. 95% of the online players just jump into a plane and go straight the shortest way to where they expect to find the fast action, that`s utterly ok (I myself do this also, when I am in the mood), but to have some diversity in servers, we choosed to keep this kind of gameplay out of our server as far as possible. (There are other and better servers for the fast fun&action).
That`s why I am looking for a tool to "punish" players, who just press ESC to choose another and give killed pilots a few minutes to think about what they did wrong.
Any help would be greatly appreciated. ;)
Brgds
SNAFU
Ataros
09-09-2011, 10:01 AM
I can not script it but as you ask for a hint it is possible to remember player's name as adonys describes here http://forum.1cpublishing.eu/showthread.php?t=25817 then check if he left (not bailed out) the plane on the ground or in the air and if the latest break engine of his next aircraft onPlaceEnter and write a message on screen for him like "Sorry, it is prohibited to exit your plane while you are still in the air... etc. Try selecting a new plane in 1 minute."
I would be also interested to have this script running on Repka servers if someone can write it properly.
ZaltysZ
09-09-2011, 10:30 AM
-leaving their plane via ESC without beeing on safely on the ground
It was impossible to do nicely some time ago, because means to check if plane was on ground did not work. I don't know if it is fixed now.
Ataros
09-09-2011, 10:38 AM
It was impossible to do nicely some time ago, because means to check if plane was on ground did not work. I don't know if it is fixed now.
I believe it is fixed. The problem was in too early take-off by humans.
* Airborne status is now checked correctly even if the aircraft in question departed prematurely;
SNAFU
09-09-2011, 10:43 AM
...the plane on the ground or in the air and if the latest break engine of his next aircraft onPlaceEnter and write a message on screen for him like "Sorry, it is prohibited to exit your plane while you are still in the air... etc. Try selecting a new plane in 1 minute."
Thx for the hint, Ataros.
Also possible, but I assume the casual player will spawn, curse, ESC, Spawn, curse, repaeat... and get loud, which would lead to a lot of planes spawing and therefore lags, but if it`s only feasible this route, would be ok also. ;)
I like designing missions, but I don´t have time and the nerves to get myself into C# beyond just taking what I find and copy it together... ;)
It was impossible to do nicely some time ago, because means to check if plane was on ground did not work. I don't know if it is fixed now.
If the "airborne" status is fixed, their should be an easy way to implement a penalty for abandoming planes airborne, without using the parachute. I will try an "message when airborne" trigger, which didn´t work last patch, when I ve got time.
But anyhow, if someone of the scripters would get his hands on a such lines, I`ll buy him a beer. ;)
SNAFU
09-09-2011, 11:41 AM
Thinking about it, I would even consider Ataros suggestion with blocking the players fuel pump as penalty as the best solution.
FG28_Kodiak
09-09-2011, 12:49 PM
My quick and dirty solution ;) (for Beta Patch)
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 Player Prisoner { get; set; }
public DateTime JailTime { 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 (PrisonCamp.Count != 0)
{
foreach (prisonCell pri in PrisonCamp)
{
if (pri.Prisoner == player)
{
TimeSpan ArrestTime = DateTime.Now.Subtract(pri.JailTime);
if (ArrestTime.TotalSeconds < TotalArrestTime)
{
GamePlay.gpLogServer(null, "Player: {0} is under Arrest\n", new object[] { player.Name() });
GamePlay.gpHUDLogCenter(new Player[] { player }, "{0} you are under Arrest!", new object[] { player.Name() });
(actor as AiAircraft).hitNamed(part.NamedDamageTypes.FuelPum pFailure);
}
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())
{
GamePlay.gpLogServer(null, "Player: {0} get a {1} sec. penalty for leaving Airplane in flight\n", new object[] { player.Name(), TotalArrestTime });
prisonCell NewPrisoner = new prisonCell();
NewPrisoner.Prisoner = player;
NewPrisoner.JailTime = DateTime.Now;
PrisonCamp.Add(NewPrisoner);
}
}
}
Ataros
09-09-2011, 01:21 PM
PrisonCamp! :grin: LOL
Great idea! Thank you! Programming can be very creative :)
Will do my best to enforce it on Repka servers.
Since the script builds a list of prisoners anyway may I ask to add a message "player ... is killed by ..." instead of "AI was killed by..." as described by adonys here when you have some time? http://forum.1cpublishing.eu/showthread.php?t=25817
ps. Does the script excludes pilots who bailed-out from list of prisoners?
Ze-Jamz
09-09-2011, 02:17 PM
Yes please someone try and work with this..
Nothing more annoying than everyone you shoot creating another plane and you've shot down 'AI' again.....really!?
I've done this myself and its just annoying so I at least try an bail..
Any aircraft destroyed should be a kill and any aircraft your in that is destroyed or you bail from should be a death counted against you..
The stats have no meaning at all...As you know that everyone on the list has been shot down numerous times but has just created another plane when they've got themselves in trouble..
Everyone likes to know who they have shot down..come on
Its also adds to the enjoyment of the game as your finishing them off or trying to evade to stay alive...instead of taking lote of hit, giving up and respawning
Ze-Jamz
09-09-2011, 02:17 PM
My quick and dirty solution ;) (for Beta Patch)
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 Player Prisoner { get; set; }
public DateTime JailTime { 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 (PrisonCamp.Count != 0)
{
foreach (prisonCell pri in PrisonCamp)
{
if (pri.Prisoner == player)
{
TimeSpan ArrestTime = DateTime.Now.Subtract(pri.JailTime);
if (ArrestTime.TotalSeconds < TotalArrestTime)
{
GamePlay.gpLogServer(null, "Player: {0} is under Arrest\n", new object[] { player.Name() });
GamePlay.gpHUDLogCenter(new Player[] { player }, "{0} you are under Arrest!", new object[] { player.Name() });
(actor as AiAircraft).hitNamed(part.NamedDamageTypes.FuelPum pFailure);
}
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())
{
GamePlay.gpLogServer(null, "Player: {0} get a {1} sec. penalty for leaving Airplane in flight\n", new object[] { player.Name(), TotalArrestTime });
prisonCell NewPrisoner = new prisonCell();
NewPrisoner.Prisoner = player;
NewPrisoner.JailTime = DateTime.Now;
PrisonCamp.Add(NewPrisoner);
}
}
}
Thanks mate..that will do for now :)
SNAFU
09-09-2011, 02:49 PM
Thank you indeed Kodiak! I will try this as soon as I am home again (should not be before Sunday evening).
If you tell me how to extend this script with a kind of death-penalty (maybe "You are on Cloud 7 - Wait for the bells!")?
As a return I could offer a personalized 109 skin, maybe not the best, but certainly unique... :-P :cool:
FG28_Kodiak
09-09-2011, 04:27 PM
Corrected Script after Ataros hint with bail out:
if the player bailed out OnPlaceLeave is also called and then OnPlaceEnter is called but the Actor is null. So i remove the player from prison if that's the case.
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 Player Prisoner { get; set; }
public DateTime JailTime { 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 him from prison
{
if (PrisonCamp.Count != 0)
{
foreach (prisonCell pri in PrisonCamp)
{
if (pri.Prisoner == player)
{
pri.Removable = true;
}
}
PrisonCamp.RemoveAll(item => item.Removable == true);
}
}
if (PrisonCamp.Count != 0)
{
foreach (prisonCell pri in PrisonCamp)
{
if (pri.Prisoner == player)
{
TimeSpan ArrestTime = DateTime.Now.Subtract(pri.JailTime);
if (ArrestTime.TotalSeconds < TotalArrestTime)
{
GamePlay.gpLogServer(null, "Player: {0} get a {1} sec. penalty for leaving Airplane in flight\n", new object[] { player.Name(), TotalArrestTime });
GamePlay.gpHUDLogCenter(new Player[] { player }, "{0} you are under Arrest!", new object[] { player.Name() });
(actor as AiAircraft).hitNamed(part.NamedDamageTypes.FuelPum pFailure);
}
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.Prisoner = player;
NewPrisoner.JailTime = DateTime.Now;
PrisonCamp.Add(NewPrisoner);
}
}
}
Ze-Jamz
09-09-2011, 04:31 PM
So for simpletons what does this mean..
A: If player bails out from plane after taking Dmg =?
B: If player creates another plane after Dmg which AI now fly the plane =?
Thanks for your work ~S~
FG28_Kodiak
09-09-2011, 04:47 PM
After bailing the plane should hit the ground.
If the player leaves the plane and creates a new one the ai gets active. Or you destroy() the plane via script.
SNAFU
09-09-2011, 04:54 PM
Thank you. Implemented this into my mission script and put it online, currently running on the III/JG27 Server. Unfortunatly I have no chance to test it.
But I got it to the "plane-destroy-after-ESCleaving-script" with its OnPlaceLeave- and OnPlayerEnter- Call-ups, without putting out error messages, so far.
So the plane is destroyed after abandoming and the player should get 10mins break, by blocked fuel pump in the next 10mins (I increased the time and that was what I thought the script does)
If someone is able to test it on our server, please report back.
My Mission-Skript looks following:
...Well, 169574 characters and only 50000 allowed....
FG28_Kodiak
09-09-2011, 05:16 PM
Testing now - at the moment i've to wait 10min ;)
Ataros
09-09-2011, 05:28 PM
Another suggestion is to print time left for player till he can create new plane on screen.
Is it possible to add the last damager to the chat message for everyone to let everyone know who shot him down?
Ataros
09-09-2011, 05:29 PM
My Mission-Skript looks following:
...Well, 169574 characters and only 50000 allowed....
LOL :grin: You can attach it as zip or maybe as txt as well :)
Ze-Jamz
09-09-2011, 05:43 PM
Another suggestion is to print time left for player till he can create new plane on screen.
Is it possible to add the last damager to the chat message for everyone to let everyone know who shot him down?
Wouldnt that show the last person to get a plink on him to be the killer..I.e gets credited with the kill?
FG28_Kodiak
09-09-2011, 05:51 PM
@SNAFU
The fuelpump doesn't block!
Haste mal wieder die Klammern durcheinandergebracht? :-P
Another suggestion is to print time left for player till he can create new plane on screen.
Is on my todo list ;)
Is it possible to add the last damager to the chat message for everyone to let everyone know who shot him down?
Without a problem ;)
Ataros
09-09-2011, 06:01 PM
Maybe something like this would work?
(actor as AiAircraft).hitNamed(part.NamedDamageTypes.Eng0Tot alFailure);
I've seen it in another script working.
FG28_Kodiak
09-09-2011, 06:15 PM
At my Testmission FuelPumpFailure works without a problem. So i dont know what's going wrong.
SNAFU
09-09-2011, 07:38 PM
@Kodiak, nö, dann hätte er ja Fehlermeldungen rausgespuckt. I just get the usual "Object not set to a reference" messages as before, nothing unusual...
Does the script recognize that the player just spawned and wants to change the airfield, so didn´t even takeoff? Will the player get a penalty then also?
I attached the script below. I have also the "plane-destroy-after-abandoming" script running, so I have troubles with calling up the "OnPlayerLeave" parts twice.
FG28_Kodiak
09-09-2011, 07:49 PM
No the script uses Aircraft.IsAirborne, if true the plane is in the Air, if false the plane is on ground. But this works only again in the Beta Patch and then i hope so forever after the next reqular patch. ;)
I will take a look at your script.
At the moment i work on your Death penalty -> Brzzzzlll ;) and on the Arrest Count Down.
SNAFU
09-10-2011, 08:33 AM
Nice! :)
If you need further infos let me know, I`ve got access to our server, but not the game installed on my notebook.
FG28_Kodiak
09-10-2011, 02:03 PM
New Version, added Player Countdown, changed Player in Prisoncell from object refence to Playername, so the penalty should be still active, even the player reconnected.
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() });
(actor as AiAircraft).hitNamed(part.NamedDamageTypes.FuelPum pFailure);
}
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);
}
}
}
}
SNAFU
09-10-2011, 04:05 PM
Thanks, I try now to load that script via submission and currently running on our server.
If someone is able to test, please report back... ;)
FG28_Kodiak
09-10-2011, 07:00 PM
So another Script, Player Plane Memory function. ;)
actual its a early 'alpha'
it's shows the playername after shootdown, even if the enemy player leaved the plane via esc or bailed out.
then a short message will shown playername1 shoot down by playername2.
the message is only shown if a human shoot down a human, the others are in work.
Knows anybody how to disable the gamemessages in chat or override them?
I actually hoped we get this possibility with the beta patch, so we can change the game messages against our own messages, but i don't find anything. But i look deeper in it ;)
using System;
using maddox.game;
using maddox.game.world;
using System.Collections.Generic;
public class Mission : AMission
{
public class AirplanePlayerName
{
public AiAircraft PlayerAirplane{ get; set; }
public string PilotName { get; set; }
public bool Removable { get; set; }
}
public List<AirplanePlayerName> UsedAirplanes = new List<AirplanePlayerName>();
public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
{
base.OnPlaceEnter(player, actor, placeIndex);
// Player enter Aircraft as Pilot
if (actor != null && (actor is AiAircraft) && placeIndex == 0)
{
foreach (AirplanePlayerName actplane in UsedAirplanes)
{
if (actplane.PlayerAirplane == (actor as AiAircraft)) // plane is already in list
{
actplane.PilotName = player.Name(); // change the pilot name
return;
}
}
AirplanePlayerName NewAircraft = new AirplanePlayerName();
NewAircraft.PilotName = player.Name();
NewAircraft.PlayerAirplane = (actor as AiAircraft);
UsedAirplanes.Add(NewAircraft);
}
}
public override void OnActorDead(int missionNumber, string shortName, AiActor actor, System.Collections.Generic.List<DamagerScore> damages)
{
base.OnActorDead(missionNumber, shortName, actor, damages);
if (actor is AiAircraft)
{
foreach (DamagerScore ds in damages)
{
if (ds.initiator.Player != null && (actor as AiAircraft).InternalTypeName() != null)
{
foreach (AirplanePlayerName actPlane in UsedAirplanes)
{
if (actPlane.PlayerAirplane == (actor as AiAircraft) && !actPlane.Removable)
{
Timeout(1.0, () =>
{
GamePlay.gpLogServer(null, "\n\n===> Player: {0} was shoot down by {1} <===\n\n", new object[] { actPlane.PilotName, ds.initiator.Player.Name() });
});
actPlane.Removable = true;
}
}
}
}
}
UsedAirplanes.RemoveAll(item => item.Removable == true);
}
public override void OnActorDestroyed(int missionNumber, string shortName, maddox.game.world.AiActor actor)
{
base.OnActorDestroyed(missionNumber, shortName, actor);
if (actor is AiAircraft)
{
foreach (AirplanePlayerName actPlane in UsedAirplanes)
{
if (actPlane.PlayerAirplane == (actor as AiAircraft))
{
actPlane.Removable = true;
}
}
}
UsedAirplanes.RemoveAll(item => item.Removable == true);
}
}
SNAFU
09-11-2011, 09:49 AM
Allright, I just put these 2 scripst 1to1 into an empty submissions and load them into the main mission via mainscript.
Concerning your penalty script: Message and countdown works fine, only the fuelpump is still operable after penalty. I am now trying different damage types, will report back.
I added the other damagetypes as you see below, but they all are ignored, I just can take off as usual.
.
.
.
if (ArrestTime.TotalSeconds < TotalArrestTime)
{
TimeSpan RestTime = pri.ArrestEndTime.Subtract(DateTime.Now);
GamePlay.gpLogServer(null, "Player: {0} gets a time penalty for leaving Airplane in flight\n", new object[] { player.Name() });
(actor as AiAircraft).hitNamed (part.NamedDamageTypes.ControlsElevatorDisabled);
(actor as AiAircraft).hitNamed (part.NamedDamageTypes.ControlsAileronsDisabled);
(actor as AiAircraft).hitNamed (part.NamedDamageTypes.ControlsRudderDisabled);
(actor as AiAircraft).hitNamed (part.NamedDamageTypes.FuelPumpFailure);
(actor as AiAircraft).hitNamed (part.NamedDamageTypes.FuelTank0Exploded);
(actor as AiAircraft).hitNamed (part.NamedDamageTypes.Eng0TotalSeizure);
}
.
.
.
PS: Tested the script also on an empty mission, without any other script with the same results... no penalty. ;(
FG28_Kodiak
09-11-2011, 10:16 AM
Are the player planes created in Submission or Mainmission?
SNAFU
09-11-2011, 10:42 AM
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)
FG28_Kodiak
09-11-2011, 05:15 PM
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.
FG28_Kodiak
09-11-2011, 08:01 PM
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).
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);
}
}
}
}
Ataros
10-04-2011, 02:45 PM
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.
SNAFU
10-04-2011, 02:47 PM
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. ;)
vBulletin® v3.8.4, Copyright ©2000-2024, Jelsoft Enterprises Ltd.